← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~allenap/maas/dont-netboot-until-accepted into lp:maas

 

Gavin Panella has proposed merging lp:~allenap/maas/dont-netboot-until-accepted into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~allenap/maas/dont-netboot-until-accepted/+merge/101740
-- 
https://code.launchpad.net/~allenap/maas/dont-netboot-until-accepted/+merge/101740
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~allenap/maas/dont-netboot-until-accepted into lp:maas.
=== modified file 'src/maasserver/provisioning.py'
--- src/maasserver/provisioning.py	2012-04-12 09:54:29 +0000
+++ src/maasserver/provisioning.py	2012-04-12 14:15:28 +0000
@@ -429,13 +429,10 @@
     # all other statuses... with one exception; retired nodes are never
     # netbooted.
     if instance.status != NODE_STATUS.ALLOCATED:
-        deltas = {
-            instance.system_id: {
-                "netboot_enabled":
-                    instance.status != NODE_STATUS.RETIRED,
-                }
-            }
-        papi.modify_nodes(deltas)
+        netboot_enabled = instance.status not in (
+            NODE_STATUS.DECLARED, NODE_STATUS.RETIRED)
+        delta = {"netboot_enabled": netboot_enabled}
+        papi.modify_nodes({instance.system_id: delta})
 
 
 def set_node_mac_addresses(node):

=== modified file 'src/maasserver/tests/test_provisioning.py'
--- src/maasserver/tests/test_provisioning.py	2012-04-11 15:50:10 +0000
+++ src/maasserver/tests/test_provisioning.py	2012-04-12 14:15:28 +0000
@@ -512,7 +512,7 @@
         # server and MAAS ought to leave that alone. When the node is retired
         # netbooting is disabled.
         expected = {
-            NODE_STATUS.DECLARED: True,
+            NODE_STATUS.DECLARED: False,
             NODE_STATUS.COMMISSIONING: True,
             NODE_STATUS.FAILED_TESTS: True,
             NODE_STATUS.MISSING: True,