diff options
author | Dmitry Tantsur <dtantsur@protonmail.com> | 2022-07-06 17:00:11 +0200 |
---|---|---|
committer | Dmitry Tantsur <dtantsur@protonmail.com> | 2022-07-06 17:00:11 +0200 |
commit | e09919caba9766b93377d332a8e96c128d44e5ce (patch) | |
tree | 7c4833788ba245b39135fed96f7df264aa03c0ee | |
parent | eb4327ae5d36fdc09d83e1cd567715bbe557e2eb (diff) | |
download | ironic-e09919caba9766b93377d332a8e96c128d44e5ce.tar.gz |
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
-rw-r--r-- | ironic/conductor/cleaning.py | 6 | ||||
-rw-r--r-- | ironic/conductor/utils.py | 5 | ||||
-rw-r--r-- | ironic/drivers/modules/deploy_utils.py | 2 |
3 files changed, 6 insertions, 7 deletions
diff --git a/ironic/conductor/cleaning.py b/ironic/conductor/cleaning.py index cb801fc8c..e3151d4b8 100644 --- a/ironic/conductor/cleaning.py +++ b/ironic/conductor/cleaning.py @@ -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, diff --git a/ironic/conductor/utils.py b/ironic/conductor/utils.py index d3da64f0e..115c4bee1 100644 --- a/ironic/conductor/utils.py +++ b/ironic/conductor/utils.py @@ -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 diff --git a/ironic/drivers/modules/deploy_utils.py b/ironic/drivers/modules/deploy_utils.py index 89258b134..1add68cdf 100644 --- a/ironic/drivers/modules/deploy_utils.py +++ b/ironic/drivers/modules/deploy_utils.py @@ -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) |