1
0
mirror of https://github.com/ARM-software/workload-automation.git synced 2025-01-31 02:01:16 +00:00

config/core: Fix handling of depreciated parameters

Provide warning to user when attempting to set a depreciated
parameter instead of during validation and only raise the warning
if a value has been explicitly provided.
This commit is contained in:
Marc Bonnici 2020-06-11 11:51:41 +01:00
parent 443358f513
commit f664a00bdc

View File

@ -290,6 +290,9 @@ class ConfigurationPoint(object):
def set_value(self, obj, value=None, check_mandatory=True):
if self.deprecated:
if value is not None:
msg = 'Depreciated parameter supplied for "{}" in "{}". The value will be ignored.'
logger.warning(msg.format(self.name, obj.name))
return
if value is None:
if self.default is not None:
@ -312,11 +315,9 @@ class ConfigurationPoint(object):
setattr(obj, self.name, value)
def validate(self, obj, check_mandatory=True):
value = getattr(obj, self.name, None)
if self.deprecated:
msg = 'Depreciated parameter supplied for "{}" in "{}". The value will be ignored.'
logger.warning(msg.format(self.name, obj.name))
return
value = getattr(obj, self.name, None)
if value is not None:
self.validate_value(obj.name, value)
else: