From 9aa9e1ef9ae801b6aea662c69171a3c35d882e25 Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Tue, 11 Jan 2022 12:15:49 +0000 Subject: [PATCH 1/2] Foce data update on installation --- custom_components/hacs/repositories/base.py | 8 ++++++-- tests/common.py | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/custom_components/hacs/repositories/base.py b/custom_components/hacs/repositories/base.py index 031f02780d3..f0c9fb767da 100644 --- a/custom_components/hacs/repositories/base.py +++ b/custom_components/hacs/repositories/base.py @@ -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") @@ -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() @@ -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: diff --git a/tests/common.py b/tests/common.py index 50f49547bad..6d466710270 100644 --- a/tests/common.py +++ b/tests/common.py @@ -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 From 7e4fc884a20f58b04680ec64a23cf292ca290d26 Mon Sep 17 00:00:00 2001 From: Ludeeus Date: Tue, 11 Jan 2022 12:47:01 +0000 Subject: [PATCH 2/2] check for queue --- custom_components/hacs/utils/decorator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/custom_components/hacs/utils/decorator.py b/custom_components/hacs/utils/decorator.py index 22a3c690dc0..64d622b0588 100644 --- a/custom_components/hacs/utils/decorator.py +++ b/custom_components/hacs/utils/decorator.py @@ -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__ ):