Back-port #36028 to 2015.8

The original PR wouldn't back-port cleanly so I made the changes
in #36028 by hand.
This commit is contained in:
rallytime 2016-09-30 16:40:56 -06:00
parent a01a68d4be
commit 4be4f900ee

View file

@ -271,7 +271,7 @@ def _format_host(host, data):
u' {tcolor} Result: {ret[result]!s}{colors[ENDC]}',
u' {tcolor} Comment: {comment}{colors[ENDC]}',
]
if __opts__.get('state_output_profile', True):
if __opts__.get('state_output_profile', True) and 'start_time' in ret:
state_lines.extend([
u' {tcolor} Started: {ret[start_time]!s}{colors[ENDC]}',
u' {tcolor}Duration: {ret[duration]!s}{colors[ENDC]}',
@ -503,14 +503,14 @@ def _format_terse(tcolor, comps, ret, colors, tabular):
result = u'Differs'
if tabular is True:
fmt_string = u'{0}'
if __opts__.get('state_output_profile', True):
if __opts__.get('state_output_profile', True) and 'start_time' in ret:
fmt_string += u'{6[start_time]!s} [{6[duration]!s} ms] '
fmt_string += u'{2:>10}.{3:<10} {4:7} Name: {1}{5}'
elif isinstance(tabular, str):
fmt_string = tabular
else:
fmt_string = u' {0} Name: {1} - Function: {2}.{3} - Result: {4}'
if __opts__.get('state_output_profile', True):
if __opts__.get('state_output_profile', True) and 'start_time' in ret:
fmt_string += u' Started: - {6[start_time]!s} Duration: {6[duration]!s} ms'
fmt_string += u'{5}'