← Back to team overview

sts-sponsors team mailing list archive

[Merge] ~emdw/maas:fix-1835153-ephemeral-deploy into maas:master

 

Eline Maaike De Weerd has proposed merging ~emdw/maas:fix-1835153-ephemeral-deploy into maas:master.

Commit message:
Changed deploying logic such that script_set does not get created for ephemeral deployments



Requested reviews:
  MAAS Lander (maas-lander): unittests
  MAAS Maintainers (maas-maintainers)
Related bugs:
  Bug #1835153 in MAAS: "Ephemeral deployment creates pending ScriptResult"
  https://bugs.launchpad.net/maas/+bug/1835153

For more details, see:
https://code.launchpad.net/~emdw/maas/+git/maas/+merge/443685
-- 
Your team MAAS Committers is subscribed to branch maas:master.
diff --git a/src/maasserver/models/node.py b/src/maasserver/models/node.py
index d1f3165..39c9523 100644
--- a/src/maasserver/models/node.py
+++ b/src/maasserver/models/node.py
@@ -1771,8 +1771,9 @@ class Node(CleanSave, TimestampedModel):
         # and will already be in a DEPLOYED state.
         if self.status == NODE_STATUS.ALLOCATED:
             self.update_status(NODE_STATUS.DEPLOYING)
-        script_set = ScriptSet.objects.create_installation_script_set(self)
-        self.current_installation_script_set = script_set
+        if self.ephemeral_deployment is False:
+            script_set = ScriptSet.objects.create_installation_script_set(self)
+            self.current_installation_script_set = script_set
         self.save()
 
         # Create a status message for DEPLOYING.
diff --git a/src/maasserver/models/tests/test_node.py b/src/maasserver/models/tests/test_node.py
index 52ee395..7a3c718 100644
--- a/src/maasserver/models/tests/test_node.py
+++ b/src/maasserver/models/tests/test_node.py
@@ -1078,6 +1078,20 @@ class TestNode(MAASServerTestCase):
         )
         self.assertFalse(node.ephemeral_deployment)
 
+    def test_ephemeral_deploy_scriptstatus_no(self):
+        node = factory.make_Node_with_Interface_on_Subnet(
+            ephemeral_deploy=True, status=NODE_STATUS.ALLOCATED
+        )
+        node._start_deployment()
+        self.assertTrue(node.current_installation_script_set is None)
+
+    def test_ephemeral_deploy_no_scriptstatus_yes(self):
+        node = factory.make_Node_with_Interface_on_Subnet(
+            ephemeral_deploy=False, status=NODE_STATUS.ALLOCATED
+        )
+        node._start_deployment()
+        self.assertTrue(node.current_installation_script_set is not None)
+
     def test_system_id_is_a_valid_znum(self):
         node = factory.make_Node()
         self.assertThat(