Catch a unquoted line error. Fixes #6532
This commit is contained in:
parent
b8d5ba42f5
commit
94e3350b38
3 changed files with 10 additions and 3 deletions
|
@ -28,7 +28,6 @@ import collections
|
||||||
import socket
|
import socket
|
||||||
import base64
|
import base64
|
||||||
import sys
|
import sys
|
||||||
import shlex
|
|
||||||
import pipes
|
import pipes
|
||||||
import jinja2
|
import jinja2
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
|
@ -58,6 +58,7 @@ class ActionModule(object):
|
||||||
options = {}
|
options = {}
|
||||||
if complex_args:
|
if complex_args:
|
||||||
options.update(complex_args)
|
options.update(complex_args)
|
||||||
|
|
||||||
options.update(utils.parse_kv(module_args))
|
options.update(utils.parse_kv(module_args))
|
||||||
|
|
||||||
src = options.get('src', None)
|
src = options.get('src', None)
|
||||||
|
@ -65,6 +66,7 @@ class ActionModule(object):
|
||||||
delimiter = options.get('delimiter', None)
|
delimiter = options.get('delimiter', None)
|
||||||
remote_src = utils.boolean(options.get('remote_src', 'yes'))
|
remote_src = utils.boolean(options.get('remote_src', 'yes'))
|
||||||
|
|
||||||
|
|
||||||
if src is None or dest is None:
|
if src is None or dest is None:
|
||||||
result = dict(failed=True, msg="src and dest are required")
|
result = dict(failed=True, msg="src and dest are required")
|
||||||
return ReturnData(conn=conn, comm_ok=False, result=result)
|
return ReturnData(conn=conn, comm_ok=False, result=result)
|
||||||
|
|
|
@ -539,8 +539,14 @@ def parse_kv(args):
|
||||||
if args is not None:
|
if args is not None:
|
||||||
# attempting to split a unicode here does bad things
|
# attempting to split a unicode here does bad things
|
||||||
args = args.encode('utf-8')
|
args = args.encode('utf-8')
|
||||||
vargs = [x.decode('utf-8') for x in shlex.split(args, posix=True)]
|
try:
|
||||||
#vargs = shlex.split(str(args), posix=True)
|
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:
|
for x in vargs:
|
||||||
if "=" in x:
|
if "=" in x:
|
||||||
k, v = x.split("=",1)
|
k, v = x.split("=",1)
|
||||||
|
|
Loading…
Reference in a new issue