From 702bc7e8b18dd2f201fecd9752b6a1816903be37 Mon Sep 17 00:00:00 2001 From: dougiteixeira <31328123+dougiteixeira@users.noreply.github.com> Date: Sun, 19 May 2024 17:31:46 -0300 Subject: [PATCH] Fix deletion of repairs/issues --- custom_components/proxmoxve/api.py | 4 ++-- custom_components/proxmoxve/coordinator.py | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/custom_components/proxmoxve/api.py b/custom_components/proxmoxve/api.py index 465e0f9..5022e01 100644 --- a/custom_components/proxmoxve/api.py +++ b/custom_components/proxmoxve/api.py @@ -11,7 +11,7 @@ from homeassistant.helpers.issue_registry import ( IssueSeverity, async_create_issue, - async_delete_issue, + delete_issue, ) from .const import ( @@ -168,7 +168,7 @@ def post_api_command( f"Proxmox {resource} {command} error - {error}", ) from error - async_delete_issue( + delete_issue( self.hass, DOMAIN, issue_id, diff --git a/custom_components/proxmoxve/coordinator.py b/custom_components/proxmoxve/coordinator.py index e4a0f39..d5645e3 100644 --- a/custom_components/proxmoxve/coordinator.py +++ b/custom_components/proxmoxve/coordinator.py @@ -23,7 +23,7 @@ from homeassistant.helpers.issue_registry import ( IssueSeverity, async_create_issue, - async_delete_issue, + delete_issue, ) from homeassistant.helpers.typing import UNDEFINED, UndefinedType from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed @@ -792,6 +792,11 @@ def permission_to_resource( return "Unmapped" try: + delete_issue( + hass, + DOMAIN, + f"{config_entry.entry_id}_{resource_id}_forbiden", + ) return get_api(proxmox, api_path) except AuthenticationError as error: raise ConfigEntryAuthFailed from error @@ -824,9 +829,3 @@ def permission_to_resource( ) return None raise UpdateFailed from error - - async_delete_issue( - hass, - DOMAIN, - f"{config_entry.entry_id}_{resource_id}_forbiden", - )