Skip to content

Commit

Permalink
Force data update on installation (#2443)
Browse files Browse the repository at this point in the history
* Foce data update on installation

* check for queue
  • Loading branch information
ludeeus authored Jan 11, 2022
1 parent 8bddb9d commit cc42c87
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
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

0 comments on commit cc42c87

Please sign in to comment.