Tenant is not unique by associated groups #6986

Closed
opened 2025-12-29 19:47:29 +01:00 by adam · 4 comments
Owner

Originally created by @abhi1693 on GitHub (Sep 15, 2022).

NetBox version

v3.3.2

Python version

3.10

Steps to Reproduce

  1. Create a tenant with the following info
name = Abhimanyu
slug = abhimanyu
  1. Create a tenant group with the following info
name = Customers
slug = customers
  1. Create a new tenant with the following info
name = Abhimanyu
slug = abhimanyu
group = Customers

Expected Behavior

If a tenant belongs to a different group, then the uniqueness validation should be applied within the scope of the group. It is very well possible to have two or more people with the exact same name

Observed Behavior

Tenant name and slug are validated globally for uniqueness

Originally created by @abhi1693 on GitHub (Sep 15, 2022). ### NetBox version v3.3.2 ### Python version 3.10 ### Steps to Reproduce 1. Create a tenant with the following info ``` name = Abhimanyu slug = abhimanyu ``` 2. Create a tenant group with the following info ``` name = Customers slug = customers ``` 3. Create a new tenant with the following info ``` name = Abhimanyu slug = abhimanyu group = Customers ``` ### Expected Behavior If a tenant belongs to a different group, then the uniqueness validation should be applied within the scope of the group. It is very well possible to have two or more people with the exact same name ### Observed Behavior Tenant name and slug are validated globally for uniqueness
adam closed this issue 2025-12-29 19:47:29 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 15, 2022):

Tenant name and slug are validated globally for uniqueness

This is the intended behavior; there is nothing in the documentation to suggest that tenant names are unique per group (unless I've missed something).

You're welcome to submit a feature request proposing this change, however there are implications of relaxing the uniqueness constraint that need to be discussed. For instance, it would no longer be sufficient to reference a tenant by name only e.g. during CSV import of objects; the user would be required to specify both the name and group in order to adequately identify the a tenant.

@jeremystretch commented on GitHub (Sep 15, 2022): > Tenant name and slug are validated globally for uniqueness This is the intended behavior; there is nothing in the documentation to suggest that tenant names are unique per group (unless I've missed something). You're welcome to submit a feature request proposing this change, however there are implications of relaxing the uniqueness constraint that need to be discussed. For instance, it would no longer be sufficient to reference a tenant by name only e.g. during CSV import of objects; the user would be required to specify both the name and group in order to adequately identify the a tenant.
Author
Owner

@abhi1693 commented on GitHub (Sep 15, 2022):

@jeremystretch The exact same functionality works for Contacts. I can have two users with the same name in different groups.

image

however there are implications of relaxing the uniqueness

It's not relaxing the uniqueness, it's about adding it which is missing.

The reason for opening this as a bug was I felt it was an oversight and probably got missed. Otherwise, how would you add two people with the same names to the system even though they belong to different companies? It's not possible with the current code but the same works when creating a contact.

@abhi1693 commented on GitHub (Sep 15, 2022): @jeremystretch The exact same functionality works for Contacts. I can have two users with the same name in different groups. ![image](https://user-images.githubusercontent.com/5083532/190434445-2817f514-dd8d-48fa-b203-c5290182e21b.png) > however there are implications of relaxing the uniqueness It's not relaxing the uniqueness, it's about adding it which is missing. The reason for opening this as a bug was I felt it was an oversight and probably got missed. Otherwise, how would you add two people with the same names to the system even though they belong to different companies? It's not possible with the current code but the same works when creating a contact.
Author
Owner

@jeremystretch commented on GitHub (Sep 15, 2022):

The exact same functionality works for Contacts.

Yes, and that's how contacts are intended to work. Tenants are not.

It's not relaxing the uniqueness, it's about adding it which is missing.

Your proposal is to relax the uniqueness constraint on Tenant's name field from being globally unique to being unique only per group.

@jeremystretch commented on GitHub (Sep 15, 2022): > The exact same functionality works for Contacts. Yes, and that's how contacts are intended to work. Tenants are not. > It's not relaxing the uniqueness, it's about adding it which is missing. Your proposal is to _relax_ the uniqueness constraint on Tenant's `name` field from being globally unique to being unique only per group.
Author
Owner

@ITJamie commented on GitHub (Sep 15, 2022):

100% for keeping tenant object being unique globally. if this is adjusted to unique per group i hope there is a config option to keep the current default

@ITJamie commented on GitHub (Sep 15, 2022): 100% for keeping tenant object being unique globally. if this is adjusted to unique per group i hope there is a config option to keep the current default
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#6986