summaryrefslogtreecommitdiff
path: root/ironic
diff options
context:
space:
mode:
authorJulia Kreger <juliaashleykreger@gmail.com>2022-12-07 11:56:32 -0800
committerJulia Kreger <juliaashleykreger@gmail.com>2022-12-12 07:22:21 -0800
commitaca8ebc0640cbef5eb9fa898be08dfe8d3a0f4ae (patch)
tree2bb841c45d71767474202fdda12ca5f871aafa10 /ironic
parent4d66609e95a1c7f5fb0fe0f61f95cf83d09da4d8 (diff)
downloadironic-aca8ebc0640cbef5eb9fa898be08dfe8d3a0f4ae.tar.gz
Catch any exception for Cleaning
No exception is used to communicate back, the exceptions are used to catch failures, and if we don't catch other possible exceptions leaving cleaning states, we may not clean up state properly. So instead of specific exceptions, we just catch any exception like is used earlier in the same method. Inspired by https://review.opendev.org/c/openstack/ironic/+/866856 and investigation through the code base as a result of inability to clean the node. Change-Id: I2a6bca3550819b98adbaffe315f77427b8a43d62
Diffstat (limited to 'ironic')
-rw-r--r--ironic/conductor/cleaning.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/ironic/conductor/cleaning.py b/ironic/conductor/cleaning.py
index 53d66ddd8..e59841a99 100644
--- a/ironic/conductor/cleaning.py
+++ b/ironic/conductor/cleaning.py
@@ -114,8 +114,9 @@ def do_node_clean(task, clean_steps=None, disable_ramdisk=False):
try:
conductor_steps.set_node_cleaning_steps(
task, disable_ramdisk=disable_ramdisk)
- except (exception.InvalidParameterValue,
- exception.NodeCleaningFailure) as e:
+ except Exception as e:
+ # Catch all exceptions and follow the error handling
+ # path so things are cleaned up properly.
msg = (_('Cannot clean node %(node)s: %(msg)s')
% {'node': node.uuid, 'msg': e})
return utils.cleaning_error_handler(task, msg)