From e264fa82b2ea81aa179e266fbba5e84e5519ef16 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Mon, 25 Jul 2022 12:26:47 -0400 Subject: [PATCH] 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 --- moonraker/confighelper.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/moonraker/confighelper.py b/moonraker/confighelper.py index 54a1c31..1b78295 100644 --- a/moonraker/confighelper.py +++ b/moonraker/confighelper.py @@ -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,