Merge lp:~newell-jensen/maas/2.0-fix-1632815 into lp:maas/2.0

Proposed by Newell Jensen on 2016-10-12
Status: Merged
Approved by: Newell Jensen on 2016-10-12
Approved revision: 5198
Merged at revision: 5198
Proposed branch: lp:~newell-jensen/maas/2.0-fix-1632815
Merge into: lp:maas/2.0
Diff against target: 33 lines (+5/-6)
2 files modified
src/maasserver/models/node.py (+5/-3)
src/maasserver/models/tests/test_node.py (+0/-3)
To merge this branch: bzr merge lp:~newell-jensen/maas/2.0-fix-1632815
Reviewer Review Type Date Requested Status
Newell Jensen Approve on 2016-10-12
Review via email: mp+308316@code.launchpad.net

Commit message

Backport trunk r5475: During release, check if return deferred from _stop is None, as _stop will return None for 'manual' power type.

To post a comment you must log in.
Newell Jensen (newell-jensen) wrote :

Self approved backport.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/maasserver/models/node.py'
2--- src/maasserver/models/node.py 2016-10-05 19:01:28 +0000
3+++ src/maasserver/models/node.py 2016-10-12 22:33:25 +0000
4@@ -2192,9 +2192,11 @@
5 # Deferred it returns for the asynchronous (post-commit) bits.
6 stopping = self._stop(self.owner)
7 # If there's an error, reset the node's status.
8- stopping.addErrback(
9- callOutToDatabase, Node._set_status, self.system_id,
10- status=self.status)
11+ # Check for None (_stop returns None for manual power type).
12+ if stopping is not None:
13+ stopping.addErrback(
14+ callOutToDatabase, Node._set_status, self.system_id,
15+ status=self.status)
16 except Exception as ex:
17 maaslog.error(
18 "%s: Unable to shut node down: %s", self.hostname,
19
20=== modified file 'src/maasserver/models/tests/test_node.py'
21--- src/maasserver/models/tests/test_node.py 2016-10-05 19:01:28 +0000
22+++ src/maasserver/models/tests/test_node.py 2016-10-12 22:33:25 +0000
23@@ -1479,10 +1479,7 @@
24 }
25 uncontrolled_power_types = (
26 all_power_types.difference(QUERY_POWER_TYPES))
27- # manual cannot be stopped, so discard this option.
28- uncontrolled_power_types.discard("manual")
29 power_type = random.choice(list(uncontrolled_power_types))
30- self.assertNotEqual("manual", power_type)
31 rack = factory.make_RackController()
32 node = factory.make_Node_with_Interface_on_Subnet(
33 status=NODE_STATUS.ALLOCATED, owner=owner, owner_data=owner_data,

Subscribers

People subscribed via source and target branches

to all changes: