Merge pull request #205 from dw/dmw

ansible: prevent Unicode strings leaking into sys.argv
pull/206/head
dw 7 years ago committed by GitHub
commit 1909fb43f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -99,8 +99,8 @@ class Runner(object):
if raw_params is not None:
args['_raw_params'] = raw_params
self.module = module
self.remote_tmp = os.path.expanduser(remote_tmp)
self.module = utf8(module)
self.remote_tmp = utf8(os.path.expanduser(remote_tmp))
self.service_context = service_context
self.emulate_tty = emulate_tty
self.raw_params = raw_params

@ -13,3 +13,12 @@
(not out.results[0].changed) and
out.results[0].input[0].ANSIBLE_MODULE_ARGS.foo and
out.results[0].msg == 'Here is my input'
# Verify sys.argv is not Unicode.
- custom_python_detect_environment:
register: out
- assert:
that:
- out.argv_types == ["<type 'str'>"]

@ -14,6 +14,7 @@ def main():
module = AnsibleModule(argument_spec={})
module.exit_json(
argv=sys.argv,
argv_types=[str(type(s)) for s in sys.argv],
env=dict(os.environ),
cwd=os.getcwd(),
python_path=sys.path,

Loading…
Cancel
Save