From dd36b7f3584ac563cef80222050cbbd2224295ac Mon Sep 17 00:00:00 2001 From: dougiteixeira <31328123+dougiteixeira@users.noreply.github.com> Date: Sun, 8 Dec 2024 11:31:34 -0300 Subject: [PATCH] Allows you to skip the repair of missing permission for update endpoint --- custom_components/proxmoxve/coordinator.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/custom_components/proxmoxve/coordinator.py b/custom_components/proxmoxve/coordinator.py index d0725a7..16b285e 100644 --- a/custom_components/proxmoxve/coordinator.py +++ b/custom_components/proxmoxve/coordinator.py @@ -825,7 +825,7 @@ def permission_to_resource( return "Unmapped" try: - return get_api(proxmox, api_path) + api_data = get_api(proxmox, api_path) except AuthenticationError as error: raise ConfigEntryAuthFailed from error except ( @@ -848,9 +848,12 @@ def permission_to_resource( severity=ir.IssueSeverity.ERROR, translation_key="resource_exception_forbiden", translation_placeholders={ - "resource": f"{api_category.capitalize()} {resource_id}", + "resource": f"{api_category.capitalize()} {resource_id.replace(f"{ProxmoxType.Update.capitalize()} ", "")}", "user": config_entry.data[CONF_USERNAME], - "permission": permission_to_resource(api_category, resource_id), + "permission": permission_to_resource( + api_category, + resource_id.replace(f"{ProxmoxType.Update.capitalize()} ", ""), + ), }, ) LOGGER.debug( @@ -862,4 +865,5 @@ def permission_to_resource( hass, DOMAIN, f"{config_entry.entry_id}_{resource_id}_forbiden", - ) \ No newline at end of file + ) + return api_data