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

Force data update on installation #2443

Merged
merged 3 commits into from
Jan 11, 2022
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
8 changes: 6 additions & 2 deletions custom_components/hacs/repositories/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,7 +602,8 @@ def cleanup_temp_dir():
async def download_content(self) -> None:
"""Download the content of a directory."""
contents = self.gather_files_to_download()
self.logger.debug(self.data.filename)
if self.data.filename:
self.logger.debug(self.data.filename)
if not contents:
raise HacsException("No content to download")

Expand Down Expand Up @@ -810,7 +811,7 @@ async def _async_post_install(self) -> None:
async def async_install_repository(self) -> None:
"""Common installation steps of the repository."""
persistent_directory = None
await self.update_repository()
await self.update_repository(force=True)
if self.content.path.local is None:
raise HacsException("repository.content.path.local is None")
self.validate.errors.clear()
Expand Down Expand Up @@ -841,6 +842,9 @@ async def async_install_repository(self) -> None:
backup = Backup(hacs=self.hacs, local_path=self.content.path.local)
await self.hacs.hass.async_add_executor_job(backup.create)

self.hacs.log.debug("%s Local path is set to %s", self, self.content.path.local)
self.hacs.log.debug("%s Remote path is set to %s", self, self.content.path.remote)

if self.data.zip_release and version != self.data.default_branch:
await self.download_zip_files(self.validate)
else:
Expand Down
1 change: 1 addition & 0 deletions custom_components/hacs/utils/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ async def wrapper(*args, **kwargs) -> None:
await function(*args, **kwargs)
if (
hacs is None
or hacs.queue is None
or hacs.queue.has_pending_tasks
or "update" not in function.__name__
):
Expand Down
2 changes: 1 addition & 1 deletion tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def dummy_repository_base(hacs, repository=None):
repository.data.published_tags = ["1", "2", "3"]
repository.data.update_data(fixture("repository_data.json", asjson=True))

async def update_repository():
async def update_repository(*args, **kwargs):
pass

repository.update_repository = update_repository
Expand Down