Просмотр исходного кода

fix #4459 - Fix caching issue resulting in erroneous nested data for regions, rack groups, and tenant groups

John Anderson 5 лет назад
Родитель
Сommit
11ee6f417f
2 измененных файлов с 19 добавлено и 0 удалено
  1. 16 0
      docs/release-notes/version-2.8.md
  2. 3 0
      netbox/netbox/settings.py

+ 16 - 0
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(<model>) for more info.
+>>> Region.objects.rebuild()
+>>> RackGroup.objects.rebuild()
+>>> TenantGroup.objects.rebuild()
+```
+
 ---
 
 ## v2.8.0 (2020-04-13)

+ 3 - 0
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'},
 }