summaryrefslogtreecommitdiff
path: root/cloudinit/sources/helpers/openstack.py
diff options
context:
space:
mode:
authorJon Grimm <jon.grimm@canonical.com>2016-09-09 16:32:36 -0500
committerScott Moser <smoser@brickies.net>2016-09-12 14:50:38 -0400
commit65ace7b35494dba1747eece815754ab8573d83d8 (patch)
tree6aecf4a54f77927c6124c1144a073317c0b7a380 /cloudinit/sources/helpers/openstack.py
parent2aa9b1ddf80ffe7d35e8437c59670856d612e64e (diff)
downloadvyos-cloud-init-65ace7b35494dba1747eece815754ab8573d83d8.tar.gz
vyos-cloud-init-65ace7b35494dba1747eece815754ab8573d83d8.zip
Allow link type of null in network_data.json
Treat null type as yet another physical type, seen in real-world openstack cloud. Also, support the case where network_data.json provides mac addresses in upper case. Rackspace public cloud currently does that. LP: #1621968
Diffstat (limited to 'cloudinit/sources/helpers/openstack.py')
-rw-r--r--cloudinit/sources/helpers/openstack.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py
index a5a2a1d6..61b0b08c 100644
--- a/cloudinit/sources/helpers/openstack.py
+++ b/cloudinit/sources/helpers/openstack.py
@@ -555,11 +555,12 @@ def convert_net_json(network_json=None, known_macs=None):
if 'name' in link:
cfg['name'] = link['name']
+ link_mac_addr = None
if link.get('ethernet_mac_address'):
- link_id_info[link['id']] = link.get('ethernet_mac_address')
+ link_mac_addr = link.get('ethernet_mac_address').lower()
+ link_id_info[link['id']] = link_mac_addr
- curinfo = {'name': cfg.get('name'),
- 'mac': link.get('ethernet_mac_address'),
+ curinfo = {'name': cfg.get('name'), 'mac': link_mac_addr,
'id': link['id'], 'type': link['type']}
for network in [n for n in networks
@@ -582,10 +583,9 @@ def convert_net_json(network_json=None, known_macs=None):
subnet['ipv6'] = True
subnets.append(subnet)
cfg.update({'subnets': subnets})
- if link['type'] in ['ethernet', 'vif', 'ovs', 'phy', 'bridge', 'tap']:
- cfg.update({
- 'type': 'physical',
- 'mac_address': link['ethernet_mac_address']})
+ if link['type'] in [None, 'ethernet', 'vif', 'ovs', 'phy',
+ 'bridge', 'tap']:
+ cfg.update({'type': 'physical', 'mac_address': link_mac_addr})
elif link['type'] in ['bond']:
params = {}
for k, v in link.items():