~rakhmerov/python-mistralclient/master

« back to all changes in this revision

Viewing changes to mistralclient/commands/v2/executions.py

  • Committer: Renat Akhmerov
  • Date: 2019-02-28 06:33:15 UTC
  • Revision ID: git-v1:ba420d52e6c7dd9a631dcfa3ba62b6f1721dbf6a
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

Show diffs side-by-side

added added

removed removed

Lines of Context:
390
390
 
391
391
        if t_ex['state'] == 'ERROR':
392
392
            state_info = t_ex['state_info']
393
 
            state_info = state_info[0:200] + '...'
394
 
 
395
 
            self.print_line('(error info: %s)' % state_info, level)
 
393
 
 
394
            if state_info:
 
395
                state_info = state_info[0:100].replace('\n', ' ') + '...'
 
396
 
 
397
                self.print_line('(error info: %s)' % state_info, level)
396
398
 
397
399
        if 'action_executions' in t_ex:
398
400
            for a_ex in t_ex['action_executions']:
409
411
            level
410
412
        )
411
413
 
 
414
        if a_ex['state'] == 'ERROR':
 
415
            state_info = a_ex['state_info']
 
416
 
 
417
            if state_info:
 
418
                state_info = state_info[0:100] + '...'
 
419
 
 
420
                self.print_line('(error info: %s)' % state_info, level)
 
421
 
412
422
    def print_statistics(self, stat):
413
423
        self.print_line(
414
424
            'Number of tasks in SUCCESS state: %s' %