Skip to content

Commit 5682809

Browse files
committed
enforce config validation (don't allow changes after it has been
validated Signed-off-by: Zen <[email protected]>
1 parent 53fbb24 commit 5682809

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/ugrd/initramfs_dict.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "2.1.0"
2+
__version__ = "2.2.0"
33

44
from tomllib import load, TOMLDecodeError
55
from pathlib import Path
@@ -55,6 +55,8 @@ def import_args(self, args: dict) -> None:
5555
self[arg] = value
5656

5757
def __setitem__(self, key: str, value) -> None:
58+
if self['validated']:
59+
return self.logger.error("[%s] Config is validatied, refusing to set value: %s" % (key, value))
5860
# If the type is registered, use the appropriate update function
5961
if any(key in d for d in (self.builtin_parameters, self['custom_parameters'])):
6062
return self.handle_parameter(key, value)

0 commit comments

Comments
 (0)