1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00

Deprecate Device.network

This commit is contained in:
thatmattlove
2021-09-24 00:16:26 -07:00
parent 509e8ac3ef
commit 89568dc8e5
16 changed files with 161 additions and 149 deletions

View File

@@ -148,7 +148,7 @@ class Query(BaseModel):
def validate_query_type(cls, value):
"""Ensure a requested query type exists."""
devices = use_state("devices")
if any((device.has_directives(value) for device in devices.objects)):
if any((device.has_directives(value) for device in devices)):
return value
raise QueryTypeNotFound(name=value)
@@ -158,10 +158,8 @@ class Query(BaseModel):
"""Ensure query_location is defined."""
devices = use_state("devices")
valid_id = value in devices.ids
valid_hostname = value in devices.hostnames
if not any((valid_id, valid_hostname)):
if not devices.valid_id_or_name(value):
raise QueryLocationNotFound(location=value)
return value