summaryrefslogtreecommitdiff
path: root/cloudinit/sources/DataSourceCloudStack.py
diff options
context:
space:
mode:
authorWido den Hollander <wido@widodh.nl>2016-04-28 17:33:43 +0200
committerWido den Hollander <wido@widodh.nl>2016-04-28 17:33:43 +0200
commitaee0edd93cb4d78b5e0d1aec71e977aabf31cdd0 (patch)
treef4e949598f001a380a36b73e8b09a3bab92d30ef /cloudinit/sources/DataSourceCloudStack.py
parentb029dcefe1ed33be8ed80f2e376ca6874dfd64f7 (diff)
downloadvyos-cloud-init-aee0edd93cb4d78b5e0d1aec71e977aabf31cdd0.tar.gz
vyos-cloud-init-aee0edd93cb4d78b5e0d1aec71e977aabf31cdd0.zip
cloudstack: Only use DHCPv4 lease files as a datasource
It could be that there are also 'dhclient6.leases' files in /var/lib/dhcp when DHCPv6 is used next to DHCPv4. This patch makes sure we only read from DHCPv4 lease files
Diffstat (limited to 'cloudinit/sources/DataSourceCloudStack.py')
-rw-r--r--cloudinit/sources/DataSourceCloudStack.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/cloudinit/sources/DataSourceCloudStack.py b/cloudinit/sources/DataSourceCloudStack.py
index 455a4652..4ba019df 100644
--- a/cloudinit/sources/DataSourceCloudStack.py
+++ b/cloudinit/sources/DataSourceCloudStack.py
@@ -206,7 +206,8 @@ def get_latest_lease():
latest_mtime = -1
latest_file = None
for file_name in lease_files:
- if file_name.endswith(".lease") or file_name.endswith(".leases"):
+ if file_name.startswith("dhclient.") and \
+ (file_name.endswith(".lease") or file_name.endswith(".leases")):
abs_path = os.path.join(lease_d, file_name)
mtime = os.path.getmtime(abs_path)
if mtime > latest_mtime: