mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-13 16:29:49 +08:00
fix: conf variable needn't be registered in DEFAULTS to be able to use _setifok_ handler
This commit is contained in:
@@ -220,7 +220,7 @@ class Config(object):
|
||||
|
||||
# registered defaults
|
||||
if key in self._defaults_by_name:
|
||||
# customized check & set first
|
||||
# customized check & set if there's a corresponding handler
|
||||
setifok_func = '_setifok_{}'.format(key)
|
||||
if hasattr(self, setifok_func):
|
||||
getattr(self, setifok_func)(value)
|
||||
@@ -241,7 +241,13 @@ class Config(object):
|
||||
raise Exception("Unsupported type %s for configuration item name: %s" % (convert, key))
|
||||
# passthrough for uncontrolled configuration items
|
||||
else:
|
||||
setattr(self, key, value)
|
||||
# customized check & set if there's a corresponding handler
|
||||
setifok_func = '_setifok_{}'.format(key)
|
||||
if hasattr(self, setifok_func):
|
||||
getattr(self, setifok_func)(value)
|
||||
# otherwise just blindly set value for a key
|
||||
else:
|
||||
setattr(self, key, value)
|
||||
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user