Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only log once for archived repositories #2155

Merged
merged 1 commit into from
Aug 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions custom_components/hacs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class HacsCommon:
default: List = []
installed: List = []
renamed_repositories = {}
archived_repositories = []
skip: List = []


Expand Down
14 changes: 4 additions & 10 deletions custom_components/hacs/hacsbase/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ async def async_write(self):

self.logger.debug("Saving data")

# Renamed repositories
await async_save_to_store(
self.hacs.hass,
"renamed_repositories",
self.hacs.common.renamed_repositories,
)

# Hacs
await async_save_to_store(
self.hacs.hass,
Expand All @@ -63,6 +56,8 @@ async def async_write(self):
"view": self.hacs.configuration.frontend_mode,
"compact": self.hacs.configuration.frontend_compact,
"onboarding_done": self.hacs.configuration.onboarding_done,
"archived_repositories": self.hacs.common.archived_repositories,
"renamed_repositories": self.hacs.common.renamed_repositories,
},
)
await self._async_store_content_and_repos()
Expand Down Expand Up @@ -127,9 +122,6 @@ async def restore(self):
"""Restore saved data."""
hacs = await async_load_from_store(self.hacs.hass, "hacs")
repositories = await async_load_from_store(self.hacs.hass, "repositories") or {}
self.hacs.common.renamed_repositories = (
await async_load_from_store(self.hacs.hass, "renamed_repositories") or {}
)

if not hacs and not repositories:
# Assume new install
Expand All @@ -142,6 +134,8 @@ async def restore(self):
self.hacs.configuration.frontend_mode = hacs.get("view", "Grid")
self.hacs.configuration.frontend_compact = hacs.get("compact", False)
self.hacs.configuration.onboarding_done = hacs.get("onboarding_done", False)
self.hacs.common.archived_repositories = hacs.get("archived_repositories", [])
self.hacs.common.renamed_repositories = hacs.get("renamed_repositories", {})

# Repositories
hass = self.hacs.hass
Expand Down
3 changes: 3 additions & 0 deletions custom_components/hacs/hacsbase/hacs.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class HacsCommon:
default = []
installed = []
renamed_repositories = {}
archived_repositories = []
skip = []


Expand Down Expand Up @@ -393,6 +394,8 @@ async def async_get_category_repositories(self, category: HacsCategory):
repo = self.common.renamed_repositories[repo]
if is_removed(repo):
continue
if repo in self.common.archived_repositories:
continue
repository = self.get_by_name(repo)
if repository is not None:
if str(repository.data.id) not in self.common.default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ async def common_update_data(
# Make sure the repository is not archived.
if repository.data.archived and not ignore_issues:
repository.validate.errors.append("Repository is archived.")
hacs.common.archived_repositories.append(repository.data.full_name)
raise HacsRepositoryArchivedException("Repository is archived.")

# Make sure the repository is not in the blacklist.
Expand Down