Canada as a regionUnited States as a regionColorado and California as regions, nested under the United StatesOntario and British Columbia as regions nested under CanadaNew Mexico as a region with NO nestingNew Mexico to be nested under CanadaNew Mexico to be nested under United statesI expected to see New Mexico nested under United States from the Organizations -> Regions view.
New Mexico doesn't show as nested under United States from the Organizations -> Regions view. All other attempts to nest regions under United States fail - weather from initial Region object creation, or attempts to move an existing region object into United States
Note - you can see a video of this behavior here: https://youtu.be/nXfYlhJeUyY
I think this might actually be an upstream issue. I will have to dig into it more, but I can replicate this as well as another bug.
Some more testing, on develop I am unable to reproduce this. Going to keep this open until we release 2.7.12 and see if it is resolved. Not sure of the actual cause of this.
To be clear, do not upgrade to develop, please wait for it to be released.
Confirmed. Thanks Dan!
@PhillSimonds Could you try with Caching disabled? It looks like it could potentially be a caching issue
@DanSheps can you confirm how I would go about doing so? I'm seeing a way to invalidate the cache from docs but don't see a way to disable completely... maybe just missing it?
In your configuration.py, set CACHE_TIMEOUT to 0 (defaults to 900 normally) and restart
Confirmed. That looks like it worked.
United States region (to a different region), then back into United States region, it displayed it's nesting correctly.United States region show proper nesting with cache disabled.Awesome, thanks
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. NetBox is governed by a small group of core maintainers which means not all opened issues may receive direct feedback. Please see our contributing guide.
Okay, so the root cause of this is caching of get ops on the Region model internal to tree rebalancing. So the parent field is being properly set on an update but the result of the rebalance is incorrect due to erroneous get results from the cache.
The fix for this is easy, we just need to except get ops from the region model, and all MPTT models for that matter.
'dcim.region': {'ops': {'list'}},
'dcim.*': {'ops': 'all'},
After further digging, we decided to simply exempt MPTT models from all caching due to their reliance on raw sql for tree rebalancing. This pertains to regions, rack groups, and tenant groups currently.