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

ensure win_reboot warnings value is a list

This commit is contained in:
Matt Davis 2017-01-16 14:28:18 -08:00
parent c8970fc4e6
commit 883f7ed197

View file

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