Skip to content

Commit

Permalink
Fixes #1977: Don't default master vc_position to 1 when creating a ne…
Browse files Browse the repository at this point in the history
…w virtual chassis
  • Loading branch information
jeremystretch committed Jul 18, 2018
1 parent 00d2181 commit 29d9b32
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions netbox/dcim/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,8 @@ def assign_virtualchassis_master(instance, created, **kwargs):
"""
When a VirtualChassis is created, automatically assign its master device to the VC.
"""
# Default to 1 but don't overwrite an existing position (see #2087)
if instance.master.vc_position is not None:
vc_position = instance.master.vc_position
else:
vc_position = 1
if created:
Device.objects.filter(pk=instance.master.pk).update(virtual_chassis=instance, vc_position=vc_position)
Device.objects.filter(pk=instance.master.pk).update(virtual_chassis=instance, vc_position=None)


@receiver(pre_delete, sender=VirtualChassis)
Expand Down

0 comments on commit 29d9b32

Please sign in to comment.