launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #07016
[Merge] lp:~jtv/maas/bug-974176 into lp:maas
Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/bug-974176 into lp:maas.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #974176 in MAAS: "Minimal commissioning user_data"
https://bugs.launchpad.net/maas/+bug/974176
For more details, see:
https://code.launchpad.net/~jtv/maas/bug-974176/+merge/100949
For the initial, minimal iteration of commissioning, user_data should be a simple script. As per discussion with Daviey, all it really needs to do is print “Hello world.” That will show up in the logs and so produce a record of success.
More later, at which point we can start to worry about commissioning packages, progress POSTs to the metadata service, etc.
--
https://code.launchpad.net/~jtv/maas/bug-974176/+merge/100949
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/bug-974176 into lp:maas.
=== modified file 'src/maasserver/models.py'
--- src/maasserver/models.py 2012-04-04 17:30:49 +0000
+++ src/maasserver/models.py 2012-04-05 12:23:22 +0000
@@ -40,6 +40,7 @@
import re
from socket import gethostname
from string import whitespace
+from textwrap import dedent
import time
from uuid import uuid1
@@ -462,6 +463,15 @@
ADMIN = 'admin_node'
+# For the commissioning process, a node receives a minimal script as its
+# user_data through the metadata service. This is the content of that
+# script.
+commissioning_user_data = dedent("""
+ #!/bin/sh
+ echo "Hello world"
+ """.lstrip('\n'))
+
+
class Node(CommonInfo):
"""A `Node` represents a physical machine used by the MAAS Server.
=== modified file 'src/maasserver/tests/test_models.py'
--- src/maasserver/tests/test_models.py 2012-04-04 13:42:31 +0000
+++ src/maasserver/tests/test_models.py 2012-04-05 12:23:22 +0000
@@ -31,6 +31,7 @@
NodeStateViolation,
)
from maasserver.models import (
+ commissioning_user_data,
Config,
create_auth_token,
DEFAULT_CONFIG,
@@ -276,6 +277,13 @@
power_status = get_provisioning_api_proxy().power_status
self.assertEqual('start', power_status[node.system_id])
+ def test_start_commissioning_sets_user_data(self):
+ node = factory.make_node(status=NODE_STATUS.DECLARED)
+ node.start_commissioning(factory.make_admin())
+ self.assertEqual(
+ commissioning_user_data,
+ NodeUserData.objects.get_user_data(node))
+
def test_full_clean_checks_status_transition_and_raises_if_invalid(self):
# RETIRED -> ALLOCATED is an invalid transition.
node = factory.make_node(