From 2d12e2271792b1cee687acfdd9b08025647b4259 Mon Sep 17 00:00:00 2001 From: Yolanda Robla Date: Thu, 31 Aug 2017 10:10:07 +0200 Subject: [PATCH] Fix the dhcp checks on centos It is using a different pathf or leases, so pick it properly. Change-Id: If2ab2b0dc116587976859cc7653affc0b19aedcd (cherry picked from commit 2dc2ca7a24f9ba5ad7370901f02310725d4756a2) --- playbooks/roles/bifrost-test-dhcp/files/test-dhcp.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/bifrost-test-dhcp/files/test-dhcp.py b/playbooks/roles/bifrost-test-dhcp/files/test-dhcp.py index b14887b1f..66bbbf33e 100644 --- a/playbooks/roles/bifrost-test-dhcp/files/test-dhcp.py +++ b/playbooks/roles/bifrost-test-dhcp/files/test-dhcp.py @@ -45,10 +45,15 @@ def main(argv): # now check that we only have these entries in leases file leases = [] if not os.path.exists('/var/lib/misc/dnsmasq.leases'): - print('ERROR: dnsmasq leases file has not been generated') - sys.exit(1) + if not os.path.exists('/var/lib/dnsmasq/dnsmasq.leases'): + print('ERROR: dnsmasq leases file has not been generated') + sys.exit(1) + else: + dns_path = '/var/lib/dnsmasq/dnsmasq.leases' + else: + dns_path = '/var/lib/misc/dnsmasq.leases' - with open('/var/lib/misc/dnsmasq.leases') as csvfile: + with open(dns_path) as csvfile: leases_reader = csv.reader(csvfile, delimiter=' ') for row in leases_reader: leases.append(row)