From 11ee6f417f9739ba1c80b55092ecbd827bf6458b Mon Sep 17 00:00:00 2001 From: John Anderson Date: Wed, 22 Apr 2020 16:45:26 -0400 Subject: [PATCH] fix #4459 - Fix caching issue resulting in erroneous nested data for regions, rack groups, and tenant groups --- docs/release-notes/version-2.8.md | 16 ++++++++++++++++ netbox/netbox/settings.py | 3 +++ 2 files changed, 19 insertions(+) diff --git a/docs/release-notes/version-2.8.md b/docs/release-notes/version-2.8.md index a51f559e9..b80b01e19 100644 --- a/docs/release-notes/version-2.8.md +++ b/docs/release-notes/version-2.8.md @@ -14,10 +14,26 @@ * [#4336](https://github.com/netbox-community/netbox/issues/4336) - Ensure interfaces without a subinterface ID are ordered before subinterface zero * [#4361](https://github.com/netbox-community/netbox/issues/4361) - Fix Type of `connection_state` in Swagger schema * [#4388](https://github.com/netbox-community/netbox/issues/4388) - Fix detection of connected endpoints when connecting rear ports +* [#4459](https://github.com/netbox-community/netbox/issues/4459) - Fix caching issue resulting in erroneous nested data for regions, rack groups, and tenant groups * [#4489](https://github.com/netbox-community/netbox/issues/4489) - Fix display of parent/child role on device type view * [#4496](https://github.com/netbox-community/netbox/issues/4496) - Fix exception when validating certain models via REST API * [#4510](https://github.com/netbox-community/netbox/issues/4510) - Enforce address family for device primary IPv4/v6 addresses +### Notes + +In accordance with the fix in [#4459](https://github.com/netbox-community/netbox/issues/4459), users that are experiencing invalid nested data with +regions, rack groups, or tenant groups can preform a one time operation using the NetBox shell to rebuild the correct nested relationships after upgrading: + +```text +$ python netbox/manage.py nbshell +### NetBox interactive shell (Mac-Pro.local) +### Python 3.6.4 | Django 3.0.5 | NetBox 2.8.1-dev +### lsmodels() will show available models. Use help() for more info. +>>> Region.objects.rebuild() +>>> RackGroup.objects.rebuild() +>>> TenantGroup.objects.rebuild() +``` + --- ## v2.8.0 (2020-04-13) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index ea3852711..7aafd9618 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -479,11 +479,14 @@ CACHEOPS = { 'auth.*': {'ops': ('fetch', 'get')}, 'auth.permission': {'ops': 'all'}, 'circuits.*': {'ops': 'all'}, + 'dcim.region': None, # MPTT models are exempt due to raw sql + 'dcim.rackgroup': None, # MPTT models are exempt due to raw sql 'dcim.*': {'ops': 'all'}, 'ipam.*': {'ops': 'all'}, 'extras.*': {'ops': 'all'}, 'secrets.*': {'ops': 'all'}, 'users.*': {'ops': 'all'}, + 'tenancy.tenantgroup': None, # MPTT models are exempt due to raw sql 'tenancy.*': {'ops': 'all'}, 'virtualization.*': {'ops': 'all'}, }