summaryrefslogtreecommitdiff
path: root/ironic/drivers/modules/agent.py
diff options
context:
space:
mode:
Diffstat (limited to 'ironic/drivers/modules/agent.py')
-rw-r--r--ironic/drivers/modules/agent.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/ironic/drivers/modules/agent.py b/ironic/drivers/modules/agent.py
index 9e1a067a0..9c6f69368 100644
--- a/ironic/drivers/modules/agent.py
+++ b/ironic/drivers/modules/agent.py
@@ -184,17 +184,13 @@ class AgentDeployMixin(agent_base_vendor.AgentDeployMixin):
if not commands:
return False
- last_command = commands[-1]
-
- if last_command['command_name'] != 'prepare_image':
- # catches race condition where prepare_image is still processing
- # so deploy hasn't started yet
+ try:
+ last_command = next(cmd for cmd in reversed(commands)
+ if cmd['command_name'] == 'prepare_image')
+ except StopIteration:
return False
-
- if last_command['command_status'] != 'RUNNING':
- return True
-
- return False
+ else:
+ return last_command['command_status'] != 'RUNNING'
@METRICS.timer('AgentDeployMixin.continue_deploy')
@task_manager.require_exclusive_lock
@@ -462,6 +458,7 @@ class AgentDeploy(AgentDeployMixin, base.DeployInterface):
# the state machine state going from DEPLOYWAIT -> DEPLOYING
task.process_event('wait')
self.continue_deploy(task)
+ return states.DEPLOYWAIT
elif task.driver.storage.should_write_image(task):
# Check if the driver has already performed a reboot in a previous
# deploy step.