Ansible keeps adding more fields to _result. Let's just use inclusion rather than exclusion
Signed-off-by: Patrick Uiterwijk <puiterwijk@redhat.com>
This commit is contained in:
parent
cd56887767
commit
13cc604141
1 changed files with 9 additions and 1 deletions
|
@ -14,6 +14,9 @@ from ansible.cli.adhoc import AdHocCLI
|
|||
|
||||
|
||||
class ResultAccumulator(CallbackBase):
|
||||
CALLBACK_VERSION = 2.0
|
||||
CALLBACK_NAME = 'accumulator'
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ResultAccumulator, self).__init__(*args, **kwargs)
|
||||
self.unreachable = set()
|
||||
|
@ -23,7 +26,12 @@ class ResultAccumulator(CallbackBase):
|
|||
self.unreachable.add(result._host.get_name())
|
||||
|
||||
def v2_runner_on_ok(self, result, *args, **kwargs):
|
||||
for vm in (vm for vm in result._result.keys() if vm not in ('invocation', 'changed') and not vm.startswith('_ansible')):
|
||||
for vm in result._result.keys():
|
||||
if not '.fedoraproject.org' in vm:
|
||||
# Seemingly, Ansible keeps adding more random keys to the
|
||||
# result dict every time, so let's just kill the tailing
|
||||
# once and for all. If it doesn't look like a hostname, ignore.
|
||||
continue
|
||||
self.host_status[(result._host.get_name(), vm)] = (result._result[vm]['state'], str(result._result[vm]['autostart']))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue