2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-26 19:40:12 +00:00

Fix clearing validated attributes

Attributes that are validated can come
in as None to clear them, accept this
as valid as well.
This commit is contained in:
Jarrod Johnson 2019-02-27 14:58:26 -05:00
parent 686b59c2b4
commit 99c06813d9

View File

@ -619,7 +619,7 @@ class InputAttributes(ConfluentMessage):
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.get(attr, []):
elif validattrs and 'validlist' in validattrs.get(attr, []) and nodeattr[attr]:
req = nodeattr[attr].split(',')
for v in req:
if v and v not in validattrs[attr]['validlist']:
@ -628,7 +628,7 @@ class InputAttributes(ConfluentMessage):
'{1} (valid values would be {2})'.format(
attr, v, ','.join(
validattrs[attr]['validlist'])))
elif validattrs and 'validlistkeys' in validattrs.get(attr, []):
elif validattrs and 'validlistkeys' in validattrs.get(attr, []) and nodeattr[attr]:
req = nodeattr[attr].split(',')
for v in req:
if '=' not in v: