mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-23 01:53:28 +00:00
Fix checking code with custom fields
For custom fields, do not cause an unexpected errors. The lookup on the validattrs will now default to nothing found instead of error.
This commit is contained in:
parent
d979d29b0b
commit
e23253815c
@ -613,12 +613,12 @@ class InputAttributes(ConfluentMessage):
|
||||
# an expression string will error if format() done
|
||||
# use that as cue to put it into config as an expr
|
||||
nodeattr[attr] = {'expression': nodeattr[attr]}
|
||||
if validattrs and 'validvalues' in validattrs[attr]:
|
||||
if validattrs and 'validvalues' in validattrs.get(attr, []):
|
||||
if nodeattr[attr] not in validattrs[attr]['validvalues']:
|
||||
raise exc.InvalidArgumentException(
|
||||
'Attribute {0} does not accept value {1} (valid values would be {2})'.format(
|
||||
attr, nodeattr[attr], ','.join(validattrs[attr]['validvalues'])))
|
||||
elif validattrs and 'validlist' in validattrs[attr]:
|
||||
elif validattrs and 'validlist' in validattrs.get(attr, []):
|
||||
req = nodeattr[attr].split(',')
|
||||
for v in req:
|
||||
if v not in validattrs[attr]['validlist']:
|
||||
@ -627,7 +627,7 @@ class InputAttributes(ConfluentMessage):
|
||||
'{1} (valid values would be {2})'.format(
|
||||
attr, v, ','.join(
|
||||
validattrs[attr]['validlist'])))
|
||||
elif validattrs and 'validlistkeys' in validattrs[attr]:
|
||||
elif validattrs and 'validlistkeys' in validattrs.get(attr, []):
|
||||
req = nodeattr[attr].split(',')
|
||||
for v in req:
|
||||
if '=' not in v:
|
||||
|
Loading…
Reference in New Issue
Block a user