Skip to content

Commit 312291b

Browse files
committed
Merge branch 'develop' into feature
2 parents 1add918 + 39a8307 commit 312291b

File tree

38 files changed

+800
-580
lines changed

38 files changed

+800
-580
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ body:
2626
attributes:
2727
label: NetBox Version
2828
description: What version of NetBox are you currently running?
29-
placeholder: v3.7.6
29+
placeholder: v3.7.7
3030
validations:
3131
required: true
3232
- type: dropdown

.github/ISSUE_TEMPLATE/feature_request.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ body:
1414
attributes:
1515
label: NetBox version
1616
description: What version of NetBox are you currently running?
17-
placeholder: v3.7.6
17+
placeholder: v3.7.7
1818
validations:
1919
required: true
2020
- type: dropdown

contrib/gunicorn.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@
1414
# The maximum number of requests a worker can handle before being respawned
1515
max_requests = 5000
1616
max_requests_jitter = 500
17+
18+
# Uncomment this line to accept HTTP headers containing underscores, e.g. for remote
19+
# authentication support. See https://docs.gunicorn.org/en/stable/settings.html#header-map
20+
# header-map = 'dangerous'

docs/administration/authentication/overview.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@ REMOTE_AUTH_BACKEND = 'netbox.authentication.RemoteUserBackend'
2626

2727
Another option for remote authentication in NetBox is to enable HTTP header-based user assignment. The front end HTTP server (e.g. nginx or Apache) performs client authentication as a process external to NetBox, and passes information about the authenticated user via HTTP headers. By default, the user is assigned via the `REMOTE_USER` header, but this can be customized via the `REMOTE_AUTH_HEADER` configuration parameter.
2828

29-
Optionally, user profile information can be supplied by `REMOTE_USER_FIRST_NAME`, `REMOTE_USER_LAST_NAME` and `REMOTE_USER_EMAIL` headers. These are saved to the users profile during the authentication process. These headers can be customized like the `REMOTE_USER` header.
29+
Optionally, user profile information can be supplied by `REMOTE_USER_FIRST_NAME`, `REMOTE_USER_LAST_NAME` and `REMOTE_USER_EMAIL` headers. These are saved to the user's profile during the authentication process. These headers can be customized like the `REMOTE_USER` header.
30+
31+
!!! warning Verify Header Compatibility
32+
Some WSGI servers may drop headers which contain unsupported characters. For instance, gunicorn v22.0 and later silently drops HTTP headers containing underscores. This behavior can be disabled by changing gunicorn's [`header_map`](https://docs.gunicorn.org/en/stable/settings.html#header-map) setting to `dangerous`.
3033

3134
### Single Sign-On (SSO)
3235

docs/configuration/remote-authentication.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ Default: `'HTTP_REMOTE_USER'`
8585

8686
When remote user authentication is in use, this is the name of the HTTP header which informs NetBox of the currently authenticated user. For example, to use the request header `X-Remote-User` it needs to be set to `HTTP_X_REMOTE_USER`. (Requires `REMOTE_AUTH_ENABLED`.)
8787

88+
!!! warning Verify Header Compatibility
89+
Some WSGI servers may drop headers which contain unsupported characters. For instance, gunicorn v22.0 and later silently drops HTTP headers containing underscores. This behavior can be disabled by changing gunicorn's [`header_map`](https://docs.gunicorn.org/en/stable/settings.html#header-map) setting to `dangerous`.
90+
8891
---
8992

9093
## REMOTE_AUTH_USER_EMAIL

docs/customization/custom-scripts.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,14 @@ An IPv4 or IPv6 network with a mask. Returns a `netaddr.IPNetwork` object. Two a
371371
* `min_prefix_length` - Minimum length of the mask
372372
* `max_prefix_length` - Maximum length of the mask
373373

374+
### DateVar
375+
376+
A calendar date. Returns a `datetime.date` object.
377+
378+
### DateTimeVar
379+
380+
A complete date & time. Returns a `datetime.datetime` object.
381+
374382
## Running Custom Scripts
375383

376384
!!! note

docs/release-notes/version-3.7.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,36 @@
11
# NetBox v3.7
22

