mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-21 16:16:31 +00:00
Handle corrupt store branch / ignore local reset on corruption (#2490)
* Handle corrupt store branch / ignore local reset on corruption * Update data.py * Update data.py
This commit is contained in:
parent
b09aee7644
commit
17f62b6e86
@ -18,6 +18,7 @@ from ..coresys import CoreSys, CoreSysAttributes
|
|||||||
from ..exceptions import JsonFileError
|
from ..exceptions import JsonFileError
|
||||||
from ..resolution.const import ContextType, IssueType, SuggestionType
|
from ..resolution.const import ContextType, IssueType, SuggestionType
|
||||||
from ..utils.json import read_json_file
|
from ..utils.json import read_json_file
|
||||||
|
from .const import StoreType
|
||||||
from .utils import extract_hash_from_path
|
from .utils import extract_hash_from_path
|
||||||
from .validate import SCHEMA_REPOSITORY_CONFIG
|
from .validate import SCHEMA_REPOSITORY_CONFIG
|
||||||
|
|
||||||
@ -83,11 +84,14 @@ class StoreData(CoreSysAttributes):
|
|||||||
if ".git" not in addon.parts
|
if ".git" not in addon.parts
|
||||||
]
|
]
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
|
suggestion = None
|
||||||
|
if path.stem != StoreType.LOCAL:
|
||||||
|
suggestion = [SuggestionType.EXECUTE_RESET]
|
||||||
self.sys_resolution.create_issue(
|
self.sys_resolution.create_issue(
|
||||||
IssueType.CORRUPT_REPOSITORY,
|
IssueType.CORRUPT_REPOSITORY,
|
||||||
ContextType.STORE,
|
ContextType.STORE,
|
||||||
reference=path.stem,
|
reference=path.stem,
|
||||||
suggestions=[SuggestionType.EXECUTE_RESET],
|
suggestions=suggestion,
|
||||||
)
|
)
|
||||||
_LOGGER.critical(
|
_LOGGER.critical(
|
||||||
"Can't process %s because of Filesystem issues: %s", repository, err
|
"Can't process %s because of Filesystem issues: %s", repository, err
|
||||||
|
@ -147,9 +147,10 @@ class GitRepo(CoreSysAttributes):
|
|||||||
|
|
||||||
async with self.lock:
|
async with self.lock:
|
||||||
_LOGGER.info("Update add-on %s repository", self.url)
|
_LOGGER.info("Update add-on %s repository", self.url)
|
||||||
branch = self.repo.active_branch.name
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
branch = self.repo.active_branch.name
|
||||||
|
|
||||||
# Download data
|
# Download data
|
||||||
await self.sys_run_in_executor(
|
await self.sys_run_in_executor(
|
||||||
ft.partial(
|
ft.partial(
|
||||||
@ -182,6 +183,7 @@ class GitRepo(CoreSysAttributes):
|
|||||||
git.InvalidGitRepositoryError,
|
git.InvalidGitRepositoryError,
|
||||||
git.NoSuchPathError,
|
git.NoSuchPathError,
|
||||||
git.GitCommandError,
|
git.GitCommandError,
|
||||||
|
ValueError,
|
||||||
) as err:
|
) as err:
|
||||||
_LOGGER.error("Can't update %s repo: %s.", self.url, err)
|
_LOGGER.error("Can't update %s repo: %s.", self.url, err)
|
||||||
self.sys_resolution.create_issue(
|
self.sys_resolution.create_issue(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user