Fixed fail_json call in command module (#58615)

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
Abhijeet Kasurde 2019-07-05 11:00:10 +05:30 committed by GitHub
parent 5c5d9ad669
commit 1bd91279d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

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

View file

@ -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