Ignore VC member interfaces where mgmt_only=True

This commit is contained in:
Jeremy Stretch
2017-12-18 16:44:44 -05:00
parent d41f4d2db3
commit 022c360964
2 changed files with 5 additions and 9 deletions

View File

@@ -1047,10 +1047,10 @@ class Device(CreatedUpdatedModel, CustomFieldModel):
Return a QuerySet matching all Interfaces assigned to this Device or, if this Device is a VC master, to another
Device belonging to the same virtual chassis.
"""
filter = Q(device=self)
if hasattr(self, 'vc_membership') and self.vc_membership.is_master:
return Interface.objects.filter(device__vc_membership__virtual_chassis=self.vc_membership.virtual_chassis)
else:
return self.interfaces.all()
filter |= Q(device__vc_membership__virtual_chassis=self.vc_membership.virtual_chassis, mgmt_only=False)
return Interface.objects.filter(filter)
def get_children(self):
"""