Skip to content

Commit

Permalink
Add DOMAIN_OVERRIDES workaround (#2468)
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeeus committed Jan 23, 2022
1 parent 1902734 commit ec78d32
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
9 changes: 7 additions & 2 deletions custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
version_left_higher_then_right,
version_to_download,
)
from ..utils.workarounds import DOMAIN_OVERRIDES

if TYPE_CHECKING:
from ..base import HacsBase
Expand Down Expand Up @@ -725,8 +726,12 @@ async def remove_local_directory(self) -> None:
local_path = self.content.path.local
elif self.data.category == "integration":
if not self.data.domain:
self.logger.error("%s Missing domain", self)
return False
if domain := DOMAIN_OVERRIDES.get(self.data.full_name):
self.data.domain = domain
self.content.path.local = self.localpath
else:
self.logger.error("%s Missing domain", self)
return False
local_path = self.content.path.local
else:
local_path = self.content.path.local
Expand Down
7 changes: 7 additions & 0 deletions custom_components/hacs/utils/workarounds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Workarounds for issues that should not be fixed."""


DOMAIN_OVERRIDES = {
# https://github.com/hacs/integration/issues/2465
"custom-components/sensor.custom_aftership": "custom_aftership"
}
6 changes: 6 additions & 0 deletions tests/utils/test_workarounds.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from custom_components.hacs.utils.workarounds import DOMAIN_OVERRIDES


def test_domain_ovverides() -> None:
assert DOMAIN_OVERRIDES.get("custom-components/sensor.custom_aftership") == "custom_aftership"
assert DOMAIN_OVERRIDES.get("awesome/repo") is None

0 comments on commit ec78d32

Please sign in to comment.