Improve `restricted_parameters` validator to cover None case
Validator raised the following error in case of None as target AttributeError: 'NoneType' object has no attribute 'get' Change-Id: I23b7231ccf2f9e6982612fc7733375190ab7fc98
This commit is contained in:
parent
166435fb4f
commit
9708b288df
|
@ -294,10 +294,10 @@ class RestrictedParametersValidator(validation.Validator):
|
|||
def validate(self, context, config, plugin_cls, plugin_cfg):
|
||||
restricted_params = []
|
||||
for param_name in self.params:
|
||||
args = config.get("args", {})
|
||||
a_dict, a_key = (args, self.subdict) if self.subdict else (
|
||||
config, "args")
|
||||
if param_name in a_dict.get(a_key, {}):
|
||||
source = config.get("args", {})
|
||||
if self.subdict:
|
||||
source = source.get(self.subdict) or {}
|
||||
if param_name in source:
|
||||
restricted_params.append(param_name)
|
||||
if restricted_params:
|
||||
self.fail("You can't specify parameters '%s' in '%s'" % (
|
||||
|
|
Loading…
Reference in New Issue