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

Wont import racks with same name in different rows/locations #6

Open
dionrowney opened this issue Sep 13, 2022 · 2 comments
Open

Wont import racks with same name in different rows/locations #6

dionrowney opened this issue Sep 13, 2022 · 2 comments

Comments

@dionrowney
Copy link

dionrowney commented Sep 13, 2022

We have Rack-1 in Row-1 and Row-2 and the same in different datacenters.

It seems to puke on Rack names that are already imported with the same name.

2022-09-13 10:28:35,601 - rt2nb - DEBUG - {'name': 'RACK-2', 'site': 428, 'comments': 'ROW 1', 'custom_fields': {'rt_id': '1382'}, 'tags': [], 'u_height': 40, 'location': 471}
2022-09-13 10:28:35,602 - rt2nb - INFO - checking for existing rack in netbox: https://hostname.usask.ca/api/dcim/racks/?name=RACK-2
2022-09-13 10:28:35,602 - rt2nb - DEBUG - HTTP Request: GET - https://hostname.usask.ca/api/dcim/racks/?name=RACK-2
2022-09-13 10:28:35,795 - rt2nb - DEBUG - HTTP Response: 200 - OK
Traceback (most recent call last):
File ".\racktables2netbox.py", line 3814, in
racktables.get_infrastructure()
File ".\racktables2netbox.py", line 2127, in get_infrastructure
netbox.post_rack(netbox_rack)
File ".\racktables2netbox.py", line 257, in post_rack
if exists[0]:
TypeError: 'bool' object is not subscriptable

Is the a work around or do i have to change source Rack names in my 50 rooms to be distinct?

@ITJamie
Copy link
Owner

ITJamie commented Sep 18, 2022

i can try and fix this in future, but for now you would be best to just temporarily re-name racks in your RT instance to get your migration done, there is a good chance you will end up renaming them in netbox post migration anyways once you figure out how you want to show data in netbox

@dionrowney
Copy link
Author

I was able to take the locatiojn, row and rack names and combine them in your code for testing. I may also add a random number to the end of the name in rack tables like you suggested (I have 100+ racks) with duplicate names (RACK-1 in location X) etc

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

2 participants