Fix overcloud node instrospect exception output

Currently when something fails when introspecting we get this:
(undercloud) [stack@undercloud-0 ~]$ openstack overcloud node introspect --provide 1b646cb5-39e3-4ef9-a440-9a7c4ee0c6e1
Waiting for introspection to finish...
Waiting for messages on queue 'tripleo' with no timeout.
Retrying 1 nodes that failed introspection. Attempt 1 of 3
Retrying 1 nodes that failed introspection. Attempt 2 of 3
Retrying 1 nodes that failed introspection. Attempt 3 of 3
Retry limit reached with 1 nodes still failing introspection
Exception occured while running the command
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/tripleoclient/command.py", line 30, in run
    super(Command, self).run(parsed_args)
  File "/usr/lib/python3.6/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python3.6/site-packages/cliff/command.py", line 184, in run
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_node.py", line 208, in take_action
    run_validations=parsed_args.run_validations
  File "/usr/lib/python3.6/site-packages/tripleoclient/workflows/baremetal.py", line 159, in introspect
    .join(msg for msg in payload['message'] if msg))
tripleoclient.exceptions.IntrospectionError: Introspection completed with errors:
R
e
t
r
y

l
i
m
i
t

.....

With this fix we correctly get a sane output:
(undercloud) [stack@undercloud-0 ~]$ openstack overcloud node introspect --provide 1b646cb5-39e3-4ef9-a440-9a7c4ee0c6e1
Waiting for introspection to finish...
Waiting for messages on queue 'tripleo' with no timeout.
Retrying 1 nodes that failed introspection. Attempt 1 of 3
Retrying 1 nodes that failed introspection. Attempt 2 of 3
Retrying 1 nodes that failed introspection. Attempt 3 of 3
Retry limit reached with 1 nodes still failing introspection
Exception occured while running the command
Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/tripleoclient/command.py", line 30, in run
    super(Command, self).run(parsed_args)
  File "/usr/lib/python3.6/site-packages/osc_lib/command/command.py", line 41, in run
    return super(Command, self).run(parsed_args)
  File "/usr/lib/python3.6/site-packages/cliff/command.py", line 184, in run
    return_code = self.take_action(parsed_args) or 0
  File "/usr/lib/python3.6/site-packages/tripleoclient/v1/overcloud_node.py", line 208, in take_action
    run_validations=parsed_args.run_validations
  File "/usr/lib/python3.6/site-packages/tripleoclient/workflows/baremetal.py", line 159, in introspect
    .format(payload['message']))
tripleoclient.exceptions.IntrospectionError: Introspection completed with errors: Retry limit reached with 1 nodes still failing introspection
Introspection completed with errors: Retry limit reached with 1 nodes still failing introspection

Change-Id: I0f5bd1a2eb511041e6b93eacc71c964648bdf7ef
(cherry picked from commit 42af13818a)
Closes-Bug: #1873285
This commit is contained in:
Michele Baldessari 2019-04-29 17:24:26 +02:00 committed by Takashi Kajinami
parent b8381ced84
commit a778fb84ab
1 changed files with 2 additions and 2 deletions

View File

@ -155,8 +155,8 @@ def introspect(clients, **workflow_input):
if payload['status'] != 'SUCCESS':
raise exceptions.IntrospectionError(
"Introspection completed with errors:\n%s" % '\n'
.join(msg for msg in payload['message'] if msg))
"Introspection completed with errors: {}"
.format(payload['message']))
def introspect_manageable_nodes(clients, **workflow_input):