Update HACS

This commit is contained in:
root
2022-10-30 09:47:33 -07:00
parent 791369c66a
commit 108f9c24cc
18 changed files with 146 additions and 49 deletions

View File

@@ -18,7 +18,7 @@ from aiogithubapi import (
from aiogithubapi.const import BASE_API_URL
from aiogithubapi.objects.repository import AIOGitHubAPIRepository
import attr
from homeassistant.helpers import device_registry as dr
from homeassistant.helpers import device_registry as dr, issue_registry as ir
from ..const import DOMAIN
from ..enums import ConfigurationType, HacsDispatchEvent, RepositoryFile
@@ -734,6 +734,7 @@ class HacsRepository:
)
await self.async_remove_entity_device()
ir.async_delete_issue(self.hacs.hass, DOMAIN, f"removed_{self.data.id}")
async def remove_local_directory(self) -> None:
"""Check the local directory."""
@@ -993,7 +994,12 @@ class HacsRepository:
releases.append(release)
return releases
async def common_update_data(self, ignore_issues: bool = False, force: bool = False) -> None:
async def common_update_data(
self,
ignore_issues: bool = False,
force: bool = False,
retry=False,
) -> None:
"""Common update data."""
releases = []
try:
@@ -1072,6 +1078,20 @@ class HacsRepository:
for treefile in self.tree:
self.treefiles.append(treefile.full_path)
except (AIOGitHubAPIException, HacsException) as exception:
if (
not retry
and self.ref is not None
and str(exception).startswith("GitHub returned 404")
):
# Handle tags/branches being deleted.
self.data.selected_tag = None
self.ref = self.version_to_download()
self.logger.warning(
"%s Selected version/branch %s has been removed, falling back to default",
self.string,
self.ref,
)
return await self.common_update_data(ignore_issues, force, True)
if not self.hacs.status.startup and not ignore_issues:
self.logger.error("%s %s", self.string, exception)
if not ignore_issues: