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

Proposed by Syed Mushtaq Ahmed on 2017-04-05
Status: Merged
Merged at revision: 33816e96d8981918f734dab3ee1a967bce85451a
Proposed branch: ~syed1/cloud-init:cs-centos7
Merge into: cloud-init:master
Diff against target: 16 lines (+2/-2)
1 file modified
cloudinit/sources/DataSourceCloudStack.py (+2/-2)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Needs Fixing on 2017-04-21
Scott Moser 2017-04-05 Approve on 2017-04-21
Review via email: mp+322024@code.launchpad.net

Commit Message

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.

To post a comment you must log in.
Scott Moser (smoser) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/sources/DataSourceCloudStack.py b/cloudinit/sources/DataSourceCloudStack.py
2index b0ab275..acc272f 100644
3--- a/cloudinit/sources/DataSourceCloudStack.py
4+++ b/cloudinit/sources/DataSourceCloudStack.py
5@@ -178,9 +178,9 @@ def get_default_gateway():
6
7 def get_dhclient_d():
8 # find lease files directory
9- supported_dirs = ["/var/lib/dhclient", "/var/lib/dhcp"]
10+ supported_dirs = ["/var/lib/dhclient", "/var/lib/dhcp", "/var/lib/NetworkManager"]
11 for d in supported_dirs:
12- if os.path.exists(d):
13+ if os.path.exists(d) and len(os.listdir(d)) > 0:
14 LOG.debug("Using %s lease directory", d)
15 return d
16 return None

Subscribers

People subscribed via source and target branches