Something weird happening with regions (Netbox 3.6.6) #14601
-
I was merging data from an old netbox into a new one and uploaded a bunch of regions. Then I noticed that the left/right data was all wrong for the regions. The workaround was to rebuild the tree using "Region._tree_manager.rebuild()" inside of nbshell. I didn't see an exposed method for doing this with manage.py. I didn't submit a bug because I wasn't sure how I triggered it and if it would happen again. Today I was working on moving regions around again and the same thing happened. This time I was only working in the GUI, so I know it wasn't a script that caused the problem. Now the question is, maybe my database is corrupted in some minor way that is causing this to happen but not causing other issues, or is this a legit bug that doesn't get seen much because most people don't touch regions very often after creating them. How to reproduce? I moved some sites between regions, and I moved some regions under another region. I multi-selected several regions and put them all under another region. I tried to simulate this on the demo netbox and couldn't get it to happen. I don't know if that is because it's running an older version that isn't broken, or if I wasn't doing things in the right sequence, or if the problem is unique to my instance. A look at "git log v3.5.9..v3.6.6 | grep -i mptt" shows their has been a couple of changes to mptt, the library used for the Regions tree, since 3.5.9, but I don't know if any of them touched regions specifically. If nobody else is experiencing this I'll defer trying to figure it out until later. It would be nice if I could get a test instance setup and figure out the steps to replicate, then try it on older versions, but I don't have time right now. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
When you view each individual region, does it show the correct immediate parent? For instance, does Bartlett TN show TN as its parent in the "Region" panel? (Ignore the breadcrumbs at top.) If these are all still correct, it's probably safe to assume this is an MPTT issue. Also, were you able to resolve this again by rebuilding the tree with |
Beta Was this translation helpful? Give feedback.
When you view each individual region, does it show the correct immediate parent? For instance, does Bartlett TN show TN as its parent in the "Region" panel? (Ignore the breadcrumbs at top.) If these are all still correct, it's probably safe to assume this is an MPTT issue.
Also, were you able to resolve this again by rebuilding the tree with
Region.objects.rebuild()
?