diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 8aaf0f8c79d..3865b9c0b88 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -28,7 +28,6 @@ import collections import socket import base64 import sys -import shlex import pipes import jinja2 import subprocess diff --git a/lib/ansible/runner/action_plugins/assemble.py b/lib/ansible/runner/action_plugins/assemble.py index c73964cda68..2fd76391769 100644 --- a/lib/ansible/runner/action_plugins/assemble.py +++ b/lib/ansible/runner/action_plugins/assemble.py @@ -58,6 +58,7 @@ class ActionModule(object): options = {} if complex_args: options.update(complex_args) + options.update(utils.parse_kv(module_args)) src = options.get('src', None) @@ -65,6 +66,7 @@ class ActionModule(object): delimiter = options.get('delimiter', None) remote_src = utils.boolean(options.get('remote_src', 'yes')) + if src is None or dest is None: result = dict(failed=True, msg="src and dest are required") return ReturnData(conn=conn, comm_ok=False, result=result) diff --git a/lib/ansible/utils/__init__.py b/lib/ansible/utils/__init__.py index 2543c5776ac..2d3fb24db30 100644 --- a/lib/ansible/utils/__init__.py +++ b/lib/ansible/utils/__init__.py @@ -539,8 +539,14 @@ def parse_kv(args): if args is not None: # attempting to split a unicode here does bad things args = args.encode('utf-8') - vargs = [x.decode('utf-8') for x in shlex.split(args, posix=True)] - #vargs = shlex.split(str(args), posix=True) + try: + vargs = shlex.split(args, posix=True) + except ValueError, ve: + if 'no closing quotation' in str(ve).lower(): + raise errors.AnsibleError("error parsing argument string, try quoting the entire line.") + else: + raise + vargs = [x.decode('utf-8') for x in vargs] for x in vargs: if "=" in x: k, v = x.split("=",1)