Skip to content

Commit

Permalink
Enforce mutually exclusive options in credential module of the collec…
Browse files Browse the repository at this point in the history
…tion (ansible#14363)
  • Loading branch information
djdanielsson authored and djyasin committed Nov 11, 2024
1 parent 477dfe1 commit b063a98
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion awx_collection/plugins/modules/credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
organization:
description:
- Organization name, ID, or named URL that should own the credential.
- This parameter is mutually exclusive with C(team) and C(user).
type: str
credential_type:
description:
Expand Down Expand Up @@ -93,10 +94,12 @@
user:
description:
- User name, ID, or named URL that should own this credential.
- This parameter is mutually exclusive with C(organization) and C(team).
type: str
team:
description:
- Team name, ID, or named URL that should own this credential.
- This parameter is mutually exclusive with C(organization) and C(user).
type: str
state:
description:
Expand Down Expand Up @@ -219,8 +222,13 @@ def main():
state=dict(choices=['present', 'absent', 'exists'], default='present'),
)

mutually_exclusive = [("organization", "user", "team")]

# Create a module for ourselves
module = ControllerAPIModule(argument_spec=argument_spec)
module = ControllerAPIModule(
argument_spec=argument_spec,
mutually_exclusive=mutually_exclusive
)

# Extract our parameters
name = module.params.get('name')
Expand Down

0 comments on commit b063a98

Please sign in to comment.