summaryrefslogtreecommitdiff
path: root/commands/command.py
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2016-10-03 14:09:42 -0700
committerToshio Kuratomi <a.badger@gmail.com>2016-10-03 14:59:16 -0700
commit95755d1859354bf9da5eb0d8a4b4b65e8c5b0431 (patch)
treef51c8a35e8a091e70a6be6c9e9fe130a8d076487 /commands/command.py
parentf1c27391638846094684d2d134768e0de1c0ecc6 (diff)
downloadansible-modules-core-95755d1859354bf9da5eb0d8a4b4b65e8c5b0431.tar.gz
We've changed run_command to return native_strings
on python3, this means that we don't get bytes back by default. We probably do want bytes here so modify our call to run_command so we get bytes instead of text.
Diffstat (limited to 'commands/command.py')
-rw-r--r--commands/command.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/commands/command.py b/commands/command.py
index 410efb02..6c75d3f0 100644
--- a/commands/command.py
+++ b/commands/command.py
@@ -95,13 +95,13 @@ EXAMPLES = '''
import datetime
import glob
-import re
import shlex
import os
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import b
+
def check_command(commandline):
arguments = { 'chown': 'owner', 'chmod': 'mode', 'chgrp': 'group',
'ln': 'state=link', 'mkdir': 'state=directory',
@@ -142,9 +142,9 @@ def main():
shell = module.params['_uses_shell']
chdir = module.params['chdir']
executable = module.params['executable']
- args = module.params['_raw_params']
- creates = module.params['creates']
- removes = module.params['removes']
+ args = module.params['_raw_params']
+ creates = module.params['creates']
+ removes = module.params['removes']
warn = module.params['warn']
if args.strip() == '':
@@ -167,9 +167,9 @@ def main():
)
if removes:
- # do not run the command if the line contains removes=filename
- # and the filename does not exist. This allows idempotence
- # of command executions.
+ # do not run the command if the line contains removes=filename
+ # and the filename does not exist. This allows idempotence
+ # of command executions.
if not glob.glob(removes):
module.exit_json(
cmd=args,
@@ -186,7 +186,7 @@ def main():
args = shlex.split(args)
startd = datetime.datetime.now()
- rc, out, err = module.run_command(args, executable=executable, use_unsafe_shell=shell)
+ rc, out, err = module.run_command(args, executable=executable, use_unsafe_shell=shell, encoding=None)
endd = datetime.datetime.now()
delta = endd - startd