Skip to content

Commit

Permalink
Improve parameter checking
Browse files Browse the repository at this point in the history
required_one_of=[] is neat.

Co-authored-by: Alexei Znamensky
  • Loading branch information
grawlinson committed May 21, 2021
1 parent f848326 commit 044b0cb
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions plugins/modules/packaging/os/pacman_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,6 @@ def __init__(self, module):
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:
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 044b0cb

Please sign in to comment.