Skip to content

Commit

Permalink
chore: auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 13, 2024
1 parent 174d1e0 commit f48a9d4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
1 change: 0 additions & 1 deletion .config/dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ refspec
rulebook
rulebooks
ruleset
ruleset
servicebus
skipsdist
snakeoil
Expand Down
16 changes: 12 additions & 4 deletions plugins/modules/activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,26 @@ def create_params(
for elem in module.params.get("event_streams"):
event = elem.copy()
if event.get("source_index") and event.get("source_name"):
module.fail_json(msg="source_index and source_name options are mutually exclusive.")
module.fail_json(
msg="source_index and source_name options are mutually exclusive."
)

if event.get("source_index") is None and event.get("source_name") is None:
module.fail_json(msg="You must specify one of the options source_index or source_name.")
module.fail_json(
msg="You must specify one of the options source_index or source_name."
)

if event.get("source_index"):
try:
event["source_name"] = sources[event["source_index"]]
except IndexError as e:
module.fail_json(msg=f"The specified source_index {event['source_index']} is out of range: {e}")
module.fail_json(
msg=f"The specified source_index {event['source_index']} is out of range: {e}"
)
event.pop("source_index")
elif event.get("source_name") and not any(d["name"] == event.get("source_name") for d in sources):
elif event.get("source_name") and not any(
d["name"] == event.get("source_name") for d in sources
):
module.fail_json(
msg=f"The specified source_name {event.get('source_name')} does not exist."
)
Expand Down

0 comments on commit f48a9d4

Please sign in to comment.