mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-16 17:01:30 +00:00
[PR #11149/79b16d9c backport][stable-12] fix return value exception (#11173)
fix return value `exception` (#11149)
* fix return value `exception`
* add changelog frag
* adjustments after review
* typo
* adjust changelog frag
* vmadm: send rc, stdout, and stderr to fail_json()
* rundeck: pass tracebacks
* Update changelogs/fragments/11149-rv-exception.yml
* Update changelogs/fragments/11149-rv-exception.yml
---------
(cherry picked from commit 79b16d9ca5)
Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
4480036401
commit
9d7855b844
3 changed files with 15 additions and 8 deletions
|
|
@ -361,7 +361,7 @@ def get_vm_prop(module, uuid, prop):
|
|||
(rc, stdout, stderr) = module.run_command(cmd)
|
||||
|
||||
if rc != 0:
|
||||
module.fail_json(msg=f"Could not perform lookup of {prop} on {uuid}", exception=stderr)
|
||||
module.fail_json(msg=f"Could not perform lookup of {prop} on {uuid}", rc=rc, stdout=stdout, stderr=stderr)
|
||||
|
||||
try:
|
||||
stdout_json = json.loads(stdout)
|
||||
|
|
@ -384,7 +384,7 @@ def get_vm_uuid(module, alias):
|
|||
(rc, stdout, stderr) = module.run_command(cmd)
|
||||
|
||||
if rc != 0:
|
||||
module.fail_json(msg=f"Could not retrieve UUID of {alias}", exception=stderr)
|
||||
module.fail_json(msg=f"Could not retrieve UUID of {alias}", rc=rc, stdout=stdout, stderr=stderr)
|
||||
|
||||
# If no VM was found matching the given alias, we get back an empty array.
|
||||
# That is not an error condition as we might be explicitly checking for its
|
||||
|
|
@ -409,7 +409,7 @@ def get_all_vm_uuids(module):
|
|||
(rc, stdout, stderr) = module.run_command(cmd)
|
||||
|
||||
if rc != 0:
|
||||
module.fail_json(msg="Failed to get VMs list", exception=stderr)
|
||||
module.fail_json(msg="Failed to get VMs list", rc=rc, stdout=stdout, stderr=stderr)
|
||||
|
||||
try:
|
||||
stdout_json = json.loads(stdout)
|
||||
|
|
@ -421,11 +421,11 @@ def get_all_vm_uuids(module):
|
|||
def new_vm(module, uuid, vm_state):
|
||||
payload_file = create_payload(module, uuid)
|
||||
|
||||
(rc, dummy, stderr) = vmadm_create_vm(module, payload_file)
|
||||
(rc, stdout, stderr) = vmadm_create_vm(module, payload_file)
|
||||
|
||||
if rc != 0:
|
||||
changed = False
|
||||
module.fail_json(msg="Could not create VM", exception=stderr)
|
||||
module.fail_json(msg="Could not create VM", rc=rc, stdout=stdout, stderr=stderr)
|
||||
else:
|
||||
changed = True
|
||||
# 'vmadm create' returns all output to stderr...
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue