Improve parameter checking

required_one_of=[] is neat.

Co-authored-by: Alexei Znamensky
pull/778/head
George Rawlinson 2021-05-21 16:22:15 +12:00
parent f848326ecd
commit 044b0cbc85
No known key found for this signature in database
GPG Key ID: E0959FEA8B550539
1 changed files with 1 additions and 9 deletions

View File

@ -140,15 +140,6 @@ class PacmanKey(object):
fingerprint = self.sanitise_fingerprint(fingerprint)
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 state == "present":
if (key_present and force_update) or not key_present:
@ -331,6 +322,7 @@ def main():
),
supports_check_mode=True,
mutually_exclusive=(('data', 'file', 'url', 'keyserver'),),
required_one_of=[('data', 'file', 'url', 'keyserver'),],
)
PacmanKey(module)