summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyed <syed1.mushtaq@gmail.com>2017-04-05 12:09:02 -0400
committerScott Moser <smoser@ubuntu.com>2017-04-21 10:05:52 -0400
commit33816e96d8981918f734dab3ee1a967bce85451a (patch)
tree999a3fe5067f9b5112ca192c75f9aff51c61c44b
parentdf4ca453520342a0541ab9202305858bf39d4f48 (diff)
downloadvyos-cloud-init-33816e96d8981918f734dab3ee1a967bce85451a.tar.gz
vyos-cloud-init-33816e96d8981918f734dab3ee1a967bce85451a.zip
CloudStack: Add NetworkManager to list of supported DHCP lease dirs.
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. Add that directory to the list.
-rw-r--r--cloudinit/sources/DataSourceCloudStack.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/sources/DataSourceCloudStack.py b/cloudinit/sources/DataSourceCloudStack.py
index ceef0282..0188d894 100644
--- a/cloudinit/sources/DataSourceCloudStack.py
+++ b/cloudinit/sources/DataSourceCloudStack.py
@@ -178,9 +178,10 @@ 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