From 7814546735d20040c84a54cf213764f5a8ff80f4 Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Mon, 19 Dec 2016 11:34:18 -0500 Subject: [PATCH] cast injected json string to bytes in local modules (#19519) this change will cast the locally injected ansible args to bytes from string --- lib/ansible/module_utils/local.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/local.py b/lib/ansible/module_utils/local.py index 9fe3e0ac63..b9aa39b17b 100644 --- a/lib/ansible/module_utils/local.py +++ b/lib/ansible/module_utils/local.py @@ -32,6 +32,7 @@ import ansible.module_utils.basic from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.basic import remove_values +from ansible.module_utils._text import to_bytes from ansible.errors import AnsibleModuleExit @@ -39,7 +40,8 @@ _ANSIBLE_CONNECTION = None def _modify_module(task_args, connection): params = {'ANSIBLE_MODULE_ARGS': task_args} - ansible.module_utils.basic._ANSIBLE_ARGS = json.dumps(params) + params = json.dumps(params) + ansible.module_utils.basic._ANSIBLE_ARGS = to_bytes(params) global _ANSIBLE_CONNECTION _ANSIBLE_CONNECTION = connection