confighelper: don't overwrite option tracking

Its possible for any component to request a configuration
option from another component.  Don't overwrite the
inital value stored.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan committed 2022-07-26 19:34:40 -04:00
1 parent a178a6cd01
commit e264fa82b2
1 file changed
+9 -8
+9 -8
View File
@@ -151,14 +151,15 @@ class ConfigHelper:
f"configuration, see {help} for detailed documentation."
)
self._check_option(option, val, above, below, minval, maxval)
if (
val is None or
isinstance(val, (int, float, bool, str, dict, list))
):
self.parsed[section][option] = val
else:
# If the item cannot be encoded to json serialize to a string
self.parsed[section][option] = str(val)
if option not in self.parsed[section]:
if (
val is None or
isinstance(val, (int, float, bool, str, dict, list))
):
self.parsed[section][option] = val
else:
# If the item cannot be encoded to json serialize to a string
self.parsed[section][option] = str(val)
return val
def _check_option(self,