summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
authorScott Moser <smoser@brickies.net>2017-07-21 16:50:27 -0400
committerScott Moser <smoser@brickies.net>2017-07-22 11:28:55 -0400
commit681baff19dc16ef2efdfb8499ad74aea0efbe467 (patch)
tree690957bd0339666e8d8e247cce6c4bde14506071 /cloudinit/net
parent33d573907d3ffc790e28102ecac15c3be6a85462 (diff)
downloadvyos-cloud-init-681baff19dc16ef2efdfb8499ad74aea0efbe467.tar.gz
vyos-cloud-init-681baff19dc16ef2efdfb8499ad74aea0efbe467.zip
sysconfig: support subnet type of 'manual'.
The subnet type 'manual' was used as a way to declare a device and set an MTU for it but not assign network addresses. This updates the manual example config to handle that case and provides expected rendered output for sysconfig, eni, and netplan.
Diffstat (limited to 'cloudinit/net')
-rw-r--r--cloudinit/net/sysconfig.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index 9184bce6..a550f97c 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -61,6 +61,9 @@ class ConfigMap(object):
def __getitem__(self, key):
return self._conf[key]
+ def __contains__(self, key):
+ return key in self._conf
+
def drop(self, key):
self._conf.pop(key, None)
@@ -298,14 +301,16 @@ class Renderer(renderer.Renderer):
if subnet_is_ipv6(subnet):
mtu_key = 'IPV6_MTU'
iface_cfg['IPV6INIT'] = True
-
if 'mtu' in subnet:
iface_cfg[mtu_key] = subnet['mtu']
+ elif subnet_type == 'manual':
+ # If the subnet has an MTU setting, then ONBOOT=True
+ # to apply the setting
+ iface_cfg['ONBOOT'] = mtu_key in iface_cfg
else:
raise ValueError("Unknown subnet type '%s' found"
" for interface '%s'" % (subnet_type,
iface_cfg.name))
-
if subnet.get('control') == 'manual':
iface_cfg['ONBOOT'] = False