summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorKurt Stieger <kurt@easygo.at>2019-03-04 15:54:25 +0000
committerServer Team CI Bot <josh.powers+server-team-bot@canonical.com>2019-03-04 15:54:25 +0000
commitbd35300ba36bd63686715fa9661516a518781f6d (patch)
tree9a2a0f4d5b8ec44575418269fb3e1b547c6ad506 /cloudinit
parentf2f530e5960ce8afd33e7f62a9b5d8898a6d0d79 (diff)
downloadvyos-cloud-init-bd35300ba36bd63686715fa9661516a518781f6d.tar.gz
vyos-cloud-init-bd35300ba36bd63686715fa9661516a518781f6d.zip
net: append type:dhcp[46] only if dhcp[46] is True in v2 netconfig
When providing netplan configuration to cloud-init, the internal network state would enable DHCP if the 'dhcp' key was present in the source config. In netplan, dhcp[46] is a boolean and the value of the boolean should control whether DHCP is enabled rather than the presence of the key. This issue leaded to inconsistant sysconfig/network-scripts on fedora. 'BOOTPROTO' was always 'dhcp', even if the address config was static. After this change a dhcp subnet is added only if the 'dhcp' setting in source cfg dict is True. LP: #1818032
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/net/network_state.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index f76e508a..539b76d8 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -706,9 +706,9 @@ class NetworkStateInterpreter(object):
"""Common ipconfig extraction from v2 to v1 subnets array."""
subnets = []
- if 'dhcp4' in cfg:
+ if cfg.get('dhcp4'):
subnets.append({'type': 'dhcp4'})
- if 'dhcp6' in cfg:
+ if cfg.get('dhcp6'):
self.use_ipv6 = True
subnets.append({'type': 'dhcp6'})