Skip to content

Commit

Permalink
win_updates: handle if module failed to run (#38363)
Browse files Browse the repository at this point in the history
  • Loading branch information
jborean93 committed Apr 9, 2018
1 parent 988808c commit ccc56e1
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/ansible/plugins/action/win_updates.py
Expand Up @@ -186,6 +186,12 @@ def run(self, tmp=None, task_vars=None):
new_module_args.pop('reboot_timeout', None)
result = self._run_win_updates(new_module_args, task_vars)

# if the module failed to run at all then changed won't be populated
# so we just return the result as is
# https://github.com/ansible/ansible/issues/38232
if result['failed']:
return result

changed = result['changed']
updates = result.get('updates', dict())
filtered_updates = result.get('filtered_updates', dict())
Expand Down Expand Up @@ -235,6 +241,8 @@ def run(self, tmp=None, task_vars=None):
result.pop('msg', None)
# rerun the win_updates module after the reboot is complete
result = self._run_win_updates(new_module_args, task_vars)
if result['failed']:
return result

result_updates = result.get('updates', dict())
result_filtered_updates = result.get('filtered_updates', dict())
Expand Down

0 comments on commit ccc56e1

Please sign in to comment.