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

Clear data of double renamed repositories #2326

Merged
merged 3 commits into from
Dec 4, 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
11 changes: 9 additions & 2 deletions custom_components/hacs/hacsbase/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,14 @@ async def restore(self):
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", {})
self.hacs.common.renamed_repositories = {}

# Clear out doubble renamed values
renamed = hacs.get("renamed_repositories", {})
for entry in renamed:
value = renamed.get(entry)
if value not in renamed:
self.hacs.common.renamed_repositories[entry] = value

hass = self.hacs.hass
stores = {}
Expand All @@ -143,7 +150,7 @@ async def restore(self):
for entry, repo_data in repositories.items():
if entry == "0":
# Ignore repositories with ID 0
self.logger.error("Found repository with ID %s - %s", entry, repo_data)
self.logger.debug("Found repository with ID %s - %s", entry, repo_data)
continue
if self.async_restore_repository(entry, repo_data):
stores[entry] = get_store_for_key(hass, f"hacs/{entry}.hacs")
Expand Down
3 changes: 2 additions & 1 deletion custom_components/hacs/sensor.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
"""Sensor platform for HACS."""
from __future__ import annotations

from awesomeversion import AwesomeVersion
from homeassistant.core import callback
from homeassistant.components.sensor import SensorEntity
from homeassistant.core import callback

from custom_components.hacs.const import DOMAIN, NAME_SHORT
from custom_components.hacs.mixin import HacsMixin
Expand Down