From 883f7ed19738cb20da0ddd8123628cde3b8fa022 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Mon, 16 Jan 2017 14:28:18 -0800 Subject: [PATCH] ensure win_reboot warnings value is a list --- lib/ansible/plugins/action/win_reboot.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/plugins/action/win_reboot.py b/lib/ansible/plugins/action/win_reboot.py index 82216207d40..21ca45b2e65 100644 --- a/lib/ansible/plugins/action/win_reboot.py +++ b/lib/ansible/plugins/action/win_reboot.py @@ -82,13 +82,14 @@ class ActionModule(ActionBase): winrm_port = self._connection._winrm_port result = super(ActionModule, self).run(tmp, task_vars) + result['warnings'] = [] # Initiate reboot (rc, stdout, stderr) = self._connection.exec_command('shutdown /r /t %d /c "%s"' % (pre_reboot_delay_sec, msg)) # Test for "A system shutdown has already been scheduled. (1190)" and handle it gracefully if rc == 1190: - result['warnings'] = ( 'A scheduled reboot was pre-empted by Ansible.' ) + result['warnings'].append('A scheduled reboot was pre-empted by Ansible.') # Try to abort (this may fail if it was already aborted) (rc, stdout1, stderr1) = self._connection.exec_command('shutdown /a')