From a2a83a4a4c76c13dec39ea9ac86d6b833a6e4f30 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 1 Nov 2019 15:54:17 -0400 Subject: [PATCH 01/34] Post-release version bump --- netbox/netbox/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 9a5444b1883..721ec052a6c 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -12,7 +12,7 @@ # Environment setup # -VERSION = '2.6.7' +VERSION = '2.6.8-dev' # Hostname HOSTNAME = platform.node() From 7f779e39426eb3c24dda9684c1b1e2859ec4fac0 Mon Sep 17 00:00:00 2001 From: Sander Steffann Date: Sun, 3 Nov 2019 16:05:53 +0300 Subject: [PATCH 02/34] Hide password change page when user is logged in using LDAP --- netbox/templates/users/_user.html | 8 +++++--- netbox/users/views.py | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/netbox/templates/users/_user.html b/netbox/templates/users/_user.html index 9f71b9633e7..b8cc0471f8f 100644 --- a/netbox/templates/users/_user.html +++ b/netbox/templates/users/_user.html @@ -12,9 +12,11 @@

{% block title %}{% endblock %}

Profile - - Change Password - + {% if not request.user.ldap_username %} + + Change Password + + {% endif %} API Tokens diff --git a/netbox/users/views.py b/netbox/users/views.py index 6abdd817d39..c63dd87b4da 100644 --- a/netbox/users/views.py +++ b/netbox/users/views.py @@ -95,6 +95,10 @@ class ChangePasswordView(LoginRequiredMixin, View): template_name = 'users/change_password.html' def get(self, request): + # LDAP users cannot change their password here + if getattr(request.user, 'ldap_username', None): + return redirect('user:profile') + form = PasswordChangeForm(user=request.user) return render(request, self.template_name, { From 99a542e4e4fd2b6b3e8b4b2652cd141722d4dd60 Mon Sep 17 00:00:00 2001 From: struppi Date: Mon, 4 Nov 2019 20:51:56 +0100 Subject: [PATCH 03/34] Closes #3663: API filter by created, last_updated --- netbox/circuits/filters.py | 6 +++--- netbox/dcim/filters.py | 12 ++++++------ netbox/extras/filters.py | 20 ++++++++++++++++++++ netbox/ipam/filters.py | 14 +++++++------- netbox/secrets/filters.py | 4 ++-- netbox/tenancy/filters.py | 4 ++-- netbox/virtualization/filters.py | 6 +++--- 7 files changed, 43 insertions(+), 23 deletions(-) diff --git a/netbox/circuits/filters.py b/netbox/circuits/filters.py index 088ec144ab9..16f995fcaed 100644 --- a/netbox/circuits/filters.py +++ b/netbox/circuits/filters.py @@ -2,14 +2,14 @@ from django.db.models import Q from dcim.models import Region, Site -from extras.filters import CustomFieldFilterSet +from extras.filters import CustomFieldFilterSet, ChangeLoggedFilter from tenancy.filtersets import TenancyFilterSet from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter, TreeNodeMultipleChoiceFilter from .constants import * from .models import Circuit, CircuitTermination, CircuitType, Provider -class ProviderFilter(CustomFieldFilterSet): +class ProviderFilter(CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -54,7 +54,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class CircuitFilter(CustomFieldFilterSet, TenancyFilterSet): +class CircuitFilter(CustomFieldFilterSet, TenancyFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py index c1274e3d559..79f4c1b153f 100644 --- a/netbox/dcim/filters.py +++ b/netbox/dcim/filters.py @@ -2,7 +2,7 @@ from django.contrib.auth.models import User from django.db.models import Q -from extras.filters import CustomFieldFilterSet, LocalConfigContextFilter +from extras.filters import CustomFieldFilterSet, LocalConfigContextFilter, ChangeLoggedFilter from tenancy.filtersets import TenancyFilterSet from tenancy.models import Tenant from utilities.constants import COLOR_CHOICES @@ -38,7 +38,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class SiteFilter(TenancyFilterSet, CustomFieldFilterSet): +class SiteFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -116,7 +116,7 @@ class Meta: fields = ['id', 'name', 'slug', 'color'] -class RackFilter(TenancyFilterSet, CustomFieldFilterSet): +class RackFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -251,7 +251,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class DeviceTypeFilter(CustomFieldFilterSet): +class DeviceTypeFilter(CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -423,7 +423,7 @@ class Meta: fields = ['id', 'name', 'slug', 'napalm_driver'] -class DeviceFilter(LocalConfigContextFilter, TenancyFilterSet, CustomFieldFilterSet): +class DeviceFilter(LocalConfigContextFilter, TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -1096,7 +1096,7 @@ def search(self, queryset, name, value): return queryset.filter(qs_filter) -class PowerFeedFilter(CustomFieldFilterSet): +class PowerFeedFilter(CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/extras/filters.py b/netbox/extras/filters.py index a4520205245..17fa746f66e 100644 --- a/netbox/extras/filters.py +++ b/netbox/extras/filters.py @@ -241,3 +241,23 @@ def search(self, queryset, name, value): Q(user_name__icontains=value) | Q(object_repr__icontains=value) ) + +class ChangeLoggedFilter(django_filters.FilterSet): + created = django_filters.DateFilter() + created__gte = django_filters.DateFilter( + field_name='created', + lookup_expr='gte' + ) + created__lte = django_filters.DateFilter( + field_name='created', + lookup_expr='lte' + ) + last_updated = django_filters.DateTimeFilter() + last_updated__gte = django_filters.DateTimeFilter( + field_name='last_updated', + lookup_expr='gte' + ) + last_updated__lte = django_filters.DateTimeFilter( + field_name='last_updated', + lookup_expr='lte' + ) \ No newline at end of file diff --git a/netbox/ipam/filters.py b/netbox/ipam/filters.py index c57006b2774..93a8adb5440 100644 --- a/netbox/ipam/filters.py +++ b/netbox/ipam/filters.py @@ -5,7 +5,7 @@ from netaddr.core import AddrFormatError from dcim.models import Site, Device, Interface -from extras.filters import CustomFieldFilterSet +from extras.filters import CustomFieldFilterSet, ChangeLoggedFilter from tenancy.filtersets import TenancyFilterSet from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter from virtualization.models import VirtualMachine @@ -13,7 +13,7 @@ from .models import Aggregate, IPAddress, Prefix, RIR, Role, Service, VLAN, VLANGroup, VRF -class VRFFilter(TenancyFilterSet, CustomFieldFilterSet): +class VRFFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -49,7 +49,7 @@ class Meta: fields = ['name', 'slug', 'is_private'] -class AggregateFilter(CustomFieldFilterSet): +class AggregateFilter(CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -110,7 +110,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class PrefixFilter(TenancyFilterSet, CustomFieldFilterSet): +class PrefixFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -247,7 +247,7 @@ def filter_mask_length(self, queryset, name, value): return queryset.filter(prefix__net_mask_length=value) -class IPAddressFilter(TenancyFilterSet, CustomFieldFilterSet): +class IPAddressFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -384,7 +384,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class VLANFilter(TenancyFilterSet, CustomFieldFilterSet): +class VLANFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -444,7 +444,7 @@ def search(self, queryset, name, value): return queryset.filter(qs_filter) -class ServiceFilter(django_filters.FilterSet): +class ServiceFilter(django_filters.FilterSet, ChangeLoggedFilter): q = django_filters.CharFilter( method='search', label='Search', diff --git a/netbox/secrets/filters.py b/netbox/secrets/filters.py index 628d716dbc6..69e3ff72309 100644 --- a/netbox/secrets/filters.py +++ b/netbox/secrets/filters.py @@ -2,7 +2,7 @@ from django.db.models import Q from dcim.models import Device -from extras.filters import CustomFieldFilterSet +from extras.filters import CustomFieldFilterSet, ChangeLoggedFilter from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter from .models import Secret, SecretRole @@ -14,7 +14,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class SecretFilter(CustomFieldFilterSet): +class SecretFilter(CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/tenancy/filters.py b/netbox/tenancy/filters.py index acb0fa0ccf4..6ac03af5064 100644 --- a/netbox/tenancy/filters.py +++ b/netbox/tenancy/filters.py @@ -1,7 +1,7 @@ import django_filters from django.db.models import Q -from extras.filters import CustomFieldFilterSet +from extras.filters import CustomFieldFilterSet, ChangeLoggedFilter from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter from .models import Tenant, TenantGroup @@ -13,7 +13,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class TenantFilter(CustomFieldFilterSet): +class TenantFilter(CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/virtualization/filters.py b/netbox/virtualization/filters.py index 8365d6f91a1..05783db9210 100644 --- a/netbox/virtualization/filters.py +++ b/netbox/virtualization/filters.py @@ -4,7 +4,7 @@ from netaddr.core import AddrFormatError from dcim.models import DeviceRole, Interface, Platform, Region, Site -from extras.filters import CustomFieldFilterSet +from extras.filters import CustomFieldFilterSet, ChangeLoggedFilter from tenancy.filtersets import TenancyFilterSet from utilities.filters import ( MultiValueMACAddressFilter, NameSlugSearchFilterSet, NumericInFilter, TagFilter, TreeNodeMultipleChoiceFilter, @@ -27,7 +27,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class ClusterFilter(CustomFieldFilterSet): +class ClusterFilter(CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -81,7 +81,7 @@ def search(self, queryset, name, value): ) -class VirtualMachineFilter(TenancyFilterSet, CustomFieldFilterSet): +class VirtualMachineFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' From a11fa44170092bb5a0cf01097f625bd52c62fdc5 Mon Sep 17 00:00:00 2001 From: struppi Date: Mon, 4 Nov 2019 21:00:44 +0100 Subject: [PATCH 04/34] Closes #3663: fix inheritance error --- netbox/ipam/filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/ipam/filters.py b/netbox/ipam/filters.py index 93a8adb5440..0eba0e66d2c 100644 --- a/netbox/ipam/filters.py +++ b/netbox/ipam/filters.py @@ -444,7 +444,7 @@ def search(self, queryset, name, value): return queryset.filter(qs_filter) -class ServiceFilter(django_filters.FilterSet, ChangeLoggedFilter): +class ServiceFilter(ChangeLoggedFilter): q = django_filters.CharFilter( method='search', label='Search', From bbd65988f92add4bf0c9699b506c3088cde896ec Mon Sep 17 00:00:00 2001 From: Alexander Olofsson Date: Wed, 6 Nov 2019 10:10:09 +0100 Subject: [PATCH 05/34] 3457 Display cable colors in device interface list --- netbox/project-static/css/base.css | 8 ++++++++ netbox/templates/dcim/inc/interface.html | 3 +++ 2 files changed, 11 insertions(+) diff --git a/netbox/project-static/css/base.css b/netbox/project-static/css/base.css index 6ae37bdf176..9d4c099f4c4 100644 --- a/netbox/project-static/css/base.css +++ b/netbox/project-static/css/base.css @@ -457,6 +457,14 @@ table.report th a { width: 80px; border: 1px solid grey; } +.inline-color-block { + display: inline-block; + width: 1.5em; + height: 1.5em; + border: 1px solid grey; + border-radius: .25em; + vertical-align: middle; +} .text-nowrap { white-space: nowrap; } diff --git a/netbox/templates/dcim/inc/interface.html b/netbox/templates/dcim/inc/interface.html index 424f487a8f6..6ec46824bdc 100644 --- a/netbox/templates/dcim/inc/interface.html +++ b/netbox/templates/dcim/inc/interface.html @@ -48,6 +48,9 @@ {% if iface.cable %} {{ iface.cable }} + {% if iface.cable.color %} +   + {% endif %} From fb4283ed53b0c4cb3f9dd2b498036eea9dc19ea5 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 6 Nov 2019 09:05:12 -0500 Subject: [PATCH 06/34] Move alternative installations to the GitHub wiki --- README.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/README.md b/README.md index 996f263326d..38961c28642 100644 --- a/README.md +++ b/README.md @@ -36,13 +36,6 @@ Please see [the documentation](http://netbox.readthedocs.io/en/stable/) for instructions on installing NetBox. To upgrade NetBox, please download the [latest release](https://github.com/netbox-community/netbox/releases) and run `upgrade.sh`. -## Alternative Installations - -* [Docker container](https://github.com/netbox-community/netbox-docker) (via [@cimnine](https://github.com/cimnine)) -* [Vagrant deployment](https://github.com/ryanmerolle/netbox-vagrant) (via [@ryanmerolle](https://github.com/ryanmerolle)) -* [Ansible deployment](https://github.com/lae/ansible-role-netbox) (via [@lae](https://github.com/lae)) -* [Kubernetes deployment](https://github.com/CENGN/netbox-kubernetes) (via [@CENGN](https://github.com/CENGN)) - # Providing Feedback Feature requests and bug reports must be submitted as GiHub issues. (Please be From 5eb5c4bac551d9875a3688aad36388af8f61e3a6 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 6 Nov 2019 09:26:49 -0500 Subject: [PATCH 07/34] Fixes #3674: Include comments on PowerFeed view --- docs/release-notes/version-2.6.md | 6 ++++++ netbox/templates/dcim/powerfeed.html | 12 ++++++++++++ 2 files changed, 18 insertions(+) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 181d448ffba..7250cc6f2ba 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -1,3 +1,9 @@ +# v2.6.8 (FUTURE) + +## Bug Fixes + +* [#3674](https://github.com/netbox-community/netbox/issues/3674) - Include comments on PowerFeed view + # v2.6.7 (2019-11-01) ## Enhancements diff --git a/netbox/templates/dcim/powerfeed.html b/netbox/templates/dcim/powerfeed.html index 8589524c91f..a8ab302eb80 100644 --- a/netbox/templates/dcim/powerfeed.html +++ b/netbox/templates/dcim/powerfeed.html @@ -121,6 +121,18 @@

{% block title %}{{ powerfeed }}{% endblock %}

+
+
+ Comments +
+
+ {% if powerfeed.comments %} + {{ powerfeed.comments|gfm }} + {% else %} + None + {% endif %} +
+
From fbde6187eae6d37a8cded99a6b2899ed4a034060 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 6 Nov 2019 09:39:21 -0500 Subject: [PATCH 08/34] Fixes #3669: Include weight field in prefix/VLAN role form --- docs/release-notes/version-2.6.md | 1 + netbox/ipam/forms.py | 2 +- netbox/ipam/tables.py | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 7250cc6f2ba..92ced060c16 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -2,6 +2,7 @@ ## Bug Fixes +* [#3669](https://github.com/netbox-community/netbox/issues/3669) - Include `weight` field in prefix/VLAN role form * [#3674](https://github.com/netbox-community/netbox/issues/3674) - Include comments on PowerFeed view # v2.6.7 (2019-11-01) diff --git a/netbox/ipam/forms.py b/netbox/ipam/forms.py index 002d2a72ac2..bedbe34636f 100644 --- a/netbox/ipam/forms.py +++ b/netbox/ipam/forms.py @@ -240,7 +240,7 @@ class RoleForm(BootstrapMixin, forms.ModelForm): class Meta: model = Role fields = [ - 'name', 'slug', + 'name', 'slug', 'weight', ] diff --git a/netbox/ipam/tables.py b/netbox/ipam/tables.py index 3906f080f93..0dde1187082 100644 --- a/netbox/ipam/tables.py +++ b/netbox/ipam/tables.py @@ -292,7 +292,7 @@ class RoleTable(BaseTable): class Meta(BaseTable.Meta): model = Role - fields = ('pk', 'name', 'prefix_count', 'vlan_count', 'slug', 'actions') + fields = ('pk', 'name', 'prefix_count', 'vlan_count', 'slug', 'weight', 'actions') # From 1bc38f66ae29c29f1d149f56970802d1251a93df Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 6 Nov 2019 09:58:30 -0500 Subject: [PATCH 09/34] Changelog entries for #3139 and #3457 --- docs/release-notes/version-2.6.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 92ced060c16..e83e5b53679 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -1,5 +1,10 @@ # v2.6.8 (FUTURE) +## Enhancements + +* [#3139](https://github.com/netbox-community/netbox/issues/3139) - Disable password change form for LDAP-authenticated users +* [#3457](https://github.com/netbox-community/netbox/issues/3457) - Display cable colors on device view + ## Bug Fixes * [#3669](https://github.com/netbox-community/netbox/issues/3669) - Include `weight` field in prefix/VLAN role form From b1761f78567bc5137771128557d851f37efa385b Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 6 Nov 2019 10:01:42 -0500 Subject: [PATCH 10/34] #3139: Add a message indicating why the user is redirected --- netbox/users/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netbox/users/views.py b/netbox/users/views.py index c63dd87b4da..47d3503d796 100644 --- a/netbox/users/views.py +++ b/netbox/users/views.py @@ -96,7 +96,8 @@ class ChangePasswordView(LoginRequiredMixin, View): def get(self, request): # LDAP users cannot change their password here - if getattr(request.user, 'ldap_username', None): + if getattr(request.user, 'ldap_username'): + messages.warning(request, "LDAP-authenticated user credentials cannot be changed within NetBox.") return redirect('user:profile') form = PasswordChangeForm(user=request.user) From 099774d66758426c8ed4224527d6553faab45316 Mon Sep 17 00:00:00 2001 From: struppi Date: Thu, 7 Nov 2019 22:38:51 +0100 Subject: [PATCH 11/34] Closes #3663: PEP8 fixes --- netbox/extras/filters.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/netbox/extras/filters.py b/netbox/extras/filters.py index 17fa746f66e..f111208d7b1 100644 --- a/netbox/extras/filters.py +++ b/netbox/extras/filters.py @@ -242,6 +242,7 @@ def search(self, queryset, name, value): Q(object_repr__icontains=value) ) + class ChangeLoggedFilter(django_filters.FilterSet): created = django_filters.DateFilter() created__gte = django_filters.DateFilter( @@ -260,4 +261,4 @@ class ChangeLoggedFilter(django_filters.FilterSet): last_updated__lte = django_filters.DateTimeFilter( field_name='last_updated', lookup_expr='lte' - ) \ No newline at end of file + ) From 03194506430764863d58cd13c5aa39dc6c027665 Mon Sep 17 00:00:00 2001 From: struppi Date: Thu, 7 Nov 2019 22:41:09 +0100 Subject: [PATCH 12/34] Closes #3663: rename filter class --- netbox/circuits/filters.py | 6 +++--- netbox/dcim/filters.py | 12 ++++++------ netbox/extras/filters.py | 2 +- netbox/ipam/filters.py | 14 +++++++------- netbox/secrets/filters.py | 4 ++-- netbox/tenancy/filters.py | 4 ++-- netbox/virtualization/filters.py | 6 +++--- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/netbox/circuits/filters.py b/netbox/circuits/filters.py index 16f995fcaed..842f5749510 100644 --- a/netbox/circuits/filters.py +++ b/netbox/circuits/filters.py @@ -2,14 +2,14 @@ from django.db.models import Q from dcim.models import Region, Site -from extras.filters import CustomFieldFilterSet, ChangeLoggedFilter +from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilter from tenancy.filtersets import TenancyFilterSet from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter, TreeNodeMultipleChoiceFilter from .constants import * from .models import Circuit, CircuitTermination, CircuitType, Provider -class ProviderFilter(CustomFieldFilterSet, ChangeLoggedFilter): +class ProviderFilter(CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -54,7 +54,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class CircuitFilter(CustomFieldFilterSet, TenancyFilterSet, ChangeLoggedFilter): +class CircuitFilter(CustomFieldFilterSet, TenancyFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py index 79f4c1b153f..b96d173a0a0 100644 --- a/netbox/dcim/filters.py +++ b/netbox/dcim/filters.py @@ -2,7 +2,7 @@ from django.contrib.auth.models import User from django.db.models import Q -from extras.filters import CustomFieldFilterSet, LocalConfigContextFilter, ChangeLoggedFilter +from extras.filters import CustomFieldFilterSet, LocalConfigContextFilter, CreatedUpdatedFilter from tenancy.filtersets import TenancyFilterSet from tenancy.models import Tenant from utilities.constants import COLOR_CHOICES @@ -38,7 +38,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class SiteFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): +class SiteFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -116,7 +116,7 @@ class Meta: fields = ['id', 'name', 'slug', 'color'] -class RackFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): +class RackFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -251,7 +251,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class DeviceTypeFilter(CustomFieldFilterSet, ChangeLoggedFilter): +class DeviceTypeFilter(CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -423,7 +423,7 @@ class Meta: fields = ['id', 'name', 'slug', 'napalm_driver'] -class DeviceFilter(LocalConfigContextFilter, TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): +class DeviceFilter(LocalConfigContextFilter, TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -1096,7 +1096,7 @@ def search(self, queryset, name, value): return queryset.filter(qs_filter) -class PowerFeedFilter(CustomFieldFilterSet, ChangeLoggedFilter): +class PowerFeedFilter(CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/extras/filters.py b/netbox/extras/filters.py index f111208d7b1..99e954f3dbd 100644 --- a/netbox/extras/filters.py +++ b/netbox/extras/filters.py @@ -243,7 +243,7 @@ def search(self, queryset, name, value): ) -class ChangeLoggedFilter(django_filters.FilterSet): +class CreatedUpdatedFilter(django_filters.FilterSet): created = django_filters.DateFilter() created__gte = django_filters.DateFilter( field_name='created', diff --git a/netbox/ipam/filters.py b/netbox/ipam/filters.py index 0eba0e66d2c..52ff0dcc18f 100644 --- a/netbox/ipam/filters.py +++ b/netbox/ipam/filters.py @@ -5,7 +5,7 @@ from netaddr.core import AddrFormatError from dcim.models import Site, Device, Interface -from extras.filters import CustomFieldFilterSet, ChangeLoggedFilter +from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilter from tenancy.filtersets import TenancyFilterSet from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter from virtualization.models import VirtualMachine @@ -13,7 +13,7 @@ from .models import Aggregate, IPAddress, Prefix, RIR, Role, Service, VLAN, VLANGroup, VRF -class VRFFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): +class VRFFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -49,7 +49,7 @@ class Meta: fields = ['name', 'slug', 'is_private'] -class AggregateFilter(CustomFieldFilterSet, ChangeLoggedFilter): +class AggregateFilter(CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -110,7 +110,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class PrefixFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): +class PrefixFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -247,7 +247,7 @@ def filter_mask_length(self, queryset, name, value): return queryset.filter(prefix__net_mask_length=value) -class IPAddressFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): +class IPAddressFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -384,7 +384,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class VLANFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): +class VLANFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -444,7 +444,7 @@ def search(self, queryset, name, value): return queryset.filter(qs_filter) -class ServiceFilter(ChangeLoggedFilter): +class ServiceFilter(CreatedUpdatedFilter): q = django_filters.CharFilter( method='search', label='Search', diff --git a/netbox/secrets/filters.py b/netbox/secrets/filters.py index 69e3ff72309..109eee2b299 100644 --- a/netbox/secrets/filters.py +++ b/netbox/secrets/filters.py @@ -2,7 +2,7 @@ from django.db.models import Q from dcim.models import Device -from extras.filters import CustomFieldFilterSet, ChangeLoggedFilter +from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilter from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter from .models import Secret, SecretRole @@ -14,7 +14,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class SecretFilter(CustomFieldFilterSet, ChangeLoggedFilter): +class SecretFilter(CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/tenancy/filters.py b/netbox/tenancy/filters.py index 6ac03af5064..b3a59883842 100644 --- a/netbox/tenancy/filters.py +++ b/netbox/tenancy/filters.py @@ -1,7 +1,7 @@ import django_filters from django.db.models import Q -from extras.filters import CustomFieldFilterSet, ChangeLoggedFilter +from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilter from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter from .models import Tenant, TenantGroup @@ -13,7 +13,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class TenantFilter(CustomFieldFilterSet, ChangeLoggedFilter): +class TenantFilter(CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/virtualization/filters.py b/netbox/virtualization/filters.py index 05783db9210..ef92884eef6 100644 --- a/netbox/virtualization/filters.py +++ b/netbox/virtualization/filters.py @@ -4,7 +4,7 @@ from netaddr.core import AddrFormatError from dcim.models import DeviceRole, Interface, Platform, Region, Site -from extras.filters import CustomFieldFilterSet, ChangeLoggedFilter +from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilter from tenancy.filtersets import TenancyFilterSet from utilities.filters import ( MultiValueMACAddressFilter, NameSlugSearchFilterSet, NumericInFilter, TagFilter, TreeNodeMultipleChoiceFilter, @@ -27,7 +27,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class ClusterFilter(CustomFieldFilterSet, ChangeLoggedFilter): +class ClusterFilter(CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -81,7 +81,7 @@ def search(self, queryset, name, value): ) -class VirtualMachineFilter(TenancyFilterSet, CustomFieldFilterSet, ChangeLoggedFilter): +class VirtualMachineFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): id__in = NumericInFilter( field_name='id', lookup_expr='in' From 1aaa101fb5cd9d9206cd477769a0a8f6ad2c7b5e Mon Sep 17 00:00:00 2001 From: Bernhard Bock Date: Fri, 8 Nov 2019 15:13:32 +0100 Subject: [PATCH 13/34] Docs: Remove obsolete P3P policy P3P is obsolete (https://www.w3.org/TR/P3P11/), therefore the HTTP header should be removed from the recommended config in the installation docs. --- docs/installation/3-http-daemon.md | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/installation/3-http-daemon.md b/docs/installation/3-http-daemon.md index c1bcf7ca8a2..9c29fc979be 100644 --- a/docs/installation/3-http-daemon.md +++ b/docs/installation/3-http-daemon.md @@ -32,7 +32,6 @@ server { proxy_set_header X-Forwarded-Host $server_name; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; - add_header P3P 'CP="ALL DSP COR PSAa PSDa OUR NOR ONL UNI COM NAV"'; } } ``` From 5904f1f8ee722d8f82f02d93e4b97ff6d548a827 Mon Sep 17 00:00:00 2001 From: kobayashi Date: Tue, 12 Nov 2019 09:47:31 -0500 Subject: [PATCH 14/34] Changelog for #3329 --- docs/release-notes/version-2.6.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index e83e5b53679..04f0ce99199 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -4,6 +4,7 @@ * [#3139](https://github.com/netbox-community/netbox/issues/3139) - Disable password change form for LDAP-authenticated users * [#3457](https://github.com/netbox-community/netbox/issues/3457) - Display cable colors on device view +* [#3329](https://github.com/netbox-community/netbox/issues/3329) - Remove obsolete P3P policy header ## Bug Fixes From 3c8083ed7fe94b55010d3b5961a38809bed27079 Mon Sep 17 00:00:00 2001 From: kobayashi Date: Wed, 13 Nov 2019 00:18:45 -0500 Subject: [PATCH 15/34] fix url expressions --- docs/release-notes/version-2.6.md | 1 + netbox/ipam/tables.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 04f0ce99199..4366983776f 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -10,6 +10,7 @@ * [#3669](https://github.com/netbox-community/netbox/issues/3669) - Include `weight` field in prefix/VLAN role form * [#3674](https://github.com/netbox-community/netbox/issues/3674) - Include comments on PowerFeed view +* [#3679](https://github.com/netbox-community/netbox/issues/3679) - Fix link for assigned ipaddress in interface page # v2.6.7 (2019-11-01) diff --git a/netbox/ipam/tables.py b/netbox/ipam/tables.py index 0dde1187082..91f195ba043 100644 --- a/netbox/ipam/tables.py +++ b/netbox/ipam/tables.py @@ -85,7 +85,7 @@ """ IPADDRESS_ASSIGN_LINK = """ -{{ record }} +{{ record }} """ IPADDRESS_PARENT = """ From 03b8759597b100076d57c88920a9370631e08988 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 14 Nov 2019 21:58:37 -0500 Subject: [PATCH 16/34] 'base_name' deprecated in DRF v3.9.0 --- netbox/extras/api/urls.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/extras/api/urls.py b/netbox/extras/api/urls.py index c135280eaa6..f4968d00403 100644 --- a/netbox/extras/api/urls.py +++ b/netbox/extras/api/urls.py @@ -18,7 +18,7 @@ def get_view_name(self): router.register(r'_choices', views.ExtrasFieldChoicesViewSet, basename='field-choice') # Custom field choices -router.register(r'_custom_field_choices', views.CustomFieldChoicesViewSet, base_name='custom-field-choice') +router.register(r'_custom_field_choices', views.CustomFieldChoicesViewSet, basename='custom-field-choice') # Graphs router.register(r'graphs', views.GraphViewSet) From bfede60f3dd4fc1671aac5618c298b0f4462ce13 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 14 Nov 2019 22:00:12 -0500 Subject: [PATCH 17/34] Rename CreatedUpdatedFilter to CreatedUpdatedFilterSet --- netbox/circuits/filters.py | 6 +++--- netbox/dcim/filters.py | 12 ++++++------ netbox/extras/filters.py | 2 +- netbox/ipam/filters.py | 14 +++++++------- netbox/secrets/filters.py | 4 ++-- netbox/tenancy/filters.py | 4 ++-- netbox/virtualization/filters.py | 6 +++--- 7 files changed, 24 insertions(+), 24 deletions(-) diff --git a/netbox/circuits/filters.py b/netbox/circuits/filters.py index 842f5749510..502d2d103f8 100644 --- a/netbox/circuits/filters.py +++ b/netbox/circuits/filters.py @@ -2,14 +2,14 @@ from django.db.models import Q from dcim.models import Region, Site -from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilter +from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilterSet from tenancy.filtersets import TenancyFilterSet from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter, TreeNodeMultipleChoiceFilter from .constants import * from .models import Circuit, CircuitTermination, CircuitType, Provider -class ProviderFilter(CustomFieldFilterSet, CreatedUpdatedFilter): +class ProviderFilter(CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -54,7 +54,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class CircuitFilter(CustomFieldFilterSet, TenancyFilterSet, CreatedUpdatedFilter): +class CircuitFilter(CustomFieldFilterSet, TenancyFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py index b96d173a0a0..8bcf0a0fc52 100644 --- a/netbox/dcim/filters.py +++ b/netbox/dcim/filters.py @@ -2,7 +2,7 @@ from django.contrib.auth.models import User from django.db.models import Q -from extras.filters import CustomFieldFilterSet, LocalConfigContextFilter, CreatedUpdatedFilter +from extras.filters import CustomFieldFilterSet, LocalConfigContextFilter, CreatedUpdatedFilterSet from tenancy.filtersets import TenancyFilterSet from tenancy.models import Tenant from utilities.constants import COLOR_CHOICES @@ -38,7 +38,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class SiteFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): +class SiteFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -116,7 +116,7 @@ class Meta: fields = ['id', 'name', 'slug', 'color'] -class RackFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): +class RackFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -251,7 +251,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class DeviceTypeFilter(CustomFieldFilterSet, CreatedUpdatedFilter): +class DeviceTypeFilter(CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -423,7 +423,7 @@ class Meta: fields = ['id', 'name', 'slug', 'napalm_driver'] -class DeviceFilter(LocalConfigContextFilter, TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): +class DeviceFilter(LocalConfigContextFilter, TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -1096,7 +1096,7 @@ def search(self, queryset, name, value): return queryset.filter(qs_filter) -class PowerFeedFilter(CustomFieldFilterSet, CreatedUpdatedFilter): +class PowerFeedFilter(CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/extras/filters.py b/netbox/extras/filters.py index 99e954f3dbd..8c805ebdf9a 100644 --- a/netbox/extras/filters.py +++ b/netbox/extras/filters.py @@ -243,7 +243,7 @@ def search(self, queryset, name, value): ) -class CreatedUpdatedFilter(django_filters.FilterSet): +class CreatedUpdatedFilterSet(django_filters.FilterSet): created = django_filters.DateFilter() created__gte = django_filters.DateFilter( field_name='created', diff --git a/netbox/ipam/filters.py b/netbox/ipam/filters.py index 52ff0dcc18f..c54ba2f6208 100644 --- a/netbox/ipam/filters.py +++ b/netbox/ipam/filters.py @@ -5,7 +5,7 @@ from netaddr.core import AddrFormatError from dcim.models import Site, Device, Interface -from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilter +from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilterSet from tenancy.filtersets import TenancyFilterSet from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter from virtualization.models import VirtualMachine @@ -13,7 +13,7 @@ from .models import Aggregate, IPAddress, Prefix, RIR, Role, Service, VLAN, VLANGroup, VRF -class VRFFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): +class VRFFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -49,7 +49,7 @@ class Meta: fields = ['name', 'slug', 'is_private'] -class AggregateFilter(CustomFieldFilterSet, CreatedUpdatedFilter): +class AggregateFilter(CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -110,7 +110,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class PrefixFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): +class PrefixFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -247,7 +247,7 @@ def filter_mask_length(self, queryset, name, value): return queryset.filter(prefix__net_mask_length=value) -class IPAddressFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): +class IPAddressFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -384,7 +384,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class VLANFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): +class VLANFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -444,7 +444,7 @@ def search(self, queryset, name, value): return queryset.filter(qs_filter) -class ServiceFilter(CreatedUpdatedFilter): +class ServiceFilter(CreatedUpdatedFilterSet): q = django_filters.CharFilter( method='search', label='Search', diff --git a/netbox/secrets/filters.py b/netbox/secrets/filters.py index 109eee2b299..bdc643e71b9 100644 --- a/netbox/secrets/filters.py +++ b/netbox/secrets/filters.py @@ -2,7 +2,7 @@ from django.db.models import Q from dcim.models import Device -from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilter +from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilterSet from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter from .models import Secret, SecretRole @@ -14,7 +14,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class SecretFilter(CustomFieldFilterSet, CreatedUpdatedFilter): +class SecretFilter(CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/tenancy/filters.py b/netbox/tenancy/filters.py index b3a59883842..ac7e6fabbe1 100644 --- a/netbox/tenancy/filters.py +++ b/netbox/tenancy/filters.py @@ -1,7 +1,7 @@ import django_filters from django.db.models import Q -from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilter +from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilterSet from utilities.filters import NameSlugSearchFilterSet, NumericInFilter, TagFilter from .models import Tenant, TenantGroup @@ -13,7 +13,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class TenantFilter(CustomFieldFilterSet, CreatedUpdatedFilter): +class TenantFilter(CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' diff --git a/netbox/virtualization/filters.py b/netbox/virtualization/filters.py index ef92884eef6..4f4ae03aec3 100644 --- a/netbox/virtualization/filters.py +++ b/netbox/virtualization/filters.py @@ -4,7 +4,7 @@ from netaddr.core import AddrFormatError from dcim.models import DeviceRole, Interface, Platform, Region, Site -from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilter +from extras.filters import CustomFieldFilterSet, CreatedUpdatedFilterSet from tenancy.filtersets import TenancyFilterSet from utilities.filters import ( MultiValueMACAddressFilter, NameSlugSearchFilterSet, NumericInFilter, TagFilter, TreeNodeMultipleChoiceFilter, @@ -27,7 +27,7 @@ class Meta: fields = ['id', 'name', 'slug'] -class ClusterFilter(CustomFieldFilterSet, CreatedUpdatedFilter): +class ClusterFilter(CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' @@ -81,7 +81,7 @@ def search(self, queryset, name, value): ) -class VirtualMachineFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilter): +class VirtualMachineFilter(TenancyFilterSet, CustomFieldFilterSet, CreatedUpdatedFilterSet): id__in = NumericInFilter( field_name='id', lookup_expr='in' From 4b415caad2b255af592fc0ea35b8744065f0095d Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 14 Nov 2019 22:01:37 -0500 Subject: [PATCH 18/34] Changelog for #3663 --- docs/release-notes/version-2.6.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 04f0ce99199..9cf95a106b2 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -5,6 +5,7 @@ * [#3139](https://github.com/netbox-community/netbox/issues/3139) - Disable password change form for LDAP-authenticated users * [#3457](https://github.com/netbox-community/netbox/issues/3457) - Display cable colors on device view * [#3329](https://github.com/netbox-community/netbox/issues/3329) - Remove obsolete P3P policy header +* [#3663](https://github.com/netbox-community/netbox/issues/3663) - Add query filters for `created` and `last_updated` fields ## Bug Fixes From b46e52eccce17380f77e119e874964193184dc95 Mon Sep 17 00:00:00 2001 From: hSaria <34197532+hSaria@users.noreply.github.com> Date: Wed, 20 Nov 2019 17:03:12 +0000 Subject: [PATCH 19/34] Fixed #3697: Correct field_order attribute name --- docs/additional-features/custom-scripts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/additional-features/custom-scripts.md b/docs/additional-features/custom-scripts.md index 8d453f66877..cdb49c82ad6 100644 --- a/docs/additional-features/custom-scripts.md +++ b/docs/additional-features/custom-scripts.md @@ -182,7 +182,7 @@ class NewBranchScript(Script): class Meta: name = "New Branch" description = "Provision a new branch site" - fields = ['site_name', 'switch_count', 'switch_model'] + field_order = ['site_name', 'switch_count', 'switch_model'] site_name = StringVar( description="Name of the new site" From 1d189483071434dbb95e042d2fbd32b6613e7b1b Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 26 Nov 2019 16:46:51 -0500 Subject: [PATCH 20/34] Fixes #3709: Prevent exception when importing an invalid cable definition --- docs/release-notes/version-2.6.md | 1 + netbox/dcim/models.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 575d23822e8..5097e699ef1 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -12,6 +12,7 @@ * [#3669](https://github.com/netbox-community/netbox/issues/3669) - Include `weight` field in prefix/VLAN role form * [#3674](https://github.com/netbox-community/netbox/issues/3674) - Include comments on PowerFeed view * [#3679](https://github.com/netbox-community/netbox/issues/3679) - Fix link for assigned ipaddress in interface page +* [#3709](https://github.com/netbox-community/netbox/issues/3709) - Prevent exception when importing an invalid cable definition # v2.6.7 (2019-11-01) diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 45b241d4226..b1b9a70bfa0 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -2838,6 +2838,8 @@ def get_absolute_url(self): def clean(self): # Validate that termination A exists + if not hasattr(self, 'termination_a_type'): + raise ValidationError('Termination A type has not been specified') try: self.termination_a_type.model_class().objects.get(pk=self.termination_a_id) except ObjectDoesNotExist: @@ -2846,6 +2848,8 @@ def clean(self): }) # Validate that termination B exists + if not hasattr(self, 'termination_b_type'): + raise ValidationError('Termination B type has not been specified') try: self.termination_b_type.model_class().objects.get(pk=self.termination_b_id) except ObjectDoesNotExist: From 15722c1871a9839ee55b96e6a470da9b71bfce10 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 26 Nov 2019 16:56:11 -0500 Subject: [PATCH 21/34] Fixes #3720: Correctly indicate power feed terminations on cable list --- docs/release-notes/version-2.6.md | 1 + netbox/dcim/tables.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 5097e699ef1..5ef94ae4d50 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -13,6 +13,7 @@ * [#3674](https://github.com/netbox-community/netbox/issues/3674) - Include comments on PowerFeed view * [#3679](https://github.com/netbox-community/netbox/issues/3679) - Fix link for assigned ipaddress in interface page * [#3709](https://github.com/netbox-community/netbox/issues/3709) - Prevent exception when importing an invalid cable definition +* [#3720](https://github.com/netbox-community/netbox/issues/3720) - Correctly indicate power feed terminations on cable list # v2.6.7 (2019-11-01) diff --git a/netbox/dcim/tables.py b/netbox/dcim/tables.py index 70a9aa5c841..9b3b405aa27 100644 --- a/netbox/dcim/tables.py +++ b/netbox/dcim/tables.py @@ -181,8 +181,10 @@ CABLE_TERMINATION_PARENT = """ {% if value.device %} {{ value.device }} -{% else %} +{% elif value.circuit %} {{ value.circuit }} +{% elif value.power_panel %} + {{ value.power_panel }} {% endif %} """ @@ -718,7 +720,7 @@ class CableTable(BaseTable): orderable=False, verbose_name='Termination A' ) - termination_a = tables.Column( + termination_a = tables.LinkColumn( accessor=Accessor('termination_a'), orderable=False, verbose_name='' @@ -729,7 +731,7 @@ class CableTable(BaseTable): orderable=False, verbose_name='Termination B' ) - termination_b = tables.Column( + termination_b = tables.LinkColumn( accessor=Accessor('termination_b'), orderable=False, verbose_name='' From b2caaa6733530ea0a59451c00c5a03150017446a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 27 Nov 2019 09:19:34 -0500 Subject: [PATCH 22/34] Fixes #3312: Fix validation error when editing power cables in bulk --- docs/release-notes/version-2.6.md | 1 + netbox/dcim/constants.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 5ef94ae4d50..cc3111872e1 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -9,6 +9,7 @@ ## Bug Fixes +* [#3312](https://github.com/netbox-community/netbox/issues/3312) - Fix validation error when editing power cables in bulk * [#3669](https://github.com/netbox-community/netbox/issues/3669) - Include `weight` field in prefix/VLAN role form * [#3674](https://github.com/netbox-community/netbox/issues/3674) - Include comments on PowerFeed view * [#3679](https://github.com/netbox-community/netbox/issues/3679) - Fix link for assigned ipaddress in interface page diff --git a/netbox/dcim/constants.py b/netbox/dcim/constants.py index 034911a2627..ccaa4863647 100644 --- a/netbox/dcim/constants.py +++ b/netbox/dcim/constants.py @@ -384,7 +384,8 @@ # Cable endpoint types CABLE_TERMINATION_TYPES = [ - 'consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport', 'circuittermination', + 'consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport', + 'circuittermination', 'powerfeed', ] # Cable types From 1048d3909b9e5fe96acc793c35bbbe9820dacefb Mon Sep 17 00:00:00 2001 From: John Anderson Date: Wed, 4 Dec 2019 02:00:08 -0500 Subject: [PATCH 23/34] fixes #3724 - allow filtering interfaces by more than one device name --- docs/release-notes/version-2.6.md | 1 + netbox/dcim/filters.py | 12 +++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index cc3111872e1..3eee2df6fe6 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -15,6 +15,7 @@ * [#3679](https://github.com/netbox-community/netbox/issues/3679) - Fix link for assigned ipaddress in interface page * [#3709](https://github.com/netbox-community/netbox/issues/3709) - Prevent exception when importing an invalid cable definition * [#3720](https://github.com/netbox-community/netbox/issues/3720) - Correctly indicate power feed terminations on cable list +* [#3724](https://github.com/netbox-community/netbox/issues/3724) - Fix API filtering of interfaces by more than one device name # v2.6.7 (2019-11-01) diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py index 8bcf0a0fc52..cea279ddd30 100644 --- a/netbox/dcim/filters.py +++ b/netbox/dcim/filters.py @@ -7,8 +7,8 @@ from tenancy.models import Tenant from utilities.constants import COLOR_CHOICES from utilities.filters import ( - MultiValueMACAddressFilter, MultiValueNumberFilter, NameSlugSearchFilterSet, NumericInFilter, TagFilter, - TreeNodeMultipleChoiceFilter, + MultiValueCharFilter, MultiValueMACAddressFilter, MultiValueNumberFilter, NameSlugSearchFilterSet, NumericInFilter, + TagFilter, TreeNodeMultipleChoiceFilter, ) from virtualization.models import Cluster from .constants import * @@ -696,7 +696,7 @@ class InterfaceFilter(django_filters.FilterSet): method='search', label='Search', ) - device = django_filters.CharFilter( + device = MultiValueCharFilter( method='filter_device', field_name='name', label='Device', @@ -749,8 +749,10 @@ def search(self, queryset, name, value): def filter_device(self, queryset, name, value): try: - device = Device.objects.get(**{name: value}) - vc_interface_ids = device.vc_interfaces.values_list('id', flat=True) + devices = Device.objects.filter(**{'{}__in'.format(name): value}) + vc_interface_ids = [] + for device in devices: + vc_interface_ids.extend(device.vc_interfaces.values_list('id', flat=True)) return queryset.filter(pk__in=vc_interface_ids) except Device.DoesNotExist: return queryset.none() From 9e765b1704fbd5f08b1c4f3635b32b3486cee4ed Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 5 Dec 2019 21:07:43 -0500 Subject: [PATCH 24/34] Fixes #3730: Add link to docs page for custom links --- mkdocs.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/mkdocs.yml b/mkdocs.yml index b03f357fe42..cc44921b64d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -31,6 +31,7 @@ pages: - Change Logging: 'additional-features/change-logging.md' - Context Data: 'additional-features/context-data.md' - Custom Fields: 'additional-features/custom-fields.md' + - Custom Links: 'additional-features/custom-links.md' - Custom Scripts: 'additional-features/custom-scripts.md' - Export Templates: 'additional-features/export-templates.md' - Graphs: 'additional-features/graphs.md' From a97ebc6d4cf4aecbb35f4de7e5ebe5b6410f09bf Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 5 Dec 2019 21:14:29 -0500 Subject: [PATCH 25/34] Fixes #3722: Allow the underscore character in IPAddress DNS names --- docs/release-notes/version-2.6.md | 1 + netbox/ipam/validators.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 3eee2df6fe6..cf03ea8f22c 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -6,6 +6,7 @@ * [#3457](https://github.com/netbox-community/netbox/issues/3457) - Display cable colors on device view * [#3329](https://github.com/netbox-community/netbox/issues/3329) - Remove obsolete P3P policy header * [#3663](https://github.com/netbox-community/netbox/issues/3663) - Add query filters for `created` and `last_updated` fields +* [#3722](https://github.com/netbox-community/netbox/issues/3722) - Allow the underscore character in IPAddress DNS names ## Bug Fixes diff --git a/netbox/ipam/validators.py b/netbox/ipam/validators.py index 6669b7ec5d4..4659a91775e 100644 --- a/netbox/ipam/validators.py +++ b/netbox/ipam/validators.py @@ -2,7 +2,7 @@ DNSValidator = RegexValidator( - regex='^[0-9A-Za-z.-]+$', - message='Only alphanumeric characters, hyphens, and periods are allowed in DNS names', + regex='^[0-9A-Za-z.-_]+$', + message='Only alphanumeric characters, hyphens, periods, and underscores are allowed in DNS names', code='invalid' ) From 7a4b202064ed8a7d634290d09a1962eb130d2e9e Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 5 Dec 2019 21:22:34 -0500 Subject: [PATCH 26/34] Fixes #3725: Enforce client validation for minimum service port number --- docs/release-notes/version-2.6.md | 1 + netbox/ipam/forms.py | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index cf03ea8f22c..66e0476616c 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -17,6 +17,7 @@ * [#3709](https://github.com/netbox-community/netbox/issues/3709) - Prevent exception when importing an invalid cable definition * [#3720](https://github.com/netbox-community/netbox/issues/3720) - Correctly indicate power feed terminations on cable list * [#3724](https://github.com/netbox-community/netbox/issues/3724) - Fix API filtering of interfaces by more than one device name +* [#3725](https://github.com/netbox-community/netbox/issues/3725) - Enforce client validation for minimum service port number # v2.6.7 (2019-11-01) diff --git a/netbox/ipam/forms.py b/netbox/ipam/forms.py index bedbe34636f..68529a7f0a8 100644 --- a/netbox/ipam/forms.py +++ b/netbox/ipam/forms.py @@ -1250,6 +1250,10 @@ class VLANFilterForm(BootstrapMixin, TenancyFilterForm, CustomFieldFilterForm): # class ServiceForm(BootstrapMixin, CustomFieldForm): + port = forms.IntegerField( + min_value=1, + max_value=65535 + ) tags = TagField( required=False ) From 16353ce63c28105c67825c46f4bb3e6f8f4af3f6 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Thu, 5 Dec 2019 21:43:22 -0500 Subject: [PATCH 27/34] Correct stalebot config file name --- .github/{stale.yaml => stale.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{stale.yaml => stale.yml} (100%) diff --git a/.github/stale.yaml b/.github/stale.yml similarity index 100% rename from .github/stale.yaml rename to .github/stale.yml From f8c5ca942a3dff3a006484efeadb5851f58332d3 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 6 Dec 2019 12:19:29 -0500 Subject: [PATCH 28/34] #3722: Update migration with new validator (does not impact database) --- netbox/ipam/migrations/0027_ipaddress_add_dns_name.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/ipam/migrations/0027_ipaddress_add_dns_name.py b/netbox/ipam/migrations/0027_ipaddress_add_dns_name.py index 534957ce14d..4eaa1498df3 100644 --- a/netbox/ipam/migrations/0027_ipaddress_add_dns_name.py +++ b/netbox/ipam/migrations/0027_ipaddress_add_dns_name.py @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ipaddress', name='dns_name', - field=models.CharField(blank=True, max_length=255, validators=[django.core.validators.RegexValidator(code='invalid', message='Only alphanumeric characters, hyphens, and periods are allowed in DNS names', regex='^[0-9A-Za-z.-]+$')]), + field=models.CharField(blank=True, max_length=255, validators=[django.core.validators.RegexValidator(code='invalid', message='Only alphanumeric characters, hyphens, periods, and underscores are allowed in DNS names', regex='^[0-9A-Za-z.-_]+$')]), ), ] From 9b26225fddbec2e297ab73864e730fb14b1e0fe9 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 6 Dec 2019 12:29:31 -0500 Subject: [PATCH 29/34] #3720: Update migration to add powerfeeds to termination_type limit list (does not impact database) --- netbox/dcim/migrations/0066_cables.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/migrations/0066_cables.py b/netbox/dcim/migrations/0066_cables.py index 096344a0687..b30a2a8faca 100644 --- a/netbox/dcim/migrations/0066_cables.py +++ b/netbox/dcim/migrations/0066_cables.py @@ -174,8 +174,8 @@ class Migration(migrations.Migration): ('length', models.PositiveSmallIntegerField(blank=True, null=True)), ('length_unit', models.PositiveSmallIntegerField(blank=True, null=True)), ('_abs_length', models.DecimalField(blank=True, decimal_places=4, max_digits=10, null=True)), - ('termination_a_type', models.ForeignKey(limit_choices_to={'model__in': ['consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport', 'circuittermination']}, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.ContentType')), - ('termination_b_type', models.ForeignKey(limit_choices_to={'model__in': ['consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport', 'circuittermination']}, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.ContentType')), + ('termination_a_type', models.ForeignKey(limit_choices_to={'model__in': ['consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport', 'circuittermination', 'powerfeed']}, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.ContentType')), + ('termination_b_type', models.ForeignKey(limit_choices_to={'model__in': ['consoleport', 'consoleserverport', 'interface', 'poweroutlet', 'powerport', 'frontport', 'rearport', 'circuittermination', 'powerfeed']}, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='contenttypes.ContentType')), ], ), migrations.AlterUniqueTogether( From d71e6698f43cf1c74d441e958fbf3d64b9ac7c1f Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 6 Dec 2019 12:42:59 -0500 Subject: [PATCH 30/34] Extend git commit hook to check for missing schema migrations --- scripts/git-hooks/pre-commit | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index 5974f91d8ee..e6074ef9fa5 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -12,3 +12,5 @@ exec 1>&2 echo "Validating PEP8 compliance..." pycodestyle --ignore=W504,E501 netbox/ +echo "Checking for missing migrations..." +python netbox/manage.py makemigrations --dry-run --check From f2076c95720181037b6c8a688c836739b906d106 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 6 Dec 2019 12:54:13 -0500 Subject: [PATCH 31/34] Fixed git commit hook --- scripts/git-hooks/pre-commit | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/scripts/git-hooks/pre-commit b/scripts/git-hooks/pre-commit index e6074ef9fa5..7dfa5e8aa01 100755 --- a/scripts/git-hooks/pre-commit +++ b/scripts/git-hooks/pre-commit @@ -9,8 +9,24 @@ exec 1>&2 +EXIT=0 +RED='\033[0;31m' +NOCOLOR='\033[0m' + echo "Validating PEP8 compliance..." pycodestyle --ignore=W504,E501 netbox/ +if [ $? != 0 ]; then + EXIT=1 +fi echo "Checking for missing migrations..." python netbox/manage.py makemigrations --dry-run --check +if [ $? != 0 ]; then + EXIT=1 +fi + +if [ $EXIT != 0 ]; then + printf "${RED}COMMIT FAILED${NOCOLOR}\n" +fi + +exit $EXIT From 95edec54485529f69f9df526ebbc69772b36bc6c Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 9 Dec 2019 10:02:56 -0500 Subject: [PATCH 32/34] #3722: Tweak ordering of permitted characters to avoid creating a regex range --- netbox/ipam/migrations/0027_ipaddress_add_dns_name.py | 2 +- netbox/ipam/validators.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/ipam/migrations/0027_ipaddress_add_dns_name.py b/netbox/ipam/migrations/0027_ipaddress_add_dns_name.py index 4eaa1498df3..c93034f3df8 100644 --- a/netbox/ipam/migrations/0027_ipaddress_add_dns_name.py +++ b/netbox/ipam/migrations/0027_ipaddress_add_dns_name.py @@ -14,6 +14,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='ipaddress', name='dns_name', - field=models.CharField(blank=True, max_length=255, validators=[django.core.validators.RegexValidator(code='invalid', message='Only alphanumeric characters, hyphens, periods, and underscores are allowed in DNS names', regex='^[0-9A-Za-z.-_]+$')]), + field=models.CharField(blank=True, max_length=255, validators=[django.core.validators.RegexValidator(code='invalid', message='Only alphanumeric characters, hyphens, periods, and underscores are allowed in DNS names', regex='^[0-9A-Za-z._-]+$')]), ), ] diff --git a/netbox/ipam/validators.py b/netbox/ipam/validators.py index 4659a91775e..96067564360 100644 --- a/netbox/ipam/validators.py +++ b/netbox/ipam/validators.py @@ -2,7 +2,7 @@ DNSValidator = RegexValidator( - regex='^[0-9A-Za-z.-_]+$', + regex='^[0-9A-Za-z._-]+$', message='Only alphanumeric characters, hyphens, periods, and underscores are allowed in DNS names', code='invalid' ) From f25e2a19225d31f1be72663aeb25e715992e78da Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 9 Dec 2019 15:42:04 -0500 Subject: [PATCH 33/34] Fixes #3644: Fix exception when connecting a cable to a RearPort with no corresponding FrontPort --- docs/release-notes/version-2.6.md | 1 + netbox/dcim/models.py | 6 ++++++ netbox/dcim/signals.py | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 66e0476616c..3b0ae8ad358 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -11,6 +11,7 @@ ## Bug Fixes * [#3312](https://github.com/netbox-community/netbox/issues/3312) - Fix validation error when editing power cables in bulk +* [#3644](https://github.com/netbox-community/netbox/issues/3644) - Fix exception when connecting a cable to a RearPort with no corresponding FrontPort * [#3669](https://github.com/netbox-community/netbox/issues/3669) - Include `weight` field in prefix/VLAN role form * [#3674](https://github.com/netbox-community/netbox/issues/3674) - Include comments on PowerFeed view * [#3679](https://github.com/netbox-community/netbox/issues/3679) - Fix link for assigned ipaddress in interface page diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index b1b9a70bfa0..ad2a3d769d0 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -98,6 +98,8 @@ class CableTermination(models.Model): object_id_field='termination_b_id' ) + is_path_endpoint = True + class Meta: abstract = True @@ -2444,6 +2446,8 @@ class FrontPort(CableTermination, ComponentModel): validators=[MinValueValidator(1), MaxValueValidator(64)] ) + is_path_endpoint = False + objects = NaturalOrderingManager() tags = TaggableManager(through=TaggedItem) @@ -2506,6 +2510,8 @@ class RearPort(CableTermination, ComponentModel): validators=[MinValueValidator(1), MaxValueValidator(64)] ) + is_path_endpoint = False + objects = NaturalOrderingManager() tags = TaggableManager(through=TaggedItem) diff --git a/netbox/dcim/signals.py b/netbox/dcim/signals.py index c1aabf64d05..71ee7ec3c3f 100644 --- a/netbox/dcim/signals.py +++ b/netbox/dcim/signals.py @@ -45,7 +45,7 @@ def update_connected_endpoints(instance, **kwargs): # Check if this Cable has formed a complete path. If so, update both endpoints. endpoint_a, endpoint_b, path_status = instance.get_path_endpoints() - if endpoint_a is not None and endpoint_b is not None: + if getattr(endpoint_a, 'is_path_endpoint', False) and getattr(endpoint_b, 'is_path_endpoint', False): endpoint_a.connected_endpoint = endpoint_b endpoint_a.connection_status = path_status endpoint_a.save() From 6a2651991a4f7a22000dd9bcc834a8078d2430d8 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Tue, 10 Dec 2019 10:42:48 -0500 Subject: [PATCH 34/34] Release v2.6.8 --- docs/release-notes/version-2.6.md | 2 +- netbox/netbox/settings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.6.md b/docs/release-notes/version-2.6.md index 3b0ae8ad358..f499ec1cae4 100644 --- a/docs/release-notes/version-2.6.md +++ b/docs/release-notes/version-2.6.md @@ -1,4 +1,4 @@ -# v2.6.8 (FUTURE) +# v2.6.8 (2019-12-10) ## Enhancements diff --git a/netbox/netbox/settings.py b/netbox/netbox/settings.py index 721ec052a6c..9e17e4bb48f 100644 --- a/netbox/netbox/settings.py +++ b/netbox/netbox/settings.py @@ -12,7 +12,7 @@ # Environment setup # -VERSION = '2.6.8-dev' +VERSION = '2.6.8' # Hostname HOSTNAME = platform.node()