Fixed fail_json call in command module (#58615)
Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
parent
5c5d9ad669
commit
1bd91279d0
2 changed files with 4 additions and 2 deletions
2
changelogs/fragments/command_fail_json.yml
Normal file
2
changelogs/fragments/command_fail_json.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- Corrected API call for module.fail_json in command module.
|
|
@ -262,12 +262,12 @@ def main():
|
||||||
try:
|
try:
|
||||||
chdir = to_bytes(os.path.abspath(chdir), errors='surrogate_or_strict')
|
chdir = to_bytes(os.path.abspath(chdir), errors='surrogate_or_strict')
|
||||||
except ValueError as e:
|
except ValueError as e:
|
||||||
module.jail_json('Unable to use supplied chdir: %s' % to_text(e))
|
module.fail_json(msg='Unable to use supplied chdir: %s' % to_text(e))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
os.chdir(chdir)
|
os.chdir(chdir)
|
||||||
except (IOError, OSError) as e:
|
except (IOError, OSError) as e:
|
||||||
module.fail_json('Unable to change directory before execution: %s' % to_text(e))
|
module.fail_json(msg='Unable to change directory before execution: %s' % to_text(e))
|
||||||
|
|
||||||
if creates:
|
if creates:
|
||||||
# do not run the command if the line contains creates=filename
|
# do not run the command if the line contains creates=filename
|
||||||
|
|
Loading…
Reference in a new issue