Avoid loading add-on store repositories too early (#5716)

When initially loading the store manager, update_repositories makes
sure that all repositories are actually present. If they are for some
reason corrupted or content is missing, we currently still trying
to load them which leads to an unnecessary warning:

```
2025-03-03 11:55:54.324 WARNING (SyncWorker_1) [supervisor.store.data] No repository information exists at /data/addons/git/a0d7b954
...
2025-03-03 11:55:54.343 INFO (MainThread) [supervisor.store.git] Cloning add-on https://github.com/hassio-addons/repository repository
```

Since update_repositories always loads the data, simply remove the
superfluous earlier loading attempt.

While at it, also improve the cloning/update log messages to make it
clear what repository is cloned/updated.
This commit is contained in:
Stefan Agner 2025-03-03 19:01:47 +01:00 committed by GitHub
parent a7c6699f6a
commit 9a3702bc1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 4 deletions

View File

@ -75,8 +75,6 @@ class StoreManager(CoreSysAttributes, FileConfiguration):
async def load(self) -> None: async def load(self) -> None:
"""Start up add-on management.""" """Start up add-on management."""
await self.data.update()
# Init custom repositories and load add-ons # Init custom repositories and load add-ons
await self.update_repositories( await self.update_repositories(
self._data[ATTR_REPOSITORIES], add_with_errors=True self._data[ATTR_REPOSITORIES], add_with_errors=True

View File

@ -97,7 +97,9 @@ class GitRepo(CoreSysAttributes):
} }
try: try:
_LOGGER.info("Cloning add-on %s repository", self.url) _LOGGER.info(
"Cloning add-on %s repository from %s", self.path, self.url
)
self.repo = await self.sys_run_in_executor( self.repo = await self.sys_run_in_executor(
ft.partial( ft.partial(
git.Repo.clone_from, self.url, str(self.path), **git_args git.Repo.clone_from, self.url, str(self.path), **git_args
@ -128,7 +130,7 @@ class GitRepo(CoreSysAttributes):
return return
async with self.lock: async with self.lock:
_LOGGER.info("Update add-on %s repository", self.url) _LOGGER.info("Update add-on %s repository from %s", self.path, self.url)
try: try:
branch = self.repo.active_branch.name branch = self.repo.active_branch.name