From 42b290b781f0ce6c1cf70c4f02ec5c66a03e6783 Mon Sep 17 00:00:00 2001 From: Chris Smart Date: Sat, 2 Nov 2019 19:42:34 +1100 Subject: [PATCH] cloud/openstack: fix os_server_action errors when wait is False (#64330) Using os_server_action to perform start, stop and pause actions on a server in OpenStack results in an error when 'wait' is False. The command is successfully sent to OpenStack, however Ansible fails the task: fatal: [127.0.0.1]: FAILED! => { "changed": false, "msg": "New-style module did not handle its own exit" } This patch ensures that those actions always exit, whether running with 'wait' set to True or False. As we are not waiting to confirm the result, this assumes that the actions were successful. Fixes #62958 Signed-off-by: Chris Smart --- lib/ansible/modules/cloud/openstack/os_server_action.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/openstack/os_server_action.py b/lib/ansible/modules/cloud/openstack/os_server_action.py index 25004bd851e..ea352013e07 100644 --- a/lib/ansible/modules/cloud/openstack/os_server_action.py +++ b/lib/ansible/modules/cloud/openstack/os_server_action.py @@ -154,7 +154,7 @@ def main(): json={'os-stop': None}) if wait: _wait(timeout, cloud, server, action, module, sdk) - module.exit_json(changed=True) + module.exit_json(changed=True) if action == 'start': if not _system_state_change(action, status): @@ -165,7 +165,7 @@ def main(): json={'os-start': None}) if wait: _wait(timeout, cloud, server, action, module, sdk) - module.exit_json(changed=True) + module.exit_json(changed=True) if action == 'pause': if not _system_state_change(action, status): @@ -176,7 +176,7 @@ def main(): json={'pause': None}) if wait: _wait(timeout, cloud, server, action, module, sdk) - module.exit_json(changed=True) + module.exit_json(changed=True) elif action == 'unpause': if not _system_state_change(action, status):