aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside-tools/deploy_lib/config.py
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside-tools/deploy_lib/config.py')
-rw-r--r--sources/pyside-tools/deploy_lib/config.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/sources/pyside-tools/deploy_lib/config.py b/sources/pyside-tools/deploy_lib/config.py
index 5d5070bef..a26f1a2cf 100644
--- a/sources/pyside-tools/deploy_lib/config.py
+++ b/sources/pyside-tools/deploy_lib/config.py
@@ -142,19 +142,20 @@ class Config(BaseConfig):
def set_or_fetch(self, config_property_val, config_property_key, config_property_group="app"):
"""
- Write to config_file if 'config_property_key' is known without config_file
- Fetch and return from config_file if 'config_property_key' is unknown, but
- config_file exists
+ If the value corresponding to the key exists in the config file, then return it.
+ Otherwise, set the value to the config file and return it.
Otherwise, raise an exception
"""
- if config_property_val:
+ existing_value = self.get_value(config_property_group, config_property_key)
+ if existing_value:
+ return existing_value
+ elif config_property_val:
self.set_value(config_property_group, config_property_key, str(config_property_val))
return config_property_val
- elif self.get_value(config_property_group, config_property_key):
- return self.get_value(config_property_group, config_property_key)
else:
raise RuntimeError(
- f"[DEPLOY] No {config_property_key} specified in config file or as cli option"
+ f"[DEPLOY] No value for {config_property_key} specified in config file or as cli"
+ " option"
)
@property