diff options
author | Ryan Harper <ryan.harper@canonical.com> | 2017-10-03 18:56:52 -0500 |
---|---|---|
committer | Scott Moser <smoser@brickies.net> | 2017-10-05 12:39:24 -0400 |
commit | 57e2e01c703cdd1818d4f4ab8a67f37037d78582 (patch) | |
tree | 08a6404a8effbb84c6a16b18f249442aeadde743 /cloudinit/net/netplan.py | |
parent | aa024e331f8196855fa8d707a2dd7e26e1deab40 (diff) | |
download | vyos-cloud-init-57e2e01c703cdd1818d4f4ab8a67f37037d78582.tar.gz vyos-cloud-init-57e2e01c703cdd1818d4f4ab8a67f37037d78582.zip |
network: bridge_stp value not always correct
Update network_state to store the bridge_stp value as a boolean.
The various renderers then can map the boolean value to the correct
output as needed; eni uses 'on/off', sysconfig uses 'yes/no' and
netplan will use the boolean directly.
Update unittest values for sysconfig and netplan. Both contained the
network_state string value which resulted in not correctly enable/disable
STP in the target system.
Update network_state comment (fd -> forward-delay, add stp as boolean) on
bridge commands to match the expected format of a netplan bridge command.
LP: #1721157
Diffstat (limited to 'cloudinit/net/netplan.py')
-rw-r--r-- | cloudinit/net/netplan.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/cloudinit/net/netplan.py b/cloudinit/net/netplan.py index 3b06fbf0..d3788af8 100644 --- a/cloudinit/net/netplan.py +++ b/cloudinit/net/netplan.py @@ -244,9 +244,9 @@ class Renderer(renderer.Renderer): for config in network_state.iter_interfaces(): ifname = config.get('name') - # filter None entries up front so we can do simple if key in dict + # filter None (but not False) entries up front ifcfg = dict((key, value) for (key, value) in config.items() - if value) + if value is not None) if_type = ifcfg.get('type') if if_type == 'physical': @@ -318,6 +318,7 @@ class Renderer(renderer.Renderer): (port, cost) = costval.split() newvalue[port] = int(cost) br_config.update({newname: newvalue}) + if len(br_config) > 0: bridge.update({'parameters': br_config}) _extract_addresses(ifcfg, bridge) |