1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 12:59:34 +00:00

Make the check_config script open issue_registry read only (#98545)

* Don't blow up if validators can't access the issue registry

* Make the check_config script open issue_registry read only

* Update tests/helpers/test_issue_registry.py

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

---------

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
Erik Montnemery
2023-08-18 20:15:00 +02:00
committed by GitHub
parent 90b9764578
commit 7fcc2dd44e
6 changed files with 115 additions and 4 deletions

View File

@@ -93,6 +93,7 @@ class Store(Generic[_T]):
atomic_writes: bool = False,
encoder: type[JSONEncoder] | None = None,
minor_version: int = 1,
read_only: bool = False,
) -> None:
"""Initialize storage class."""
self.version = version
@@ -107,6 +108,7 @@ class Store(Generic[_T]):
self._load_task: asyncio.Future[_T | None] | None = None
self._encoder = encoder
self._atomic_writes = atomic_writes
self._read_only = read_only
@property
def path(self):
@@ -344,6 +346,9 @@ class Store(Generic[_T]):
self._data = None
if self._read_only:
return
try:
await self._async_write_data(self.path, data)
except (json_util.SerializationError, WriteError) as err: