Merge ~chad.smith/cloud-init:network-stp-handle-0 into cloud-init:master

Proposed by Chad Smith on 2017-10-05
Status: Merged
Approved by: Scott Moser on 2017-10-05
Approved revision: 88a56ba0ae7926981ab056223e3198cafaa632fb
Merged at revision: 45d361cb0b7f5e4e7d79522bd285871898358623
Proposed branch: ~chad.smith/cloud-init:network-stp-handle-0
Merge into: cloud-init:master
Diff against target: 26 lines (+2/-2)
2 files modified
cloudinit/net/network_state.py (+1/-1)
tests/unittests/test_net.py (+1/-1)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve on 2017-10-05
Scott Moser 2017-10-05 Approve on 2017-10-05
Review via email: mp+331898@code.launchpad.net

Description of the Change

net: Handle bridge stp values of 0 and convert to boolean type

Update unit tests to pass a 0 instead of 'off' to validate that network
state is properly written.

To post a comment you must log in.
Scott Moser (smoser) wrote :

lgtm.
thanks chad.

review: Approve

PASSED: Continuous integration, rev:88a56ba0ae7926981ab056223e3198cafaa632fb
https://jenkins.ubuntu.com/server/job/cloud-init-ci/388/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    SUCCESS: MAAS Compatability Testing
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/388/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
2index 890dbf8..0e830ee 100644
3--- a/cloudinit/net/network_state.py
4+++ b/cloudinit/net/network_state.py
5@@ -468,7 +468,7 @@ class NetworkStateInterpreter(object):
6
7 # convert value to boolean
8 bridge_stp = iface.get('bridge_stp')
9- if bridge_stp and type(bridge_stp) != bool:
10+ if bridge_stp is not None and type(bridge_stp) != bool:
11 if bridge_stp in ['on', '1', 1]:
12 bridge_stp = True
13 elif bridge_stp in ['off', '0', 0]:
14diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
15index 17c9342..bbb63cb 100644
16--- a/tests/unittests/test_net.py
17+++ b/tests/unittests/test_net.py
18@@ -1283,7 +1283,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
19 - eth0
20 - eth1
21 params:
22- bridge_stp: 'off'
23+ bridge_stp: 0
24 bridge_bridgeprio: 22
25 subnets:
26 - type: static

Subscribers

People subscribed via source and target branches