diff --git a/plugins/module_utils/client.py b/plugins/module_utils/client.py index efb471a..4ccf051 100644 --- a/plugins/module_utils/client.py +++ b/plugins/module_utils/client.py @@ -33,8 +33,8 @@ def client_check_required_lib(): raise ClientException(missing_required_lib("python-dateutil")) -def _client_resource_not_found(resource: str, param: str | int): - return ClientException(f"resource ({resource.rstrip('s')}) does not exist: {param}") +def client_resource_not_found(resource: str, param: str | int): + return ClientException(f"resource ({resource}) does not exist: {param}") def client_get_by_name_or_id(client: Client, resource: str, param: str | int): @@ -55,13 +55,13 @@ def client_get_by_name_or_id(client: Client, resource: str, param: str | int): try: int(param) except ValueError as exception: - raise _client_resource_not_found(resource, param) from exception + raise client_resource_not_found(resource.rstrip("s"), param) from exception try: return resource_client.get_by_id(param) except APIException as exception: if exception.code == "not_found": - raise _client_resource_not_found(resource, param) from exception + raise client_resource_not_found(resource.rstrip("s"), param) from exception raise exception