mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Add check for multiple keys in one invocation
This commit is contained in:
parent
d11262af4d
commit
a19a13ffa7
1 changed files with 3 additions and 1 deletions
|
@ -143,6 +143,9 @@ def enforce_state(module, params):
|
||||||
key = params["key"]
|
key = params["key"]
|
||||||
state = params.get("state", "present")
|
state = params.get("state", "present")
|
||||||
|
|
||||||
|
if '\n' in key:
|
||||||
|
module.fail_json(msg="key= can only contain a single key")
|
||||||
|
|
||||||
# check current state -- just get the filename, don't create file
|
# check current state -- just get the filename, don't create file
|
||||||
params["keyfile"] = keyfile(module, user, write=False)
|
params["keyfile"] = keyfile(module, user, write=False)
|
||||||
keys = readkeys(params["keyfile"])
|
keys = readkeys(params["keyfile"])
|
||||||
|
@ -174,7 +177,6 @@ def main():
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
params = module.params
|
|
||||||
results = enforce_state(module, module.params)
|
results = enforce_state(module, module.params)
|
||||||
module.exit_json(**results)
|
module.exit_json(**results)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue