Add spacer line after loops

In order to do this we need to make sure to register loop results. We
also need to register them when things are skipped. And, if the loop
items have been skipped, there will be no status in the deferred result,
so we should not print an All Items Complete message.

Change-Id: I620318df7bb13a8f3d325b0a01296586aca55f1f
This commit is contained in:
Monty Taylor 2017-07-21 09:39:13 +09:00
parent 74e682fa8a
commit ffb13e4651
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
1 changed files with 17 additions and 12 deletions

View File

@ -285,10 +285,14 @@ class CallbackModule(default.CallbackModule):
self._log("")
def v2_runner_on_skipped(self, result):
reason = result._result.get('skip_reason')
if reason:
# No reason means it's an item, which we'll log differently
self._log_message(result, status='skipping', msg=reason)
if result._task.loop:
self._items_done = False
self._deferred_result = dict(result._result)
else:
reason = result._result.get('skip_reason')
if reason:
# No reason means it's an item, which we'll log differently
self._log_message(result, status='skipping', msg=reason)
def v2_runner_item_on_skipped(self, result):
reason = result._result.get('skip_reason')
@ -297,14 +301,14 @@ class CallbackModule(default.CallbackModule):
else:
self._log_message(result, status='skipping')
if self._deferred_result:
self._process_deferred(result)
def v2_runner_on_ok(self, result):
if (self._play.strategy == 'free'
and self._last_task_banner != result._task._uuid):
self._print_task_banner(result._task)
if result._task.action in ('include', 'include_role', 'setup'):
return
result_dict = dict(result._result)
self._clean_results(result_dict, result._task.action)
@ -388,8 +392,6 @@ class CallbackModule(default.CallbackModule):
if self._deferred_result:
self._process_deferred(result)
# Log an extra blank line to get space after each task
self._log("")
def v2_runner_item_on_failed(self, result):
result_dict = dict(result._result)
@ -434,10 +436,13 @@ class CallbackModule(default.CallbackModule):
self._items_done = True
result_dict = self._deferred_result
self._deferred_result = None
status = result_dict.get('status')
self._log_message(
result, "All items complete",
status=result_dict['status'])
if status:
self._log_message(result, "All items complete", status=status)
# Log an extra blank line to get space after each task
self._log("")
def _print_task_banner(self, task):