mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 14:22:46 +00:00
Nicer errors from modules if arguments are not fed key=value
This commit is contained in:
@@ -149,7 +149,10 @@ class AnsibleModule(object):
|
|||||||
items = shlex.split(args)
|
items = shlex.split(args)
|
||||||
params = {}
|
params = {}
|
||||||
for x in items:
|
for x in items:
|
||||||
|
try:
|
||||||
(k, v) = x.split("=",1)
|
(k, v) = x.split("=",1)
|
||||||
|
except:
|
||||||
|
self.fail_json(msg="this module requires key=value arguments")
|
||||||
params[k] = v
|
params[k] = v
|
||||||
return (params, args)
|
return (params, args)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user