Merge ~andreserl/maas:revert_00f4173 into maas:master

Proposed by Andres Rodriguez
Status: Merged
Approved by: Andres Rodriguez
Approved revision: 3ea7fbda19b5e1191e8ea7524448736d0a9c57c7
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~andreserl/maas:revert_00f4173
Merge into: maas:master
Diff against target: 145 lines (+4/-52)
6 files modified
src/maasserver/models/node.py (+0/-9)
src/maasserver/models/tests/test_node.py (+0/-23)
src/maasserver/node_action.py (+1/-2)
src/maasserver/node_status.py (+1/-3)
src/metadataserver/api.py (+2/-3)
src/metadataserver/tests/test_api.py (+0/-12)
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
MAAS Lander Approve
Review via email: mp+354857@code.launchpad.net

Commit message

Revert "Allow enlisted nodes that have successfully commissioned to be tested."

This reverts commit 00f417318822634da70081dce5146b65e2a78c48 because this causes newly enlisted machines to go to 'Ready' instead of 'New'. This is also breaking the CI.

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b revert_00f4173 lp:~andreserl/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 3ea7fbda19b5e1191e8ea7524448736d0a9c57c7

review: Approve
Revision history for this message
Andres Rodriguez (andreserl) wrote :

selfie as this is reverting a branch that changing behavior in non-compatible way and causing CI faillures.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/models/node.py b/src/maasserver/models/node.py
2index d3b74c5..b09d0dc 100644
3--- a/src/maasserver/models/node.py
4+++ b/src/maasserver/models/node.py
5@@ -2039,15 +2039,6 @@ class Node(CleanSave, TimestampedModel):
6 "Unconfigured power type. "
7 "Please configure the power type and try again.")
8
9- # If this is an enlisted node make sure commissioning during enlistment
10- # finished successfully.
11- if (self.status == NODE_STATUS.NEW and
12- not self.current_commissioning_script_set):
13- raise ValidationError(
14- "Unable to start machine testing; this node has never been "
15- "commissioned. Please use the 'Commission' action to "
16- "commission & test this machine.")
17-
18 # Create a new ScriptSet for the tests to be run.
19 script_set = ScriptSet.objects.create_testing_script_set(
20 self, testing_scripts)
21diff --git a/src/maasserver/models/tests/test_node.py b/src/maasserver/models/tests/test_node.py
22index 2538393..7b7c5b7 100644
23--- a/src/maasserver/models/tests/test_node.py
24+++ b/src/maasserver/models/tests/test_node.py
25@@ -3170,12 +3170,6 @@ class TestNode(MAASServerTestCase):
26 self.assertRaises(
27 UnknownPowerType, node.start_testing, admin)
28
29- def test_start_testing_errors_for_new_node_no_commissioning(self):
30- node = factory.make_Node(interface=True, status=NODE_STATUS.NEW)
31- admin = factory.make_admin()
32- self.assertRaises(
33- ValidationError, node.start_testing, admin)
34-
35 def test_start_testing_logs_user_request(self):
36 script = factory.make_Script(script_type=SCRIPT_TYPE.TESTING)
37 node = factory.make_Node(
38@@ -3203,23 +3197,6 @@ class TestNode(MAASServerTestCase):
39 self.assertEquals(NODE_STATUS.TESTING, node.status)
40 self.assertThat(mock_node_power_cycle, MockCalledOnce())
41
42- def test_start_testing_changes_status_and_starts_new_node(self):
43- script = factory.make_Script(script_type=SCRIPT_TYPE.TESTING)
44- node = factory.make_Node(
45- interface=True, status=NODE_STATUS.NEW, power_type='manual')
46- node.current_commissioning_script_set = factory.make_ScriptSet(
47- node=node, result_type=RESULT_TYPE.COMMISSIONING)
48- factory.make_ScriptResult(
49- script_set=node.current_commissioning_script_set)
50- mock_node_power_cycle = self.patch(node, '_power_cycle')
51- mock_node_power_cycle.return_value = None
52- admin = factory.make_admin()
53- node.start_testing(admin, testing_scripts=[script.name])
54- post_commit_hooks.reset() # Ignore these for now.
55- node = reload_object(node)
56- self.assertEquals(NODE_STATUS.TESTING, node.status)
57- self.assertThat(mock_node_power_cycle, MockCalledOnce())
58-
59 def test_start_testing_sets_options(self):
60 script = factory.make_Script(script_type=SCRIPT_TYPE.TESTING)
61 rack = factory.make_RackController()
62diff --git a/src/maasserver/node_action.py b/src/maasserver/node_action.py
63index 4ad435e..a457e55 100644
64--- a/src/maasserver/node_action.py
65+++ b/src/maasserver/node_action.py
66@@ -1,4 +1,4 @@
67-# Copyright 2012-2018 Canonical Ltd. This software is licensed under the
68+# Copyright 2012-2016 Canonical Ltd. This software is licensed under the
69 # GNU Affero General Public License version 3 (see the file LICENSE).
70
71 """Node actions.
72@@ -283,7 +283,6 @@ class Test(NodeAction):
73 display_sentence = "tested"
74 actionable_statuses = (
75 NODE_STATUS.FAILED_COMMISSIONING,
76- NODE_STATUS.NEW,
77 NODE_STATUS.READY,
78 NODE_STATUS.RESERVED,
79 NODE_STATUS.ALLOCATED,
80diff --git a/src/maasserver/node_status.py b/src/maasserver/node_status.py
81index c43c4a9..e8e5123 100644
82--- a/src/maasserver/node_status.py
83+++ b/src/maasserver/node_status.py
84@@ -1,4 +1,4 @@
85-# Copyright 2014-2018 Canonical Ltd. This software is licensed under the
86+# Copyright 2014-2017 Canonical Ltd. This software is licensed under the
87 # GNU Affero General Public License version 3 (see the file LICENSE).
88
89 """Node status utilities."""
90@@ -18,7 +18,6 @@ from provisioningserver.utils.enum import map_enum
91 # This is a subset of the statuses NODE_STATUS.TESTING can transition to. This
92 # allows testing to be aborted.
93 NODE_TESTING_RESET_READY_TRANSITIONS = {
94- NODE_STATUS.NEW,
95 NODE_STATUS.COMMISSIONING,
96 NODE_STATUS.FAILED_DEPLOYMENT,
97 NODE_STATUS.MISSING,
98@@ -53,7 +52,6 @@ NODE_TRANSITIONS = {
99 ],
100 NODE_STATUS.NEW: [
101 NODE_STATUS.COMMISSIONING,
102- NODE_STATUS.TESTING,
103 NODE_STATUS.MISSING,
104 NODE_STATUS.READY,
105 NODE_STATUS.RETIRED,
106diff --git a/src/metadataserver/api.py b/src/metadataserver/api.py
107index 3f575c3..66bc1d1 100644
108--- a/src/metadataserver/api.py
109+++ b/src/metadataserver/api.py
110@@ -604,10 +604,9 @@ class VersionIndexHandler(MetadataViewHandler):
111 }
112 target_status = signaling_statuses.get(status)
113 enlisting = NodeMetadata.objects.get(node=node, key='enlisting')
114- if enlisting is not None and status != SIGNAL_STATUS.TESTING:
115+ if enlisting is not None and status == SIGNAL_STATUS.OK:
116 enlisting.delete()
117- if status == SIGNAL_STATUS.OK:
118- target_status = NODE_STATUS.NEW
119+ target_status = NODE_STATUS.NEW
120
121 if target_status in [
122 NODE_STATUS.NEW, NODE_STATUS.READY, NODE_STATUS.TESTING]:
123diff --git a/src/metadataserver/tests/test_api.py b/src/metadataserver/tests/test_api.py
124index 3470d10..5ce5990 100644
125--- a/src/metadataserver/tests/test_api.py
126+++ b/src/metadataserver/tests/test_api.py
127@@ -1763,18 +1763,6 @@ class TestCommissioningAPI(MAASServerTestCase):
128 self.assertEqual(http.client.OK, response.status_code)
129 self.assertEqual(NODE_STATUS.READY, reload_object(node).status)
130
131- def test_signaling_commissioning_failure_deletes_enlisting(self):
132- node = factory.make_Node(
133- status=NODE_STATUS.COMMISSIONING, with_empty_script_sets=True)
134- nmd = NodeMetadata.objects.create(
135- node=node, key='enlisting', value='True')
136- client = make_node_client(node=node)
137- response = call_signal(client, status=SIGNAL_STATUS.FAILED)
138- self.assertEqual(http.client.OK, response.status_code)
139- self.assertEqual(
140- NODE_STATUS.FAILED_COMMISSIONING, reload_object(node).status)
141- self.assertIsNone(reload_object(nmd))
142-
143 def test_signaling_commissioning_failure_makes_node_failed_tests(self):
144 node = factory.make_Node(
145 status=NODE_STATUS.COMMISSIONING, with_empty_script_sets=True)

Subscribers

People subscribed via source and target branches