From 67646a07715f2e821946fc4b34b62129ddd04c0c Mon Sep 17 00:00:00 2001 From: Peter Sprygada Date: Wed, 1 Feb 2017 18:14:53 -0500 Subject: [PATCH] fixes exec_command in shell (#20948) transforms command to dict for processing by instance of Shell --- lib/ansible/module_utils/shell.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/lib/ansible/module_utils/shell.py b/lib/ansible/module_utils/shell.py index 6bcccde373..4b0c0811fa 100644 --- a/lib/ansible/module_utils/shell.py +++ b/lib/ansible/module_utils/shell.py @@ -282,11 +282,21 @@ class CliBase(object): raise NetworkError(to_native(exc), commands=commands) def exec_command(self, command): + + transform = ComplexDict(dict( + command=dict(key=True), + prompt=dict(), + response=dict() + )) + try: cmdobj = json.loads(command) - return self.shell.send_command(cmdobj) except ValueError: - return (1, '', 'unable to parse request') + cmdobj = transform(command) + + rc, out, err = self.shell.send_command(cmdobj) + + return rc, out, err def run_commands(self, commands): return self.execute(to_list(commands))