Fix error when display_ok_hosts is false

If display_ok_hosts is false, we were returning None but the function is
expected to return a tuple. So let's return a tuple of (None, None) and
check if we don't have a line then return.

Change-Id: Iaf2f83a8f13bcb9cf0c37acff627a456005057de
(cherry picked from commit 3ff730bc6f)
This commit is contained in:
Alex Schultz 2020-06-09 08:28:18 -06:00 committed by Emilien Macchi
parent 5bfb5ec7f8
commit b52c550117
1 changed files with 5 additions and 1 deletions

View File

@ -72,7 +72,7 @@ class CallbackModule(DefaultCallback):
color = C.COLOR_CHANGED
else:
if not self.display_ok_hosts:
return
return (None, None)
line.append(self._get_state('OK'))
line.append(self._get_task_name(result))
line.append(host_str)
@ -146,6 +146,8 @@ class CallbackModule(DefaultCallback):
if isinstance(result._task, TaskInclude):
return
(line, color) = self._get_item_line(result, item=True)
if not line:
return
self._handle_warnings(result._result)
if result._task.loop and 'results' in result._result:
self._process_items(result)
@ -201,6 +203,8 @@ class CallbackModule(DefaultCallback):
if isinstance(result._task, TaskInclude):
return
(line, color) = self._get_item_line(result)
if not line:
return
self._handle_warnings(result._result)
if result._task.loop and 'results' in result._result:
self._process_items(result)