← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~syed1/cloud-init:cs-centos7 into cloud-init:master

 

Syed Mushtaq Ahmed has proposed merging ~syed1/cloud-init:cs-centos7 into cloud-init:master.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~syed1/cloud-init/+git/cloud-init/+merge/322024

To query the metadata, the Cloudstack source currently scans a predefined DHCP lease directories to find the IP of the DHCP server. This list does not include "/var/lib/NetworkManager/" which is the default directory in CentOS7. I am adding this directory in the list of directories to search for when looking for the lease files. 
-- 
Your team cloud init development team is requested to review the proposed merge of ~syed1/cloud-init:cs-centos7 into cloud-init:master.
diff --git a/cloudinit/sources/DataSourceCloudStack.py b/cloudinit/sources/DataSourceCloudStack.py
index b0ab275..acc272f 100644
--- a/cloudinit/sources/DataSourceCloudStack.py
+++ b/cloudinit/sources/DataSourceCloudStack.py
@@ -178,9 +178,9 @@ def get_default_gateway():
 
 def get_dhclient_d():
     # find lease files directory
-    supported_dirs = ["/var/lib/dhclient", "/var/lib/dhcp"]
+    supported_dirs = ["/var/lib/dhclient", "/var/lib/dhcp", "/var/lib/NetworkManager"]
     for d in supported_dirs:
-        if os.path.exists(d):
+        if os.path.exists(d) and len(os.listdir(d)) > 0:
             LOG.debug("Using %s lease directory", d)
             return d
     return None

Follow ups