From 58f97bc0e70d5a2257b58b8ed0aa7b05d65bf3da Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 24 Mar 2022 16:35:35 -0400 Subject: [PATCH] Merge develop into feature --- docs/core-functionality/ipam.md | 1 + docs/models/ipam/fhrpgroup.md | 6 ------ docs/models/ipam/fhrpgroupassignment.md | 5 +++++ docs/release-notes/version-3.1.md | 6 ++++++ netbox/dcim/forms/models.py | 5 ----- netbox/dcim/models/devices.py | 4 ++-- netbox/dcim/svg.py | 8 ++++---- netbox/extras/scripts.py | 6 +++++- netbox/netbox/tables/columns.py | 1 + netbox/netbox/views/generic/bulk_views.py | 5 ++++- netbox/templates/extras/script_list.html | 2 +- 11 files changed, 29 insertions(+), 20 deletions(-) create mode 100644 docs/models/ipam/fhrpgroupassignment.md diff --git a/docs/core-functionality/ipam.md b/docs/core-functionality/ipam.md index 9fa5e0eb4..01bb3c76d 100644 --- a/docs/core-functionality/ipam.md +++ b/docs/core-functionality/ipam.md @@ -21,6 +21,7 @@ --- {!models/ipam/fhrpgroup.md!} +{!models/ipam/fhrpgroupassignment.md!} --- diff --git a/docs/models/ipam/fhrpgroup.md b/docs/models/ipam/fhrpgroup.md index 5efbc8428..c5baccd7b 100644 --- a/docs/models/ipam/fhrpgroup.md +++ b/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) 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. diff --git a/docs/models/ipam/fhrpgroupassignment.md b/docs/models/ipam/fhrpgroupassignment.md new file mode 100644 index 000000000..c3e0bf200 --- /dev/null +++ b/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. diff --git a/docs/release-notes/version-3.1.md b/docs/release-notes/version-3.1.md index 22c5b0da1..ea18a0834 100644 --- a/docs/release-notes/version-3.1.md +++ b/docs/release-notes/version-3.1.md @@ -11,12 +11,18 @@ ### 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 * [#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 +* [#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 +* [#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 * [#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 --- diff --git a/netbox/dcim/forms/models.py b/netbox/dcim/forms/models.py index 4bebe88a0..6cdcb372c 100644 --- a/netbox/dcim/forms/models.py +++ b/netbox/dcim/forms/models.py @@ -574,11 +574,6 @@ class DeviceForm(TenancyForm, NetBoxModelForm): # can be flipped from one face to another. 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 if self.instance.device_type.is_child_device and hasattr(self.instance, 'parent_bay'): self.fields['site'].disabled = True diff --git a/netbox/dcim/models/devices.py b/netbox/dcim/models/devices.py index 04adfbeb4..d95063601 100644 --- a/netbox/dcim/models/devices.py +++ b/netbox/dcim/models/devices.py @@ -878,8 +878,8 @@ class Device(NetBoxModel, ConfigContextModel): if hasattr(self, 'device_type') and self.platform: if self.platform.manufacturer and self.platform.manufacturer != self.device_type.manufacturer: 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) diff --git a/netbox/dcim/svg.py b/netbox/dcim/svg.py index e333320b6..7cd0fa417 100644 --- a/netbox/dcim/svg.py +++ b/netbox/dcim/svg.py @@ -146,10 +146,10 @@ class RackElevationSVG: class_='device-image' ) 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 def _draw_empty(drawing, rack, start, end, text, id_, face_id, class_, reservation): diff --git a/netbox/extras/scripts.py b/netbox/extras/scripts.py index fb3c6558a..f80dfaefa 100644 --- a/netbox/extras/scripts.py +++ b/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 functionality for use in other subclasses. """ + + # Prevent django from instantiating the class on all accesses + do_not_call_in_templates = True + class Meta: pass @@ -280,7 +284,7 @@ class BaseScript: @classproperty def name(self): - return getattr(self.Meta, 'name', self.__class__.__name__) + return getattr(self.Meta, 'name', self.__name__) @classproperty def full_name(self): diff --git a/netbox/netbox/tables/columns.py b/netbox/netbox/tables/columns.py index 465758ac6..ba5583a2e 100644 --- a/netbox/netbox/tables/columns.py +++ b/netbox/netbox/tables/columns.py @@ -341,6 +341,7 @@ class TagColumn(tables.TemplateColumn): def __init__(self, url_name=None): super().__init__( + orderable=False, template_code=self.template_code, extra_context={'url_name': url_name} ) diff --git a/netbox/netbox/views/generic/bulk_views.py b/netbox/netbox/views/generic/bulk_views.py index 8fbbbeae0..96efc0de7 100644 --- a/netbox/netbox/views/generic/bulk_views.py +++ b/netbox/netbox/views/generic/bulk_views.py @@ -124,7 +124,10 @@ class ObjectListView(BaseMultiObjectView): return template.render_to_response(self.queryset) except Exception as 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 diff --git a/netbox/templates/extras/script_list.html b/netbox/templates/extras/script_list.html index 7fc4b6d9a..8884ff77c 100644 --- a/netbox/templates/extras/script_list.html +++ b/netbox/templates/extras/script_list.html @@ -34,7 +34,7 @@ {% for class_name, script in module_scripts.items %} - {{ script }} + {{ script.name }} {% include 'extras/inc/job_label.html' with result=script.result %}