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

Crash when device name is a number greater thant an integer. #747

Closed
Mmoi-Fr opened this issue Dec 19, 2016 · 1 comment
Closed

Crash when device name is a number greater thant an integer. #747

Mmoi-Fr opened this issue Dec 19, 2016 · 1 comment
Labels
type: bug A confirmed report of unexpected behavior in the application

Comments

@Mmoi-Fr
Copy link

Mmoi-Fr commented Dec 19, 2016

Hi,

I got an error after I added the device named "N010025001001".

When I try to see the devices from the city where that device is, I get a "Django.utils" error saying that the name exceed the integer limits.

The only way to correct this was to delete the device in postgres itself...

Could you check it out?

Thx

@jeremystretch jeremystretch added the type: bug A confirmed report of unexpected behavior in the application label Dec 19, 2016
@jeremystretch
Copy link
Member

This was due to the way we implement natural ordering for device names. This ensures that, for example, a device named router30 shows up between router1 and router100. We do this by casting the trailing numeric portion as an integer and sorting on it separately.

In this case, NetBox was attempting to cast the number 10025001001 as an integer, which is too big to fit the type (the maximum value of a signed four-byte integer is 2147483647). I've adjusted the regex to match only up to nine digits, which ensures that the captured value can be converted to an integer. This approach can likely be improved, but be should be sufficient in the short term.

lampwins pushed a commit to lampwins/netbox that referenced this issue Oct 13, 2017
@lock lock bot locked as resolved and limited conversation to collaborators Jan 19, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug A confirmed report of unexpected behavior in the application
Projects
None yet
Development

No branches or pull requests

2 participants