ensure win_reboot warnings value is a list

pull/20073/head
Matt Davis 8 years ago
parent c8970fc4e6
commit 883f7ed197

@ -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')

Loading…
Cancel
Save