1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

win_updates: fix when failed is not present in output (#38856)

This commit is contained in:
Jordan Borean 2018-04-17 10:45:53 +10:00 committed by GitHub
parent 27def6c5dc
commit f1c16438c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -189,10 +189,12 @@ class ActionModule(ActionBase):
# if the module failed to run at all then changed won't be populated # if the module failed to run at all then changed won't be populated
# so we just return the result as is # so we just return the result as is
# https://github.com/ansible/ansible/issues/38232 # https://github.com/ansible/ansible/issues/38232
if result['failed']: failed = result.get('failed', False)
if "updates" not in result.keys() or failed:
result['failed'] = True
return result return result
changed = result['changed'] changed = result.get('changed', False)
updates = result.get('updates', dict()) updates = result.get('updates', dict())
filtered_updates = result.get('filtered_updates', dict()) filtered_updates = result.get('filtered_updates', dict())
found_update_count = result.get('found_update_count', 0) found_update_count = result.get('found_update_count', 0)
@ -241,7 +243,7 @@ class ActionModule(ActionBase):
result.pop('msg', None) result.pop('msg', None)
# rerun the win_updates module after the reboot is complete # rerun the win_updates module after the reboot is complete
result = self._run_win_updates(new_module_args, task_vars) result = self._run_win_updates(new_module_args, task_vars)
if result['failed']: if result.get('failed', False):
return result return result
result_updates = result.get('updates', dict()) result_updates = result.get('updates', dict())