Merge lp:~rvb/maas/fix-none-vlan into lp:~maas-committers/maas/trunk

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 1895
Proposed branch: lp:~rvb/maas/fix-none-vlan
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 21 lines (+2/-2)
1 file modified
src/maasserver/testing/factory.py (+2/-2)
To merge this branch: bzr merge lp:~rvb/maas/fix-none-vlan
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+205119@code.launchpad.net

Commit message

A network's vlan_tag can be None. Use NO_VALUE to get a randomly assigned vlan_tag.

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

Nice detail, thanks. I was too lazy to change this, and just documented the zero thing instead...

review: Approve
Revision history for this message
Raphaël Badin (rvb) wrote :

> Nice detail, thanks. I was too lazy to change this, and just documented the
> zero thing instead...

Not really a detail, it caused the failure you can see on this MP: https://code.launchpad.net/~tycho-s/maas/fix-1272014/+merge/204429

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/testing/factory.py'
2--- src/maasserver/testing/factory.py 2014-02-06 09:27:30 +0000
3+++ src/maasserver/testing/factory.py 2014-02-06 11:03:51 +0000
4@@ -537,7 +537,7 @@
5 zone.node_set.add(*nodes)
6 return zone
7
8- def make_network(self, name=None, network=None, vlan_tag=None,
9+ def make_network(self, name=None, network=None, vlan_tag=NO_VALUE,
10 description=None):
11 """Create a `Network`.
12
13@@ -555,7 +555,7 @@
14 netmask = unicode(network.netmask)
15 if description is None:
16 description = self.getRandomString()
17- if vlan_tag is None:
18+ if vlan_tag is NO_VALUE:
19 # Caller wants it random. To avoid hiding once-in-4094 bugs when
20 # it comes out zero, skew the odds in favour of zero: fifty-fifty
21 # choice between a zero and a nonzero tag.