mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Improve parameter checking
required_one_of=[] is neat. Co-authored-by: Alexei Znamensky
This commit is contained in:
parent
f848326ecd
commit
044b0cbc85
1 changed files with 1 additions and 9 deletions
|
@ -140,15 +140,6 @@ class PacmanKey(object):
|
||||||
fingerprint = self.sanitise_fingerprint(fingerprint)
|
fingerprint = self.sanitise_fingerprint(fingerprint)
|
||||||
key_present = self.key_in_keyring(keyid, keyring)
|
key_present = self.key_in_keyring(keyid, keyring)
|
||||||
|
|
||||||
if (
|
|
||||||
state == "present"
|
|
||||||
and data is None
|
|
||||||
and file is None
|
|
||||||
and url is None
|
|
||||||
and keyserver is None
|
|
||||||
):
|
|
||||||
module.fail_json(msg="expected one of: data, file, url, keyserver. got none")
|
|
||||||
|
|
||||||
if module.check_mode:
|
if module.check_mode:
|
||||||
if state == "present":
|
if state == "present":
|
||||||
if (key_present and force_update) or not key_present:
|
if (key_present and force_update) or not key_present:
|
||||||
|
@ -331,6 +322,7 @@ def main():
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
mutually_exclusive=(('data', 'file', 'url', 'keyserver'),),
|
mutually_exclusive=(('data', 'file', 'url', 'keyserver'),),
|
||||||
|
required_one_of=[('data', 'file', 'url', 'keyserver'),],
|
||||||
)
|
)
|
||||||
PacmanKey(module)
|
PacmanKey(module)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue