forked from mirrors/thatmattlove-hyperglass
Fix issue where structured_output: true on a device would cause it to be disabled
This commit is contained in:
parent
1adad7e46d
commit
641f1e1bdd
1 changed files with 9 additions and 9 deletions
|
|
@ -136,19 +136,19 @@ class Device(HyperglassModelWithId, extra="allow"):
|
||||||
def validate_structured_output(cls, value: bool, values: Dict) -> bool:
|
def validate_structured_output(cls, value: bool, values: Dict) -> bool:
|
||||||
"""Validate structured output is supported on the device & set a default."""
|
"""Validate structured output is supported on the device & set a default."""
|
||||||
|
|
||||||
if value is True and values["nos"] not in SUPPORTED_STRUCTURED_OUTPUT:
|
if value is True:
|
||||||
raise ConfigError(
|
if values["nos"] not in SUPPORTED_STRUCTURED_OUTPUT:
|
||||||
"The 'structured_output' field is set to 'true' on device '{d}' with "
|
raise ConfigError(
|
||||||
+ "NOS '{n}', which does not support structured output",
|
"The 'structured_output' field is set to 'true' on device '{d}' with "
|
||||||
d=values["name"],
|
+ "NOS '{n}', which does not support structured output",
|
||||||
n=values["nos"],
|
d=values["name"],
|
||||||
)
|
n=values["nos"],
|
||||||
|
)
|
||||||
|
return value
|
||||||
elif value is None and values["nos"] in SUPPORTED_STRUCTURED_OUTPUT:
|
elif value is None and values["nos"] in SUPPORTED_STRUCTURED_OUTPUT:
|
||||||
value = True
|
value = True
|
||||||
else:
|
else:
|
||||||
value = False
|
value = False
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
@validator("ssl")
|
@validator("ssl")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue