From ae21d98955f0d7367ea94610c14e66b78c7ad4ca Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 21 Mar 2016 11:00:07 -0400 Subject: [PATCH] Properly use check_raw when using parse_kv in cli/ code Fixes ansible-modules-core#3070 --- lib/ansible/cli/adhoc.py | 3 ++- lib/ansible/cli/console.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/cli/adhoc.py b/lib/ansible/cli/adhoc.py index dcb65ad135..52ab761d52 100644 --- a/lib/ansible/cli/adhoc.py +++ b/lib/ansible/cli/adhoc.py @@ -81,11 +81,12 @@ class AdHocCLI(CLI): return True def _play_ds(self, pattern, async, poll): + check_raw = self.options.module_name in ('command', 'shell', 'script', 'raw') return dict( name = "Ansible Ad-Hoc", hosts = pattern, gather_facts = 'no', - tasks = [ dict(action=dict(module=self.options.module_name, args=parse_kv(self.options.module_args)), async=async, poll=poll) ] + tasks = [ dict(action=dict(module=self.options.module_name, args=parse_kv(self.options.module_args, check_raw=check_raw)), async=async, poll=poll) ] ) def run(self): diff --git a/lib/ansible/cli/console.py b/lib/ansible/cli/console.py index 38ec037934..c6b27f8f66 100644 --- a/lib/ansible/cli/console.py +++ b/lib/ansible/cli/console.py @@ -183,12 +183,12 @@ class ConsoleCLI(CLI, cmd.Cmd): result = None try: + check_raw = self.options.module_name in ('command', 'shell', 'script', 'raw') play_ds = dict( name = "Ansible Shell", hosts = self.options.cwd, gather_facts = 'no', - #tasks = [ dict(action=dict(module=module, args=parse_kv(module_args)), async=self.options.async, poll=self.options.poll_interval) ] - tasks = [ dict(action=dict(module=module, args=parse_kv(module_args)))] + tasks = [ dict(action=dict(module=module, args=parse_kv(module_args, check_raw=check_raw)))] ) play = Play().load(play_ds, variable_manager=self.variable_manager, loader=self.loader) except Exception as e: