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

Merge branch 'develop' into feature

jeremystretch 3 лет назад
Родитель
Сommit
0280ddcbe9

+ 1 - 1
docs/configuration/system.md

@@ -58,7 +58,7 @@ Email is sent from NetBox only for critical events or if configured for [logging
 
 Default: None
 
-A dictionary of HTTP proxies to use for outbound requests originating from NetBox (e.g. when sending webhook requests). Proxies should be specified by schema (HTTP and HTTPS) as per the [Python requests library documentation](https://2.python-requests.org/en/master/user/advanced/). For example:
+A dictionary of HTTP proxies to use for outbound requests originating from NetBox (e.g. when sending webhook requests). Proxies should be specified by schema (HTTP and HTTPS) as per the [Python requests library documentation](https://requests.readthedocs.io/en/latest/user/advanced/#proxies). For example:
 
 ```python
 HTTP_PROXIES = {

+ 6 - 2
docs/release-notes/version-3.3.md

@@ -2,13 +2,17 @@
 
 ## v3.3.5 (FUTURE)
 
+### Bug Fixes
+
+* [#9497](https://github.com/netbox-community/netbox/issues/9497) - Adjust non-racked device filter on site and location detailed view
+* [#10435](https://github.com/netbox-community/netbox/issues/10435) - Fix exception when filtering VLANs by virtual machine with no cluster assigned
+* [#10439](https://github.com/netbox-community/netbox/issues/10439) - Fix form widget styling for DeviceType airflow field
+
 ---
 
 ## v3.3.4 (2022-09-16)
 
 ### Bug Fixes
-
-* [#9497](https://github.com/netbox-community/netbox/issues/9497) - Adjust non-racked device filter on site and location detailed view
 * [#10383](https://github.com/netbox-community/netbox/issues/10383) - Fix assignment of component templates to module types via web UI
 * [#10387](https://github.com/netbox-community/netbox/issues/10387) - Fix `MultiValueDictKeyError` exception when editing a device interface
 

+ 1 - 0
netbox/dcim/forms/models.py

@@ -373,6 +373,7 @@ class DeviceTypeForm(NetBoxModelForm):
             'front_image', 'rear_image', 'comments', 'tags',
         ]
         widgets = {
+            'airflow': StaticSelect(),
             'subdevice_role': StaticSelect(),
             'front_image': ClearableFileInput(attrs={
                 'accept': DEVICETYPE_IMAGE_FORMATS

+ 24 - 20
netbox/ipam/querysets.py

@@ -81,30 +81,34 @@ class VLANQuerySet(RestrictedQuerySet):
 
         # Find all relevant VLANGroups
         q = Q()
-        if vm.cluster.site:
-            if vm.cluster.site.region:
+        site = vm.site or vm.cluster.site
+        if vm.cluster:
+            # Add VLANGroups scoped to the assigned cluster (or its group)
+            q |= Q(
+                scope_type=ContentType.objects.get_by_natural_key('virtualization', 'cluster'),
+                scope_id=vm.cluster_id
+            )
+            if vm.cluster.group:
+                q |= Q(
+                    scope_type=ContentType.objects.get_by_natural_key('virtualization', 'clustergroup'),
+                    scope_id=vm.cluster.group_id
+                )
+        if site:
+            # Add VLANGroups scoped to the assigned site (or its group or region)
+            q |= Q(
+                scope_type=ContentType.objects.get_by_natural_key('dcim', 'site'),
+                scope_id=site.pk
+            )
+            if site.region:
                 q |= Q(
                     scope_type=ContentType.objects.get_by_natural_key('dcim', 'region'),
-                    scope_id__in=vm.cluster.site.region.get_ancestors(include_self=True)
+                    scope_id__in=site.region.get_ancestors(include_self=True)
                 )
-            if vm.cluster.site.group:
+            if site.group:
                 q |= Q(
                     scope_type=ContentType.objects.get_by_natural_key('dcim', 'sitegroup'),
-                    scope_id__in=vm.cluster.site.group.get_ancestors(include_self=True)
+                    scope_id__in=site.group.get_ancestors(include_self=True)
                 )
-            q |= Q(
-                scope_type=ContentType.objects.get_by_natural_key('dcim', 'site'),
-                scope_id=vm.cluster.site_id
-            )
-        if vm.cluster.group:
-            q |= Q(
-                scope_type=ContentType.objects.get_by_natural_key('virtualization', 'clustergroup'),
-                scope_id=vm.cluster.group_id
-            )
-        q |= Q(
-            scope_type=ContentType.objects.get_by_natural_key('virtualization', 'cluster'),
-            scope_id=vm.cluster_id
-        )
         vlan_groups = VLANGroup.objects.filter(q)
 
         # Return all applicable VLANs
@@ -113,7 +117,7 @@ class VLANQuerySet(RestrictedQuerySet):
             Q(group__scope_id__isnull=True, site__isnull=True) |  # Global group VLANs
             Q(group__isnull=True, site__isnull=True)  # Global VLANs
         )
-        if vm.cluster.site:
-            q |= Q(site=vm.cluster.site)
+        if site:
+            q |= Q(site=site)
 
         return self.filter(q)