Avoid None value when missing data in ansible log
When missing datas in ansible log for some reasons, we need to avoid None value, and just ignore it. Change-Id: Ic6e05bf65bf01eeafd5e9222f3410a4dc5a50c9e
This commit is contained in:
committed by
Cédric Jeanneret (Tengu)
parent
ade5d57a3e
commit
1477887091
@@ -126,14 +126,16 @@ class ValidationLog(object):
|
||||
@property
|
||||
def get_duration(self):
|
||||
"""Return duration of Ansible runtime"""
|
||||
return ', '.join([play['play']['duration'].get('time_elapsed') for
|
||||
play in self.content['plays']])
|
||||
duration = [play['play']['duration'].get('time_elapsed') for
|
||||
play in self.content['plays']]
|
||||
return ', '.join(filter(None, duration))
|
||||
|
||||
@property
|
||||
def get_start_time(self):
|
||||
"""Return Ansible start time"""
|
||||
return ', '.join([play['play']['duration'].get('start') for
|
||||
play in self.content['plays']])
|
||||
start_time = [play['play']['duration'].get('start') for
|
||||
play in self.content['plays']]
|
||||
return ', '.join(filter(None, start_time))
|
||||
|
||||
|
||||
class ValidationLogs(object):
|
||||
|
||||
Reference in New Issue
Block a user