launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07294
[Merge] lp:~jtv/maas/trunk-988661 into lp:maas
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/trunk-988661 into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #988661 in MAAS: "“Start node” should not be offered on Allocated nodes"
https://bugs.launchpad.net/maas/+bug/988661
For more details, see:
https://code.launchpad.net/~jtv/maas/trunk-988661/+merge/103596
According to Francis, the Start Node action should not be offered for Allocated nodes.
This branch implements that change in trunk; because of the more awkward conflicts from the views splitup, I'm doing the 1.0 backport as a separate branch.
Naturally I'll implement any review changes in both branches.
Jeroen
--
https://code.launchpad.net/~jtv/maas/trunk-988661/+merge/103596
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/trunk-988661 into lp:maas.
=== modified file 'src/maasserver/forms.py'
--- src/maasserver/forms.py 2012-04-25 07:07:42 +0000
+++ src/maasserver/forms.py 2012-04-26 03:30:24 +0000
@@ -232,18 +232,13 @@
return node
-def start_node(node, user, request=None):
- """Start a node from the UI. It will have no meta_data."""
- Node.objects.start_nodes([node.system_id], user)
-
-
def acquire_and_start_node(node, user, request=None):
- """Acquire and start a node from the UI. It will have no meta_data."""
+ """Acquire and start a node from the UI. It will have no user_data."""
# Avoid circular imports.
from maasserver.api import get_oauth_token
node.acquire(get_oauth_token(request))
- start_node(node=node, user=user, request=request)
+ Node.objects.start_nodes([node.system_id], user)
def start_commissioning_node(node, user, request=None):
@@ -308,14 +303,6 @@
"It has been asked to start up."),
},
],
- NODE_STATUS.ALLOCATED: [
- {
- 'display': "Start node",
- 'permission': NODE_PERMISSION.EDIT,
- 'execute': start_node,
- 'message': "The node has been asked to start up.",
- },
- ],
}
=== modified file 'src/maasserver/tests/test_forms.py'
--- src/maasserver/tests/test_forms.py 2012-04-25 02:23:38 +0000
+++ src/maasserver/tests/test_forms.py 2012-04-26 03:30:24 +0000
@@ -355,16 +355,6 @@
self.assertEqual(NODE_STATUS.ALLOCATED, node.status)
self.assertEqual(user, node.owner)
- def test_start_action_starts_allocated_node_for_owner(self):
- node = factory.make_node(
- status=NODE_STATUS.ALLOCATED, owner=factory.make_user())
- form = get_action_form(node.owner)(
- node, {NodeActionForm.input_name: "Start node"})
- form.save()
-
- power_status = get_provisioning_api_proxy().power_status
- self.assertEqual('start', power_status.get(node.system_id))
-
def test_accept_and_commission_starts_commissioning(self):
admin = factory.make_admin()
node = factory.make_node(status=NODE_STATUS.DECLARED)
=== modified file 'src/maasserver/tests/test_views_nodes.py'
--- src/maasserver/tests/test_views_nodes.py 2012-04-25 13:03:13 +0000
+++ src/maasserver/tests/test_views_nodes.py 2012-04-26 03:30:24 +0000
@@ -307,7 +307,7 @@
"Node commissioning started.",
[message.message for message in response.context['messages']])
- def test_start_node_from_ready_displays_message(self):
+ def test_start_node_displays_message(self):
profile = self.logged_in_user.get_profile()
consumer, token = profile.create_authorisation_token()
self.patch(maasserver.api, 'get_oauth_token', lambda request: token)
@@ -318,14 +318,6 @@
self.assertIn("This node is now allocated to you.", notices)
self.assertIn("asked to start up.", notices)
- def test_start_node_from_allocated_displays_message(self):
- node = factory.make_node(
- status=NODE_STATUS.ALLOCATED, owner=self.logged_in_user)
- response = self.perform_action_and_get_node_page(node, "Start node")
- self.assertEqual(
- ["The node has been asked to start up."],
- [message.message for message in response.context['messages']])
-
def test_start_node_without_auth_returns_Unauthorized(self):
node = factory.make_node(status=NODE_STATUS.READY)
response = self.client.post(
Follow ups