From 133d6bfcb3b732c7b42836d5914c1e11781fa021 Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 7 Mar 2024 11:55:35 -0800 Subject: [PATCH] 9856 fix virtualization FK --- netbox/virtualization/graphql/types.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/netbox/virtualization/graphql/types.py b/netbox/virtualization/graphql/types.py index 08ea36b4c..447e79db4 100644 --- a/netbox/virtualization/graphql/types.py +++ b/netbox/virtualization/graphql/types.py @@ -3,7 +3,6 @@ from typing import Annotated, List import strawberry import strawberry_django -from dcim.graphql.types import ComponentType from extras.graphql.mixins import ConfigContextMixin from ipam.graphql.mixins import IPAddressesMixin, VLANGroupsMixin from netbox.graphql.scalars import BigInt @@ -21,6 +20,15 @@ __all__ = ( ) +@strawberry.type +class ComponentType(NetBoxObjectType): + """ + Base type for device/VM components + """ + _name: str + virtual_machine: Annotated["VirtualMachineType", strawberry.lazy('virtualization.graphql.types')] + + @strawberry_django.type( models.Cluster, fields='__all__', @@ -114,7 +122,6 @@ class VMInterfaceType(IPAddressesMixin, ComponentType): mac_address: str | None parent: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None bridge: Annotated["VMInterfaceType", strawberry.lazy('virtualization.graphql.types')] | None - virtual_machine: Annotated["VirtualMachineType", strawberry.lazy('virtualization.graphql.types')] untagged_vlan: Annotated["VLANType", strawberry.lazy('ipam.graphql.types')] | None vrf: Annotated["VRFType", strawberry.lazy('ipam.graphql.types')] | None @@ -141,4 +148,4 @@ class VMInterfaceType(IPAddressesMixin, ComponentType): filters=VirtualDiskFilter ) class VirtualDiskType(ComponentType): - virtual_machine: Annotated["VirtualMachineType", strawberry.lazy('virtualization.graphql.types')] + pass