Merge lp:~ltrager/maas/lp1580285 into lp:maas/trunk

Proposed by Lee Trager on 2016-05-11
Status: Merged
Approved by: Lee Trager on 2016-05-11
Approved revision: 5012
Merged at revision: 5012
Proposed branch: lp:~ltrager/maas/lp1580285
Merge into: lp:maas/trunk
Diff against target: 44 lines (+5/-8)
3 files modified
src/maasserver/models/node.py (+2/-3)
src/maasserver/models/tests/test_node.py (+1/-5)
src/metadataserver/api.py (+2/-0)
To merge this branch: bzr merge lp:~ltrager/maas/lp1580285
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) 2016-05-11 Approve on 2016-05-11
Review via email: mp+294317@code.launchpad.net

Commit message

Only prevent resetting the network layout when a node is deployed or deploying

To post a comment you must log in.
Andres Rodriguez (andreserl) wrote :

lgtm! However, have you able to figure out why the error is not raised?

review: Approve
lp:~ltrager/maas/lp1580285 updated on 2016-05-11
5012. By Lee Trager on 2016-05-11

Add comment about exceptions not being raised

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-05-09 22:16:18 +0000
3+++ src/maasserver/models/node.py 2016-05-11 01:51:18 +0000
4@@ -2424,9 +2424,8 @@
5 # No interfaces on the node. Nothing to do.
6 return
7
8- if self.node_type == NODE_TYPE.MACHINE and self.status not in [
9- NODE_STATUS.NEW, NODE_STATUS.READY, NODE_STATUS.ALLOCATED,
10- NODE_STATUS.FAILED_DEPLOYMENT]:
11+ if self.node_type == NODE_TYPE.MACHINE and self.status in [
12+ NODE_STATUS.DEPLOYING, NODE_STATUS.DEPLOYED]:
13 raise ValidationError(
14 "Machine must be in a new, ready, allocated, or failed "
15 "deployment state to be reset.")
16
17=== modified file 'src/maasserver/models/tests/test_node.py'
18--- src/maasserver/models/tests/test_node.py 2016-05-10 23:06:44 +0000
19+++ src/maasserver/models/tests/test_node.py 2016-05-11 01:51:18 +0000
20@@ -3650,11 +3650,7 @@
21
22 def test_set_initial_net_config_rasies_validation_error_wrong_status(self):
23 machine = factory.make_Machine_with_Interface_on_Subnet(
24- status=factory.pick_choice(
25- NODE_STATUS_CHOICES,
26- but_not=[
27- NODE_STATUS.NEW, NODE_STATUS.READY, NODE_STATUS.ALLOCATED,
28- NODE_STATUS.FAILED_DEPLOYMENT])
29+ status=random.choice([NODE_STATUS.DEPLOYING, NODE_STATUS.DEPLOYED])
30 )
31 self.assertRaises(
32 ValidationError, machine.set_initial_networking_configuration)
33
34=== modified file 'src/metadataserver/api.py'
35--- src/metadataserver/api.py 2016-05-06 07:37:10 +0000
36+++ src/metadataserver/api.py 2016-05-11 01:51:18 +0000
37@@ -501,6 +501,8 @@
38 # Commissioning was successful setup the default storage layout
39 # and the initial networking configuration for the node.
40 if status == SIGNAL_STATUS.OK:
41+ # XXX 2016-05-10 ltrager, LP:1580405 - Exceptions raised
42+ # here are not logged or shown to the user.
43 node.set_default_storage_layout()
44 node.set_initial_networking_configuration()
45