win_reboot: fix minor issues with the latest refactor (#44740)

* win_reboot: fix minor issues with the latest refactor

* Always return elapsed with win_reboot
This commit is contained in:
Jordan Borean 2018-08-29 07:25:37 +10:00 committed by Sam Doran
commit 0c3216c565
3 changed files with 21 additions and 11 deletions

View file

@ -134,7 +134,16 @@ class ActionModule(ActionBase):
def run_test_command(self, **kwargs):
test_command = self._task.args.get('test_command', self.DEFAULT_TEST_COMMAND)
display.vvv("%s: attempting post-reboot test command '%s'" % (self._task.action, test_command))
command_result = self._low_level_execute_command(test_command, sudoable=self.DEFAULT_SUDOABLE)
try:
command_result = self._low_level_execute_command(test_command, sudoable=self.DEFAULT_SUDOABLE)
except Exception:
# may need to reset the connection in case another reboot occurred
# which has invalidated our connection
try:
self._connection.reset()
except AttributeError:
pass
raise
result = {}
if command_result['rc'] != 0: