Reset on invalid filesystem
@@ -16,7 +16,7 @@ from ..const import (
)
from ..coresys import CoreSys, CoreSysAttributes
from ..exceptions import JsonFileError
-from ..resolution.const import ContextType, IssueType
+from ..resolution.const import ContextType, IssueType, SuggestionType
from ..utils.json import read_json_file
from .utils import extract_hash_from_path
from .validate import SCHEMA_REPOSITORY_CONFIG
@@ -33,7 +33,7 @@ class StoreData(CoreSysAttributes):
self.repositories: Dict[str, Any] = {}
self.addons: Dict[str, Any] = {}
- def update(self):
+ def update(self) -> None:
"""Read data from add-on repository."""
self.repositories.clear()
self.addons.clear()
@@ -52,7 +52,7 @@ class StoreData(CoreSysAttributes):
if repository_element.is_dir():
self._read_git_repository(repository_element)
- def _read_git_repository(self, path):
+ def _read_git_repository(self, path: Path) -> None:
"""Process a custom repository folder."""
slug = extract_hash_from_path(path)
@@ -73,7 +73,7 @@ class StoreData(CoreSysAttributes):
self.repositories[slug] = repository_info
self._read_addons_folder(path, slug)
- def _read_addons_folder(self, path, repository):
+ def _read_addons_folder(self, path: Path, repository: Dict) -> None:
"""Read data from add-ons folder."""
try:
# Generate a list without artefact, safe for corruptions
@@ -84,7 +84,10 @@ class StoreData(CoreSysAttributes):
]
except OSError as err:
self.sys_resolution.create_issue(
- IssueType.CORRUPT_REPOSITORY, ContextType.SYSTEM
+ IssueType.CORRUPT_REPOSITORY,
+ ContextType.STORE,
+ reference=path.stem,
+ suggestions=[SuggestionType.EXECUTE_RESET],
)
_LOGGER.critical(
"Can't process %s because of Filesystem issues: %s", repository, err