3-
## v3.7.7 (FUTURE)
3+
## v3.7.7 (2024-05-01)
4+
5+
### Enhancements
6+
7+
* [#15428](https://github.com/netbox-community/netbox/issues/15428) - Show usage counts for associated objects on config template list
8+
* [#15812](https://github.com/netbox-community/netbox/issues/15812) - Add Date & DateTime variable types for custom scripts
9+
* [#15894](https://github.com/netbox-community/netbox/issues/15894) - Cache the generated API schema definition for shorter loading times
10+
11+
### Bug Fixes
12+
13+
* [#11460](https://github.com/netbox-community/netbox/issues/11460) - Fix AttributeError exception when editing a cable with only one end terminated
14+
* [#13712](https://github.com/netbox-community/netbox/issues/13712) - Fix row highlighting for device interface list display
15+
* [#13806](https://github.com/netbox-community/netbox/issues/13806) - Fix "mark" button tooltip on button activation for device interface list display
16+
* [#13922](https://github.com/netbox-community/netbox/issues/13922) - Fix SVG drawing error on multiple termination trace with multiple devices
17+
* [#14241](https://github.com/netbox-community/netbox/issues/14241) - Fix random interface swap when performing cable trace with multiple termination
18+
* [#14852](https://github.com/netbox-community/netbox/issues/14852) - Fix NoReverseMatch exception when viewing an event rule which references a deleted custom script
19+
* [#15524](https://github.com/netbox-community/netbox/issues/15524) - Fix rounding error when reporting IP range utilization
20+
* [#15548](https://github.com/netbox-community/netbox/issues/15548) - Ignore many-to-many mappings when checking dependencies of an object being deleted
21+
* [#15845](https://github.com/netbox-community/netbox/issues/15845) - Avoid extraneous database queries when fetching assigned IP addresses via REST API
22+
* [#15872](https://github.com/netbox-community/netbox/issues/15872) - `BANNER_MAINTENANCE` content should permit custom HTML
23+
* [#15891](https://github.com/netbox-community/netbox/issues/15891) - Ensure deterministic ordering for scripts & reports
24+
* [#15896](https://github.com/netbox-community/netbox/issues/15896) - Fix retention of default value when editing a custom JSON field
25+
* [#15899](https://github.com/netbox-community/netbox/issues/15899) - Fix exception when enabling the tags column on the L2VPN terminations table
426

527
---
628

729
## v3.7.6 (2024-04-22)
830

31+
!!! warning
32+
If remote authentication is in use with Gunicorn v22.0 or later, it may be necessary to configure Gunicorn's [`header_map`](https://docs.gunicorn.org/en/stable/settings.html#header-map) setting to preserve authentication headers.
33+
934
### Enhancements
1035

1136
* [#14690](https://github.com/netbox-community/netbox/issues/14690) - Improve rendering of JSON data in configuration form

netbox/dcim/forms/connections.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django import forms
2+
from django.contrib.contenttypes.models import ContentType
23
from django.utils.translation import gettext_lazy as _
34

45
from circuits.models import Circuit, CircuitTermination
@@ -88,14 +89,22 @@ def __new__(mcs, name, bases, attrs):
8889

8990
class _CableForm(CableForm, metaclass=FormMetaclass):
9091

91-
def __init__(self, *args, **kwargs):
92+
def __init__(self, *args, initial=None, **kwargs):
93+
94+
initial = initial or {}
95+
if a_type:
96+
ct = ContentType.objects.get_for_model(a_type)
97+
initial['a_terminations_type'] = f'{ct.app_label}.{ct.model}'
98+
if b_type:
99+
ct = ContentType.objects.get_for_model(b_type)
100+
initial['b_terminations_type'] = f'{ct.app_label}.{ct.model}'
92101

93102
# TODO: Temporary hack to work around list handling limitations with utils.normalize_querydict()
94103
for field_name in ('a_terminations', 'b_terminations'):
95-
if field_name in kwargs.get('initial', {}) and type(kwargs['initial'][field_name]) is not list:
96-
kwargs['initial'][field_name] = [kwargs['initial'][field_name]]
104+
if field_name in initial and type(initial[field_name]) is not list:
105+
initial[field_name] = [initial[field_name]]
97106

98-
super().__init__(*args, **kwargs)
107+
super().__init__(*args, initial=initial, **kwargs)
99108

100109
if self.instance and self.instance.pk:
101110
# Initialize A/B terminations when modifying an existing Cable instance
@@ -106,7 +115,7 @@ def clean(self):
106115
super().clean()
107116

108117
# Set the A/B terminations on the Cable instance
109-
self.instance.a_terminations = self.cleaned_data['a_terminations']
110-
self.instance.b_terminations = self.cleaned_data['b_terminations']
118+
self.instance.a_terminations = self.cleaned_data.get('a_terminations', [])
119+
self.instance.b_terminations = self.cleaned_data.get('b_terminations', [])
111120

112121
return _CableForm

netbox/dcim/forms/model_forms.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,33 @@ def __init__(self, *args, **kwargs):
628628
self.fields['adopt_components'].disabled = True
629629

630630

631+
def get_termination_type_choices():
632+
return add_blank_choice([
633+
(f'{ct.app_label}.{ct.model}', ct.model_class()._meta.verbose_name.title())
634+
for ct in ContentType.objects.filter(CABLE_TERMINATION_MODELS)
635+
])
636+
637+
631638
class CableForm(TenancyForm, NetBoxModelForm):
639+
a_terminations_type = forms.ChoiceField(
640+
choices=get_termination_type_choices,
641+
required=False,
642+
widget=HTMXSelect(),
643+
label=_('Type')
644+
)
645+
b_terminations_type = forms.ChoiceField(
646+
choices=get_termination_type_choices,
647+
required=False,
648+
widget=HTMXSelect(),
649+
label=_('Type')
650+
)
632651
comments = CommentField()
633652

634653
class Meta:
635654
model = Cable
636655
fields = [
637-
'type', 'status', 'tenant_group', 'tenant', 'label', 'color', 'length', 'length_unit', 'description',
638-
'comments', 'tags',
656+
'a_terminations_type', 'b_terminations_type', 'type', 'status', 'tenant_group', 'tenant', 'label', 'color',
657+
'length', 'length_unit', 'description', 'comments', 'tags',
639658
]
640659
error_messages = {
641660
'length': {

0 commit comments

Comments
 (0)