summaryrefslogtreecommitdiff
path: root/cloudinit/net/__init__.py
diff options
context:
space:
mode:
authorScott Moser <smoser@ubuntu.com>2016-06-02 13:19:50 -0400
committerScott Moser <smoser@ubuntu.com>2016-06-02 13:19:50 -0400
commit80648a623fe6c7ae397629da30c04e52d79759f2 (patch)
tree19b4047088f6c4930d208084154f9b3456b12fa3 /cloudinit/net/__init__.py
parentb071e4bbbbe1b5a6ced02796696b05d2e1b16778 (diff)
downloadvyos-cloud-init-80648a623fe6c7ae397629da30c04e52d79759f2.tar.gz
vyos-cloud-init-80648a623fe6c7ae397629da30c04e52d79759f2.zip
eni parsing: support 'ether' in hwaddress, netmask and broadcast
this adds ability to support ENI that has: hwadress ether 36:4c:e1:3b:14:31 or hwaddress 36:4c:e1:3b:14:31 the former is written by openstack (at least on dreamhost). Also, in the conversion of eni to network config support broadcast and netmask.
Diffstat (limited to 'cloudinit/net/__init__.py')
-rw-r--r--cloudinit/net/__init__.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index 6d9ea575..05152ead 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -201,7 +201,11 @@ def parse_deb_config_data(ifaces, contents, src_dir, src_path):
ifaces[iface]['method'] = method
currif = iface
elif option == "hwaddress":
- ifaces[currif]['hwaddress'] = split[1]
+ if split[1] == "ether":
+ val = split[2]
+ else:
+ val = split[1]
+ ifaces[currif]['hwaddress'] = val
elif option in NET_CONFIG_OPTIONS:
ifaces[currif][option] = split[1]
elif option in NET_CONFIG_COMMANDS:
@@ -800,8 +804,9 @@ def _ifaces_to_net_config_data(ifaces):
if data.get('method') == 'static':
subnet['address'] = data['address']
- if 'gateway' in data:
- subnet['gateway'] = data['gateway']
+ for copy_key in ('netmask', 'gateway', 'broadcast'):
+ if copy_key in data:
+ subnet[copy_key] = data[copy_key]
if 'dns' in data:
for n in ('nameservers', 'search'):