From 8aa21c2f91025ca743398881eb5ac57831cf5e6b Mon Sep 17 00:00:00 2001 From: abhinavbansal29 Date: Tue, 17 Sep 2024 14:47:51 +0530 Subject: [PATCH 1/2] Added fix for module.fail_json, now it takes 2 Arguments. Issue was: https://github.com/nutanix/nutanix.ansible/issues/465 --- plugins/modules/ntnx_vms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/ntnx_vms.py b/plugins/modules/ntnx_vms.py index 7d1d329d3..d9e995875 100644 --- a/plugins/modules/ntnx_vms.py +++ b/plugins/modules/ntnx_vms.py @@ -879,7 +879,7 @@ def update_vm(module, result): if is_vm_on and vm.is_restart_required(): if not module.params.get("force_power_off"): module.fail_json( - "To make these changes, the VM should be restarted, but 'force_power_off' is False" + msg="To make these changes, the VM should be restarted, but 'force_power_off' is False", **result ) power_off_vm(vm, module, result) From 05b2c7b3329283e5814d15743c549f4fb7319038 Mon Sep 17 00:00:00 2001 From: abhinavbansal29 Date: Wed, 18 Sep 2024 12:45:12 +0530 Subject: [PATCH 2/2] After running black --- plugins/modules/ntnx_vms.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/modules/ntnx_vms.py b/plugins/modules/ntnx_vms.py index d9e995875..5b05ea783 100644 --- a/plugins/modules/ntnx_vms.py +++ b/plugins/modules/ntnx_vms.py @@ -879,7 +879,8 @@ def update_vm(module, result): if is_vm_on and vm.is_restart_required(): if not module.params.get("force_power_off"): module.fail_json( - msg="To make these changes, the VM should be restarted, but 'force_power_off' is False", **result + msg="To make these changes, the VM should be restarted, but 'force_power_off' is False", + **result, ) power_off_vm(vm, module, result)