Bläddra i källkod

Merge develop into feature

jeremystretch 3 år sedan
förälder
incheckning
58f97bc0e7

+ 1 - 0
docs/core-functionality/ipam.md

@@ -21,6 +21,7 @@
 ---
 ---
 
 
 {!models/ipam/fhrpgroup.md!}
 {!models/ipam/fhrpgroup.md!}
+{!models/ipam/fhrpgroupassignment.md!}
 
 
 ---
 ---
 
 

+ 0 - 6
docs/models/ipam/fhrpgroup.md

@@ -8,9 +8,3 @@ A first-hop redundancy protocol (FHRP) enables multiple physical interfaces to p
 * Gateway Load Balancing Protocol (GLBP)
 * Gateway Load Balancing Protocol (GLBP)
 
 
 NetBox models these redundancy groups by protocol and group ID. Each group may optionally be assigned an authentication type and key. (Note that the authentication key is stored as a plaintext value in NetBox.) Each group may be assigned or more virtual IPv4 and/or IPv6 addresses.
 NetBox models these redundancy groups by protocol and group ID. Each group may optionally be assigned an authentication type and key. (Note that the authentication key is stored as a plaintext value in NetBox.) Each group may be assigned or more virtual IPv4 and/or IPv6 addresses.
-
-## FHRP Group Assignments
-
-Member device and VM interfaces can be assigned to FHRP groups, along with a numeric priority value. For instance, three interfaces, each belonging to a different router, may each be assigned to the same FHRP group to serve a common virtual IP address. Each of these assignments would typically receive a different priority.
-
-Interfaces are assigned to FHRP groups under the interface detail view.

+ 5 - 0
docs/models/ipam/fhrpgroupassignment.md

@@ -0,0 +1,5 @@
+# FHRP Group Assignments
+
+Member device and VM interfaces can be assigned to FHRP groups, along with a numeric priority value. For instance, three interfaces, each belonging to a different router, may each be assigned to the same FHRP group to serve a common virtual IP address. Each of these assignments would typically receive a different priority.
+
+Interfaces are assigned to FHRP groups under the interface detail view.

+ 6 - 0
docs/release-notes/version-3.1.md

@@ -11,12 +11,18 @@
 
 
 ### Bug Fixes
 ### Bug Fixes
 
 
+* [#8696](https://github.com/netbox-community/netbox/issues/8696) - Fix help link under FHRP group assigment creation view
 * [#8813](https://github.com/netbox-community/netbox/issues/8813) - Retain global search bar query after submitting
 * [#8813](https://github.com/netbox-community/netbox/issues/8813) - Retain global search bar query after submitting
 * [#8820](https://github.com/netbox-community/netbox/issues/8820) - Fix navbar background color in dark mode
 * [#8820](https://github.com/netbox-community/netbox/issues/8820) - Fix navbar background color in dark mode
 * [#8850](https://github.com/netbox-community/netbox/issues/8850) - Show airflow field on device REST API serializer when config context data is included
 * [#8850](https://github.com/netbox-community/netbox/issues/8850) - Show airflow field on device REST API serializer when config context data is included
+* [#8905](https://github.com/netbox-community/netbox/issues/8905) - Disable ordering by assigned tags to prevent erroneous results
 * [#8919](https://github.com/netbox-community/netbox/issues/8919) - Fix filtering of VLAN groups by site under prefix edit form
 * [#8919](https://github.com/netbox-community/netbox/issues/8919) - Fix filtering of VLAN groups by site under prefix edit form
+* [#8924](https://github.com/netbox-community/netbox/issues/8924) - Improve load time of custom script list
 * [#8932](https://github.com/netbox-community/netbox/issues/8932) - Fix error when setting null value for interface `rf_role` via REST API
 * [#8932](https://github.com/netbox-community/netbox/issues/8932) - Fix error when setting null value for interface `rf_role` via REST API
 * [#8935](https://github.com/netbox-community/netbox/issues/8935) - Correct ordering of next/previous racks to use naturalized names
 * [#8935](https://github.com/netbox-community/netbox/issues/8935) - Correct ordering of next/previous racks to use naturalized names
+* [#8947](https://github.com/netbox-community/netbox/issues/8947) - Retain filter parameters when handling an export template exception
+* [#8951](https://github.com/netbox-community/netbox/issues/8951) - Allow changing device type & platform to different manufacturer simultaneously
+* [#8952](https://github.com/netbox-community/netbox/issues/8952) - Device images in rear rack elevations should be hyperlinked
 
 
 ---
 ---
 
 

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

@@ -574,11 +574,6 @@ class DeviceForm(TenancyForm, NetBoxModelForm):
             # can be flipped from one face to another.
             # can be flipped from one face to another.
             self.fields['position'].widget.add_query_param('exclude', self.instance.pk)
             self.fields['position'].widget.add_query_param('exclude', self.instance.pk)
 
 
-            # Limit platform by manufacturer
-            self.fields['platform'].queryset = Platform.objects.filter(
-                Q(manufacturer__isnull=True) | Q(manufacturer=self.instance.device_type.manufacturer)
-            )
-
             # Disable rack assignment if this is a child device installed in a parent device
             # Disable rack assignment if this is a child device installed in a parent device
             if self.instance.device_type.is_child_device and hasattr(self.instance, 'parent_bay'):
             if self.instance.device_type.is_child_device and hasattr(self.instance, 'parent_bay'):
                 self.fields['site'].disabled = True
                 self.fields['site'].disabled = True

+ 2 - 2
netbox/dcim/models/devices.py

@@ -878,8 +878,8 @@ class Device(NetBoxModel, ConfigContextModel):
         if hasattr(self, 'device_type') and self.platform:
         if hasattr(self, 'device_type') and self.platform:
             if self.platform.manufacturer and self.platform.manufacturer != self.device_type.manufacturer:
             if self.platform.manufacturer and self.platform.manufacturer != self.device_type.manufacturer:
                 raise ValidationError({
                 raise ValidationError({
-                    'platform': "The assigned platform is limited to {} device types, but this device's type belongs "
-                                "to {}.".format(self.platform.manufacturer, self.device_type.manufacturer)
+                    'platform': f"The assigned platform is limited to {self.platform.manufacturer} device types, but "
+                                f"this device's type belongs to {self.device_type.manufacturer}."
                 })
                 })
 
 
         # A Device can only be assigned to a Cluster in the same Site (or no Site)
         # A Device can only be assigned to a Cluster in the same Site (or no Site)

+ 4 - 4
netbox/dcim/svg.py

@@ -146,10 +146,10 @@ class RackElevationSVG:
                 class_='device-image'
                 class_='device-image'
             )
             )
             image.fit(scale='slice')
             image.fit(scale='slice')
-            drawing.add(image)
-            drawing.add(drawing.text(get_device_name(device), insert=text, stroke='black',
-                        stroke_width='0.2em', stroke_linejoin='round', class_='device-image-label'))
-            drawing.add(drawing.text(get_device_name(device), insert=text, fill='white', class_='device-image-label'))
+            link.add(image)
+            link.add(drawing.text(get_device_name(device), insert=text, stroke='black',
+                     stroke_width='0.2em', stroke_linejoin='round', class_='device-image-label'))
+            link.add(drawing.text(get_device_name(device), insert=text, fill='white', class_='device-image-label'))
 
 
     @staticmethod
     @staticmethod
     def _draw_empty(drawing, rack, start, end, text, id_, face_id, class_, reservation):
     def _draw_empty(drawing, rack, start, end, text, id_, face_id, class_, reservation):

+ 5 - 1
netbox/extras/scripts.py

@@ -259,6 +259,10 @@ class BaseScript:
     Base model for custom scripts. User classes should inherit from this model if they want to extend Script
     Base model for custom scripts. User classes should inherit from this model if they want to extend Script
     functionality for use in other subclasses.
     functionality for use in other subclasses.
     """
     """
+
+    # Prevent django from instantiating the class on all accesses
+    do_not_call_in_templates = True
+
     class Meta:
     class Meta:
         pass
         pass
 
 
@@ -280,7 +284,7 @@ class BaseScript:
 
 
     @classproperty
     @classproperty
     def name(self):
     def name(self):
-        return getattr(self.Meta, 'name', self.__class__.__name__)
+        return getattr(self.Meta, 'name', self.__name__)
 
 
     @classproperty
     @classproperty
     def full_name(self):
     def full_name(self):

+ 1 - 0
netbox/netbox/tables/columns.py

@@ -341,6 +341,7 @@ class TagColumn(tables.TemplateColumn):
 
 
     def __init__(self, url_name=None):
     def __init__(self, url_name=None):
         super().__init__(
         super().__init__(
+            orderable=False,
             template_code=self.template_code,
             template_code=self.template_code,
             extra_context={'url_name': url_name}
             extra_context={'url_name': url_name}
         )
         )

+ 4 - 1
netbox/netbox/views/generic/bulk_views.py

@@ -124,7 +124,10 @@ class ObjectListView(BaseMultiObjectView):
             return template.render_to_response(self.queryset)
             return template.render_to_response(self.queryset)
         except Exception as e:
         except Exception as e:
             messages.error(request, f"There was an error rendering the selected export template ({template.name}): {e}")
             messages.error(request, f"There was an error rendering the selected export template ({template.name}): {e}")
-            return redirect(request.path)
+            # Strip the `export` param and redirect user to the filtered objects list
+            query_params = request.GET.copy()
+            query_params.pop('export')
+            return redirect(f'{request.path}?{query_params.urlencode()}')
 
 
     #
     #
     # Request handlers
     # Request handlers

+ 1 - 1
netbox/templates/extras/script_list.html

@@ -34,7 +34,7 @@
                 {% for class_name, script in module_scripts.items %}
                 {% for class_name, script in module_scripts.items %}
                   <tr>
                   <tr>
                     <td>
                     <td>
-                      <a href="{% url 'extras:script' module=script.module name=class_name %}" name="script.{{ class_name }}">{{ script }}</a>
+                      <a href="{% url 'extras:script' module=script.module name=class_name %}" name="script.{{ class_name }}">{{ script.name }}</a>
                     </td>
                     </td>
                     <td>
                     <td>
                       {% include 'extras/inc/job_label.html' with result=script.result %}
                       {% include 'extras/inc/job_label.html' with result=script.result %}