Fixed fail_json call in command module (#58615)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
pull/58744/head
Abhijeet Kasurde 5 years ago committed by GitHub
parent 5c5d9ad669
commit 1bd91279d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
minor_changes:
- Corrected API call for module.fail_json in command module.

@ -262,12 +262,12 @@ def main():
try:
chdir = to_bytes(os.path.abspath(chdir), errors='surrogate_or_strict')
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:
os.chdir(chdir)
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:
# do not run the command if the line contains creates=filename

Loading…
Cancel
Save