Merge "Nicer error message when a deploy step fails"

This commit is contained in:
Zuul 2021-07-06 11:06:09 +00:00 committed by Gerrit Code Review
commit 9defccbaea
2 changed files with 6 additions and 8 deletions

View File

@ -290,10 +290,8 @@ def do_next_deploy_step(task, step_index):
{'node': node.uuid, 'step': node.deploy_step, 'err': e})
utils.deploying_error_handler(
task, log_msg,
_("Failed to deploy: Deploy step %(step)s, "
"error: %(err)s.") % {
'step': node.deploy_step,
'err': e})
_("Deploy step %(step)s failed: %(err)s.")
% {'step': conductor_steps.step_id(step), 'err': e})
return
except Exception as e:
log_msg = ('Node %(node)s failed deploy step %(step)s with '

View File

@ -365,7 +365,7 @@ def set_node_deployment_steps(task, reset_current=True, skip_missing=False):
node.save()
def _step_id(step):
def step_id(step):
"""Return the 'ID' of a deploy step.
The ID is a string, <interface>.<step>.
@ -399,7 +399,7 @@ def _validate_deploy_steps_unique(user_steps):
# Check for duplicate steps. Each interface/step combination can be
# specified at most once.
errors = []
counter = collections.Counter(_step_id(step) for step in user_steps)
counter = collections.Counter(step_id(step) for step in user_steps)
duplicates = {step_id for step_id, count in counter.items() if count > 1}
if duplicates:
err = (_('deploy steps from all deploy templates matching this '
@ -569,14 +569,14 @@ def _validate_user_steps(task, user_steps, driver_steps, step_type,
errors = []
# Convert driver steps to a dict.
driver_steps = {_step_id(s): s for s in driver_steps}
driver_steps = {step_id(s): s for s in driver_steps}
result = []
for user_step in user_steps:
# Check if this user-specified step isn't supported by the driver
try:
driver_step = driver_steps[_step_id(user_step)]
driver_step = driver_steps[step_id(user_step)]
except KeyError:
if skip_missing:
LOG.debug('%(type)s step %(step)s is not currently known for '