Merge lp:~julian-edwards/maas/1.5-clear-distroseries-bug-1316396 into lp:maas/1.5

Proposed by Julian Edwards
Status: Merged
Approved by: Julian Edwards
Approved revision: no longer in the source branch.
Merged at revision: 2265
Proposed branch: lp:~julian-edwards/maas/1.5-clear-distroseries-bug-1316396
Merge into: lp:maas/1.5
Diff against target: 41 lines (+8/-1)
3 files modified
src/maasserver/api.py (+0/-1)
src/maasserver/models/node.py (+1/-0)
src/maasserver/models/tests/test_node.py (+7/-0)
To merge this branch: bzr merge lp:~julian-edwards/maas/1.5-clear-distroseries-bug-1316396
Reviewer Review Type Date Requested Status
Julian Edwards (community) Approve
Review via email: mp+218542@code.launchpad.net

Commit message

backport trunk r2304: Ensure Node.distro_series is always cleared when releasing the node. Previously, starting in the API and stopping with the web UI caused it to remain which meant that subsequent startups from the web UI failed to honour the default series

To post a comment you must log in.
Revision history for this message
Julian Edwards (julian-edwards) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/api.py'
2--- src/maasserver/api.py 2014-05-06 21:18:17 +0000
3+++ src/maasserver/api.py 2014-05-07 02:54:51 +0000
4@@ -427,7 +427,6 @@
5 """Release a node. Opposite of `NodesHandler.acquire`."""
6 node = Node.objects.get_node_or_404(
7 system_id=system_id, user=request.user, perm=NODE_PERMISSION.EDIT)
8- node.set_distro_series(series='')
9 if node.status == NODE_STATUS.READY:
10 # Nothing to do. This may be a redundant retry, and the
11 # postcondition is achieved, so call this success.
12
13=== modified file 'src/maasserver/models/node.py'
14--- src/maasserver/models/node.py 2014-04-23 03:44:40 +0000
15+++ src/maasserver/models/node.py 2014-05-07 02:54:51 +0000
16@@ -797,6 +797,7 @@
17 self.token = None
18 self.agent_name = ''
19 self.set_netboot()
20+ self.distro_series = ''
21 self.save()
22
23 def set_netboot(self, on=True):
24
25=== modified file 'src/maasserver/models/tests/test_node.py'
26--- src/maasserver/models/tests/test_node.py 2014-04-23 03:44:40 +0000
27+++ src/maasserver/models/tests/test_node.py 2014-05-07 02:54:51 +0000
28@@ -471,6 +471,13 @@
29 node.release()
30 self.assertTrue(node.netboot)
31
32+ def test_release_clears_distro_series(self):
33+ node = factory.make_node(
34+ status=NODE_STATUS.ALLOCATED, owner=factory.make_user())
35+ node.set_distro_series(series=DISTRO_SERIES.quantal)
36+ node.release()
37+ self.assertEqual("", node.distro_series)
38+
39 def test_release_powers_off_node(self):
40 # Test that releasing a node causes a 'power_off' celery job.
41 node = factory.make_node(

Subscribers

People subscribed via source and target branches

to all changes: