Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate device name, different site triggers uniqueness error #4415

Closed
DanSheps opened this issue Mar 27, 2020 · 0 comments
Closed

Duplicate device name, different site triggers uniqueness error #4415

DanSheps opened this issue Mar 27, 2020 · 0 comments
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application

Comments

@DanSheps
Copy link
Member

DanSheps commented Mar 27, 2020

Environment

  • Python version: 3.6
  • NetBox version: 2.7.10

Steps to Reproduce

  1. Create two sites S1 & S2
  2. Create a device, D1 in site S1
  3. Create a device D1 in site S2

Expected Behavior

Create D1 in S2 successfully

Observed Behavior

Validation Error: "A device with this name already exists"

Reason

In validate_unique() on the device model, we are suppose to be looking for a device assigned to the same site with no tenant. However, we are not setting the site and instead only looking for a duplicate name.

Fix

1393 -            if Device.objects.exclude(pk=self.pk).filter(name=self.name, tenant__isnull=True):
1393 +            if Device.objects.exclude(pk=self.pk).filter(name=self.name, site=self.site, tenant__isnull=True):
@DanSheps DanSheps changed the title Duplicate name, different site triggers uniqueness error Duplicate device name, different site triggers uniqueness error Mar 27, 2020
@DanSheps DanSheps added status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application labels Mar 27, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status: accepted This issue has been accepted for implementation type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

1 participant