Move logging out of skip_automated_cleaning

Simply boolean functions should not have logging as a side effect.
This one is also used in deploy_utils without logging.

Change-Id: Iaa398f09cec06a8417c595acac19b0b9f3f3a871
This commit is contained in:
Dmitry Tantsur 2022-07-06 17:00:11 +02:00
parent eb4327ae5d
commit e09919caba
3 changed files with 6 additions and 7 deletions

View File

@ -49,8 +49,10 @@ def do_node_clean(task, clean_steps=None, disable_ramdisk=False):
node.save()
task.process_event('done')
LOG.info('Automated cleaning is disabled, node %s has been '
'successfully moved to AVAILABLE state.', node.uuid)
how = ('API' if node.automated_clean is False else 'configuration')
LOG.info('Automated cleaning is disabled via %(how)s, node %(node)s '
'has been successfully moved to AVAILABLE state',
{'how': how, 'node': node})
return
# NOTE(dtantsur): this is only reachable during automated cleaning,

View File

@ -938,7 +938,7 @@ def notify_conductor_resume_deploy(task):
notify_conductor_resume_operation(task, 'deploy')
def skip_automated_cleaning(node, log=True):
def skip_automated_cleaning(node):
"""Checks if node cleaning needs to be skipped for an specific node.
:param node: the node to consider
@ -948,9 +948,6 @@ def skip_automated_cleaning(node, log=True):
elif node.automated_clean is None:
return not CONF.conductor.automated_clean
else:
if log:
LOG.info("Automated cleaning is disabled via the API for "
"node %(node)s", {'node': node.uuid})
return True

View File

@ -1465,4 +1465,4 @@ def needs_agent_ramdisk(node, mode='deploy'):
# Ramdisk deploys don't need an agent, but cleaning will. Since we don't
# want nodes to be stuck on deletion, require an agent when cleaning is
# enabled.
return not manager_utils.skip_automated_cleaning(node, log=False)
return not manager_utils.skip_automated_cleaning(node)