Fix list-vms-per-host script

Ansible-2.2 introduced more special result vars.  Omit all tresults vars
starting with '_ansible' to compensate.
This commit is contained in:
Toshio くらとみ 2016-11-05 18:45:04 +00:00
parent e9f9a1e1af
commit 9a8399d577

View file

@ -1,6 +1,6 @@
#!/usr/bin/python -tt #!/usr/bin/python -tt
# Author: Toshio Kuratomi <toshio@fedoraproject.org> # Author: Toshio Kuratomi <toshio@fedoraproject.org>
# Copyright: December, 2015 # Copyright: December 2015, November 2016
# License: LGPLv3+ # License: LGPLv3+
import sys import sys
import copy import copy
@ -23,7 +23,7 @@ class ResultAccumulator(CallbackBase):
self.unreachable.add(result._host.get_name()) self.unreachable.add(result._host.get_name())
def v2_runner_on_ok(self, result, *args, **kwargs): 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', '_ansible_no_log')): for vm in (vm for vm in result._result.keys() if vm not in ('invocation', 'changed') and not vm.startswith('_ansible')):
self.host_status[(result._host.get_name(), vm)] = (result._result[vm]['state'], str(result._result[vm]['autostart'])) self.host_status[(result._host.get_name(), vm)] = (result._result[vm]['state'], str(result._result[vm]['autostart']))