Netbox: Region Nesting Display Failure

Created on 7 Apr 2020  路  11Comments  路  Source: netbox-community/netbox

Environment

  • Python version: 3.7.7
  • NetBox version: 2.7.7, 2.7.11 (both)

Steps to Reproduce

  1. Create Canada as a region
  2. Create United States as a region
  3. Create Colorado and California as regions, nested under the United States
  4. Create Ontario and British Columbia as regions nested under Canada
  5. Create New Mexico as a region with NO nesting
  6. Edit New Mexico to be nested under Canada
  7. Edit New Mexico to be nested under United states

Expected Behavior

I expected to see New Mexico nested under United States from the Organizations -> Regions view.

Observed Behavior

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

accepted bug

All 11 comments

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.

  • Site didn't display correctly without user interaction after disabling cache.
  • On move out of United States region (to a different region), then back into United States region, it displayed it's nesting correctly.
  • Subsequent moves/additions to 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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aarjbdea picture aarjbdea  路  3Comments

mrfroggg picture mrfroggg  路  3Comments

Ali-Yazdani picture Ali-Yazdani  路  3Comments

bellwood picture bellwood  路  3Comments

tyler-8 picture tyler-8  路  3Comments