database: read out all namespaces on init

If a namespace contains an invalid key reading out the namespace should correct the issue.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2021-06-13 11:03:52 -04:00
parent c9a958f861
commit 42bdb42573
1 changed files with 3 additions and 0 deletions

View File

@ -89,6 +89,9 @@ class MoonrakerDatabase:
txn.put(b'database_version',
self._encode_value(DATABASE_VERSION),
db=mrdb)
# Read out all namespaces to remove any invalid keys on init
for ns in self.namespaces.keys():
self._get_namespace(ns)
# Protected Namespaces have read-only API access. Write access can
# be granted by enabling the debug option. Forbidden namespaces
# have no API access. This cannot be overridden.