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:
parent
eb4327ae5d
commit
e09919caba
@ -49,8 +49,10 @@ def do_node_clean(task, clean_steps=None, disable_ramdisk=False):
|
|||||||
node.save()
|
node.save()
|
||||||
|
|
||||||
task.process_event('done')
|
task.process_event('done')
|
||||||
LOG.info('Automated cleaning is disabled, node %s has been '
|
how = ('API' if node.automated_clean is False else 'configuration')
|
||||||
'successfully moved to AVAILABLE state.', node.uuid)
|
LOG.info('Automated cleaning is disabled via %(how)s, node %(node)s '
|
||||||
|
'has been successfully moved to AVAILABLE state',
|
||||||
|
{'how': how, 'node': node})
|
||||||
return
|
return
|
||||||
|
|
||||||
# NOTE(dtantsur): this is only reachable during automated cleaning,
|
# NOTE(dtantsur): this is only reachable during automated cleaning,
|
||||||
|
@ -938,7 +938,7 @@ def notify_conductor_resume_deploy(task):
|
|||||||
notify_conductor_resume_operation(task, 'deploy')
|
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.
|
"""Checks if node cleaning needs to be skipped for an specific node.
|
||||||
|
|
||||||
:param node: the node to consider
|
:param node: the node to consider
|
||||||
@ -948,9 +948,6 @@ def skip_automated_cleaning(node, log=True):
|
|||||||
elif node.automated_clean is None:
|
elif node.automated_clean is None:
|
||||||
return not CONF.conductor.automated_clean
|
return not CONF.conductor.automated_clean
|
||||||
else:
|
else:
|
||||||
if log:
|
|
||||||
LOG.info("Automated cleaning is disabled via the API for "
|
|
||||||
"node %(node)s", {'node': node.uuid})
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
# 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
|
# want nodes to be stuck on deletion, require an agent when cleaning is
|
||||||
# enabled.
|
# enabled.
|
||||||
return not manager_utils.skip_automated_cleaning(node, log=False)
|
return not manager_utils.skip_automated_cleaning(node)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user