Merge "Fix get_async_step_return_state to account for servicing"

This commit is contained in:
Zuul 2024-04-12 11:49:28 +00:00 committed by Gerrit Code Review
commit 60b263df50
1 changed files with 15 additions and 4 deletions

View File

@ -1451,13 +1451,24 @@ parse_instance_info_capabilities = (
def get_async_step_return_state(node): def get_async_step_return_state(node):
"""Returns state based on operation (cleaning/deployment) being invoked """Returns state based on operation being invoked.
:param node: an ironic node object. :param node: an ironic node object.
:returns: states.CLEANWAIT if cleaning operation in progress :returns: states.CLEANWAIT if cleaning operation in progress,
or states.DEPLOYWAIT if deploy operation in progress. or states.DEPLOYWAIT if deploy operation in progress,
or states.SERVICEWAIT if servicing in progress.
""" """
return states.CLEANWAIT if node.clean_step else states.DEPLOYWAIT # FIXME(dtantsur): this distinction is rather useless, create a new
# constant to use for all step types?
if node.clean_step:
return states.CLEANWAIT
elif node.service_step:
return states.SERVICEWAIT
else:
# TODO(dtantsur): ideally, check for node.deploy_step and raise
# something if this function is called without any step field set.
# Unfortunately, a lot of unit tests rely on exactly this.
return states.DEPLOYWAIT
def _check_agent_token_prior_to_agent_reboot(node): def _check_agent_token_prior_to_agent_reboot(node):