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 Aug 19, 2024
1 parent 9f3b5a7 commit f3e9842
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
10 changes: 5 additions & 5 deletions plugins/module_utils/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Simplified BSD License (see licenses/simplified_bsd.txt or https://opensource.org/licenses/BSD-2-Clause)
from __future__ import absolute_import, annotations, division, print_function

from typing import Any, List, NoReturn, Optional, Union
from typing import Any, List, NoReturn, Optional

from ansible.module_utils.basic import AnsibleModule

Expand Down Expand Up @@ -84,16 +84,16 @@ def fail_wanted_one(self, response, endpoint, query_params) -> NoReturn:
display_endpoint = url.geturl()[
host_length:
] # truncate to not include the base URL
msg = f"Request to {display_endpoint} returned {len(response)} items, expected 1"
msg = (
f"Request to {display_endpoint} returned {len(response)} items, expected 1"
)
raise EDAError(msg)

def get_exactly_one(
self, endpoint, name=None, **kwargs
) -> Optional[dict[str, bool]]:
new_kwargs = kwargs.copy()
result = self.get_one_or_many(
endpoint, name=name, **kwargs
)
result = self.get_one_or_many(endpoint, name=name, **kwargs)

if len(result) == 1:
return result[0]
Expand Down
6 changes: 5 additions & 1 deletion plugins/modules/activation.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,11 @@ def main() -> None:
argument_spec.update(AUTH_ARGSPEC)

required_if = [
("state", "present", ("name", "rulebook_name", "decision_environment_name", "organization_name"))
(
"state",
"present",
("name", "rulebook_name", "decision_environment_name", "organization_name"),
)
]

module = AnsibleModule(
Expand Down
8 changes: 7 additions & 1 deletion plugins/modules/credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,13 @@ def main() -> None:

argument_spec.update(AUTH_ARGSPEC)

required_if = [("state", "present", ("name", "credential_type_name", "inputs", "organization_name"))]
required_if = [
(
"state",
"present",
("name", "credential_type_name", "inputs", "organization_name"),
)
]

module = AnsibleModule(
argument_spec=argument_spec, required_if=required_if, supports_check_mode=True
Expand Down
4 changes: 3 additions & 1 deletion plugins/modules/decision_environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,9 @@ def main() -> None:

required_if = [("state", "present", ("name", "organization_name", "image_url"))]

module = AnsibleModule(argument_spec=argument_spec, required_if=required_if, supports_check_mode=True)
module = AnsibleModule(
argument_spec=argument_spec, required_if=required_if, supports_check_mode=True
)

client = Client(
host=module.params.get("controller_host"),
Expand Down
14 changes: 7 additions & 7 deletions plugins/modules/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ def main() -> None:

argument_spec.update(AUTH_ARGSPEC)

required_if = [
("state", "present", ("name", "url", "organization_name"))
]
required_if = [("state", "present", ("name", "url", "organization_name"))]

module = AnsibleModule(argument_spec=argument_spec, required_if=required_if, supports_check_mode=True)
module = AnsibleModule(
argument_spec=argument_spec, required_if=required_if, supports_check_mode=True
)

client = Client(
host=module.params.get("controller_host"),
Expand Down Expand Up @@ -172,9 +172,9 @@ def main() -> None:
organization_id = None
if module.params.get("organization_name"):
try:
organization_id = controller.resolve_name_to_id(
"organizations", module.params["organization_name"]
)
organization_id = controller.resolve_name_to_id(
"organizations", module.params["organization_name"]
)
except EDAError as eda_err:
module.fail_json(msg=str(eda_err))
raise
Expand Down

0 comments on commit f3e9842

Please sign in to comment.