Conversation
…ical#646) Ephemeral deployments do not use deployment scripts. Resolves LP#2166890
There was a problem hiding this comment.
[maas-code-reviewer review]
LLM-generated review from https://github.com/canonical/maas-code-reviewer.
Intended to assist a human reviewer, not replace one — suggestions may be
incorrect, please verify before acting.
The change correctly fixes the issue where an ephemeral deploy would either create an unnecessary deployment script set or retain a stale one from a previously aborted standard deployment. I've left a couple of comments regarding an identical issue that likely exists with current_installation_script_set and a suggestion to make the test simulation a bit more robust.
| # ALLOCATED without clearing current_deployment_script_set. | ||
| # Clear it so an ephemeral deployment doesn't point at a stale | ||
| # script set. | ||
| self.current_deployment_script_set = None |
There was a problem hiding this comment.
It looks like current_installation_script_set suffers from the exact same issue. In _start_deployment (which is also called during start()), if self.ephemeral_deploy is True, self.current_installation_script_set is skipped but not cleared. If a standard deployment was previously aborted, the node will retain a stale current_installation_script_set during the ephemeral deploy. Consider clearing self.current_installation_script_set = None in an else branch inside _start_deployment.
| leftover_script_set = factory.make_ScriptSet( | ||
| node=node, result_type=RESULT_TYPE.DEPLOYMENT | ||
| ) | ||
| node.current_deployment_script_set = leftover_script_set |
There was a problem hiding this comment.
To properly simulate the state of a node after an aborted deployment, consider calling node.save() after setting node.current_deployment_script_set = leftover_script_set and before calling node.start(admin). Otherwise, the stale script set is only set on the in-memory object and not actually persisted to the database before the test exercises the fix (although node.start eventually calls node.save(), persisting it beforehand ensures the pre-condition perfectly mimics reality).
Ephemeral deployments do not use deployment scripts.
Resolves LP#2166890
(cherry-picked from 0c89ae1)