diff options
author | Kim Hagen <kim.sidney@gmail.com> | 2018-10-25 13:55:31 +0200 |
---|---|---|
committer | Kim Hagen <kim.sidney@gmail.com> | 2018-10-25 13:55:31 +0200 |
commit | 838581d57c8765d3e487f58bc37ea103af39d26f (patch) | |
tree | 65eda2a0bfbbd9a119b62655b2c943cfdace09db /cloudinit/sources | |
parent | 9967bc76410b7ecddc6d02411cd3bda08a5a7b9a (diff) | |
download | vyos-cloud-init-838581d57c8765d3e487f58bc37ea103af39d26f.tar.gz vyos-cloud-init-838581d57c8765d3e487f58bc37ea103af39d26f.zip |
Add dhcp call to ec2 datasource
Diffstat (limited to 'cloudinit/sources')
-rw-r--r-- | cloudinit/sources/DataSourceEc2.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py index 21e9ef84..efb29f88 100644 --- a/cloudinit/sources/DataSourceEc2.py +++ b/cloudinit/sources/DataSourceEc2.py @@ -10,6 +10,7 @@ import os import time +from subprocess import call from cloudinit import ec2_utils as ec2 from cloudinit import log as logging @@ -26,6 +27,7 @@ SKIP_METADATA_URL_CODES = frozenset([uhelp.NOT_FOUND]) STRICT_ID_PATH = ("datasource", "Ec2", "strict_id") STRICT_ID_DEFAULT = "warn" +DEFAULT_PRIMARY_NIC = 'eth0' _unset = "_unset" @@ -47,6 +49,12 @@ class Platforms(object): class DataSourceEc2(sources.DataSource): dsname = 'Ec2' + process_name = 'dhclient' + + tmpps = os.popen("ps -Af").read() + if process_name not in tmpps[:]: + call(['/sbin/dhclient', DEFAULT_PRIMARY_NIC]) + # Default metadata urls that will be used if none are provided # They will be checked for 'resolveability' and some of the # following may be discarded if they do not resolve |