Better fix for OS error on repository reading (#2021)

This commit is contained in:
Pascal Vizeli 2020-09-07 11:50:53 +02:00 committed by GitHub
parent c707934018
commit 6fbec53f8a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,7 +75,12 @@ class StoreData(CoreSysAttributes):
def _read_addons_folder(self, path, repository):
"""Read data from add-ons folder."""
try:
addon_list = path.glob("**/config.json")
# Generate a list without artefact, safe for corruptions
addon_list = [
addon
for addon in path.glob("**/config.json")
if ".git" not in addon.parts
]
except OSError as err:
self.sys_core.healthy = False
_LOGGER.critical(
@ -85,10 +90,6 @@ class StoreData(CoreSysAttributes):
return
for addon in addon_list:
# Ingore git artefacts
if ".git" in addon.parts:
continue
try:
addon_config = read_json_file(addon)
except JsonFileError: