summaryrefslogtreecommitdiff
path: root/cloudinit
diff options
context:
space:
mode:
authorBrian Candler <b.candler@pobox.com>2020-06-09 21:50:27 +0100
committerGitHub <noreply@github.com>2020-06-09 14:50:27 -0600
commitf083050478adc199648c980991f2bcece79ed31b (patch)
tree08adb81025df86429947a701cd3523da73a76873 /cloudinit
parentc6d09af67626c2f2241c64c10c9e27e8752ba87b (diff)
downloadvyos-cloud-init-f083050478adc199648c980991f2bcece79ed31b.tar.gz
vyos-cloud-init-f083050478adc199648c980991f2bcece79ed31b.zip
Fixes KeyError for bridge with no "parameters:" setting (#423)
Reason: commit ded1ec8 introduced a regression whereby a bridge with no "parameters:" setting caused a KeyError exception. LP: #1879673
Diffstat (limited to 'cloudinit')
-rw-r--r--cloudinit/net/network_state.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index f28973dc..7bfe8be0 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -722,10 +722,10 @@ class NetworkStateInterpreter(metaclass=CommandHandlerMeta):
item_params = dict((key, value) for (key, value) in
item_cfg.items() if key not in
NETWORK_V2_KEY_FILTER)
- # we accept the fixed spelling, but write the old for compatability
+ # we accept the fixed spelling, but write the old for compatibility
# Xenial does not have an updated netplan which supports the
# correct spelling. LP: #1756701
- params = item_params['parameters']
+ params = item_params.get('parameters', {})
grat_value = params.pop('gratuitous-arp', None)
if grat_value:
params['gratuitious-arp'] = grat_value
@@ -734,8 +734,7 @@ class NetworkStateInterpreter(metaclass=CommandHandlerMeta):
'type': cmd_type,
'name': item_name,
cmd_type + '_interfaces': item_cfg.get('interfaces'),
- 'params': dict((v2key_to_v1[k], v) for k, v in
- item_params.get('parameters', {}).items())
+ 'params': dict((v2key_to_v1[k], v) for k, v in params.items())
}
if 'mtu' in item_cfg:
v1_cmd['mtu'] = item_cfg['mtu']