summaryrefslogtreecommitdiff
path: root/cloudinit/sources/helpers/vmware/imc
diff options
context:
space:
mode:
authorSankar Tanguturi <stanguturi@vmware.com>2016-09-06 14:51:32 -0700
committerScott Moser <smoser@brickies.net>2017-01-17 11:27:07 -0500
commit8ddb57149281ba2658696f19c1eb96e7769381e4 (patch)
treef635d63c960788eafeb2a0a322462c5f5ba7e369 /cloudinit/sources/helpers/vmware/imc
parente2274393b882c723ab93189c57e7e68a46e4e10f (diff)
downloadvyos-cloud-init-8ddb57149281ba2658696f19c1eb96e7769381e4.tar.gz
vyos-cloud-init-8ddb57149281ba2658696f19c1eb96e7769381e4.zip
Fixed Misc issues related to VMware customization.
- staticIPV4 property can be either None or a valid Array. Need to check for None before accessing the ip address. - Modified few misc. log messages. - Added a new log message while waiting for the customization config file. - Added support to configure the maximum amount of time to wait for the customization config file. - VMware Customization Support is provided only for DataSourceOVF class and not for any other child classes. Implemented a new variable vmware_customization_supported to check whether the 'VMware Customization' support is available for a specific datasource or not. - Changed the function get_vmware_cust_settings to get_max_wait_from_cfg. - Removed the code that does 'ifdown and iup' in NIC configurator.
Diffstat (limited to 'cloudinit/sources/helpers/vmware/imc')
-rw-r--r--cloudinit/sources/helpers/vmware/imc/config_nic.py24
1 files changed, 6 insertions, 18 deletions
diff --git a/cloudinit/sources/helpers/vmware/imc/config_nic.py b/cloudinit/sources/helpers/vmware/imc/config_nic.py
index d5a7c346..67ac21db 100644
--- a/cloudinit/sources/helpers/vmware/imc/config_nic.py
+++ b/cloudinit/sources/helpers/vmware/imc/config_nic.py
@@ -101,7 +101,11 @@ class NicConfigurator(object):
return lines
# Static Ipv4
- v4 = nic.staticIpv4
+ addrs = nic.staticIpv4
+ if not addrs:
+ return lines
+
+ v4 = addrs[0]
if v4.ip:
lines.append(' address %s' % v4.ip)
if v4.netmask:
@@ -197,22 +201,6 @@ class NicConfigurator(object):
util.subp(["pkill", "dhclient"], rcs=[0, 1])
util.subp(["rm", "-f", "/var/lib/dhcp/*"])
- def if_down_up(self):
- names = []
- for nic in self.nics:
- name = self.mac2Name.get(nic.mac.lower())
- names.append(name)
-
- for name in names:
- logger.info('Bring down interface %s' % name)
- util.subp(["ifdown", "%s" % name])
-
- self.clear_dhcp()
-
- for name in names:
- logger.info('Bring up interface %s' % name)
- util.subp(["ifup", "%s" % name])
-
def configure(self):
"""
Configure the /etc/network/intefaces
@@ -232,6 +220,6 @@ class NicConfigurator(object):
for line in lines:
fp.write('%s\n' % line)
- self.if_down_up()
+ self.clear_dhcp()
# vi: ts=4 expandtab