Fix execution report printing

* Shortened a task error string because sometimes it breaks the layout
* Handled a case when a task/action is in error state but doesn't
  have a state info

Change-Id: I2903806200c8430b497ceb01568f7aa2c55c4e3e
This commit is contained in:
Renat Akhmerov 2019-02-28 13:30:34 +07:00
parent ec961cdf95
commit ba420d52e6
1 changed files with 12 additions and 2 deletions

View File

@ -390,9 +390,11 @@ class GetReport(command.Command):
if t_ex['state'] == 'ERROR':
state_info = t_ex['state_info']
state_info = state_info[0:200] + '...'
self.print_line('(error info: %s)' % state_info, level)
if state_info:
state_info = state_info[0:100].replace('\n', ' ') + '...'
self.print_line('(error info: %s)' % state_info, level)
if 'action_executions' in t_ex:
for a_ex in t_ex['action_executions']:
@ -409,6 +411,14 @@ class GetReport(command.Command):
level
)
if a_ex['state'] == 'ERROR':
state_info = a_ex['state_info']
if state_info:
state_info = state_info[0:100] + '...'
self.print_line('(error info: %s)' % state_info, level)
def print_statistics(self, stat):
self.print_line(
'Number of tasks in SUCCESS state: %s' %