Skip to content

Update or Create devices is pulling location name and doesn't work with duplicate named locations. #360

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

Open
zackt25 opened this issue Apr 16, 2025 · 1 comment

Comments

@zackt25
Copy link
Contributor

zackt25 commented Apr 16, 2025

Environment

  • Python version: 3.11
  • Nautobot version: 2.4.5
  • nautobot-device-onboarding version: 4.2.3

Expected Behavior

Device is onboarded in the location that was sent in the csv file.

Observed Behavior

If there is 2 locations with same name and same name parent it will error out saying that there are 2 locations when trying to update the location.

Instead of finding the location__name maybe switch it to use the PK or UUID of the location and not the name.

This would require everyone put the UUID in the csv and not the name though.

        onboarding_device = self.device(
                adapter=self,
                pk=device.pk,
                device_type__model=device.device_type.model,
                location__name=device.location.name,   <<<<<<<<<<<<<<
                name=device.name,
                platform__name=device.platform.name if device.platform else "",
                primary_ip4__host=device.primary_ip4.host if device.primary_ip4 else "",
                primary_ip4__status__name=(device.primary_ip4.status.name if device.primary_ip4 else ""),
                role__name=device.role.name,
                status__name=device.status.name,
                secrets_group__name=(device.secrets_group.name if device.secrets_group else ""),
                interfaces=interfaces,
                mask_length=(device.primary_ip4.mask_length if device.primary_ip4 else None),
                serial=device.serial,
            )

Steps to Reproduce

  1. Create 2 locations that is top level of 1 different name. So State (TX and NY).
  2. Create 2 locations that are top level 2 same name but assign to TX and NY. So City (Dallas)
  3. Create 2 locations that are top level 3 same name but assign to Dallas:TX and Dallas:NY
  4. Run the onboarding app with the csv file with Dallas as location and TX as it's parent.
  5. It will fail due to finding 2 Dallas locations.
@zackt25
Copy link
Contributor Author

zackt25 commented Apr 16, 2025

I will try to work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant