1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

fix status validation

This commit is contained in:
Viranch Mehta
2021-09-21 02:14:07 -07:00
parent ee517587a9
commit f2164f3a92

View File

@@ -566,14 +566,6 @@ class _DynamicMixin(object):
reasons.append(f'invalid weight "{weight}" in ' reasons.append(f'invalid weight "{weight}" in '
f'pool "{_id}" value {value_num}') f'pool "{_id}" value {value_num}')
try:
value = value['value']
reasons.extend(cls._value_type.validate(value,
cls._type))
except KeyError:
reasons.append(f'missing value in pool "{_id}" '
f'value {value_num}')
try: try:
status = value['status'] status = value['status']
if status not in ['up', 'down', 'obey']: if status not in ['up', 'down', 'obey']:
@@ -582,6 +574,14 @@ class _DynamicMixin(object):
except KeyError: except KeyError:
pass pass
try:
value = value['value']
reasons.extend(cls._value_type.validate(value,
cls._type))
except KeyError:
reasons.append(f'missing value in pool "{_id}" '
f'value {value_num}')
if len(values) == 1 and values[0].get('weight', 1) != 1: if len(values) == 1 and values[0].get('weight', 1) != 1:
reasons.append(f'pool "{_id}" has single value with ' reasons.append(f'pool "{_id}" has single value with '
'weight!=1') 'weight!=1')