← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~julian-edwards/maas/set-power-type into lp:maas

 

Julian Edwards has proposed merging lp:~julian-edwards/maas/set-power-type into lp:maas.

Commit message:
Ensure that power_type is stored in the metadata's signal() api call.  Previously it was not being stored at all which made the supplied power_parameters useless.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~julian-edwards/maas/set-power-type/+merge/127916
-- 
https://code.launchpad.net/~julian-edwards/maas/set-power-type/+merge/127916
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~julian-edwards/maas/set-power-type into lp:maas.
=== modified file 'src/metadataserver/api.py'
--- src/metadataserver/api.py	2012-10-01 18:00:00 +0000
+++ src/metadataserver/api.py	2012-10-04 00:45:24 +0000
@@ -202,6 +202,7 @@
         type_dict = map_enum(POWER_TYPE)
         if type.upper() not in type_dict:
             raise MAASAPIBadRequest("Bad power_type '%s'" % type)
+        node.power_type = type_dict[type.upper()]
 
         try:
             node.power_parameters = json.loads(params)

=== modified file 'src/metadataserver/tests/test_api.py'
--- src/metadataserver/tests/test_api.py	2012-10-01 05:23:17 +0000
+++ src/metadataserver/tests/test_api.py	2012-10-04 00:45:24 +0000
@@ -47,6 +47,7 @@
     NodeUserData,
     )
 from metadataserver.nodeinituser import get_node_init_user
+from provisioningserver.enum import POWER_TYPE
 
 
 class TestHelpers(DjangoTestCase):
@@ -525,6 +526,8 @@
         self.assertEqual(httplib.OK, response.status_code, response.content)
         node = reload_object(node)
         self.assertEqual(
+            POWER_TYPE.IPMI, node.power_type)
+        self.assertEqual(
             params, node.power_parameters)
 
     def test_signal_power_type_lower_case_works(self):