Skip to content

Commit 39ca3ce

Browse files
committed
Merge branch 'develop' into feature
2 parents 0219dd7 + e63fe23 commit 39ca3ce

File tree

64 files changed

+89446
-76844
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+89446
-76844
lines changed

.github/ISSUE_TEMPLATE/01-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: v4.1.7
17+
placeholder: v4.1.8
1818
validations:
1919
required: true
2020
- type: dropdown

.github/ISSUE_TEMPLATE/02-bug_report.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ body:
3939
attributes:
4040
label: NetBox Version
4141
description: What version of NetBox are you currently running?
42-
placeholder: v4.1.7
42+
placeholder: v4.1.8
4343
validations:
4444
required: true
4545
- type: dropdown

.github/workflows/update-translation-strings.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,17 @@ jobs:
1818
NETBOX_CONFIGURATION: netbox.configuration_testing
1919

2020
steps:
21+
- name: Create app token
22+
uses: actions/create-github-app-token@v1
23+
id: app-token
24+
with:
25+
app-id: 1076524
26+
private-key: ${{ secrets.HOUSEKEEPING_SECRET_KEY }}
27+
2128
- name: Check out repo
2229
uses: actions/checkout@v4
30+
with:
31+
token: ${{ steps.app-token.outputs.token }}
2332

2433
- name: Set up Python
2534
uses: actions/setup-python@v5

docs/development/application-registry.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ This key lists all models which have been registered in NetBox which are not des
4949

5050
This store maintains all registered items for plugins, such as navigation menus, template extensions, etc.
5151

52+
### `request_processors`
53+
54+
A list of context managers to invoke when processing a request e.g. in middleware or when executing a background job. Request processors can be registered with the `@register_request_processor` decorator.
55+
5256
### `search`
5357

5458
A dictionary mapping each model (identified by its app and label) to its search index class, if one has been registered for it.

docs/release-notes/version-4.1.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,32 @@
11
# NetBox v4.1
22

3-
## v4.1.7 (FUTURE)
3+
## v4.1.8 (2024-12-12)
4+
5+
### Enhancements
6+
7+
* [#17071](https://github.com/netbox-community/netbox/issues/17071) - Enable OOB IP address designation during bulk import
8+
* [#17465](https://github.com/netbox-community/netbox/issues/17465) - Enable designation of rack type during bulk import & bulk edit
9+
* [#17889](https://github.com/netbox-community/netbox/issues/17889) - Enable designating an IP address as out-of-band for a device upon creation
10+
* [#17960](https://github.com/netbox-community/netbox/issues/17960) - Add L2TP, PPTP, Wireguard, and OpenVPN tunnel types
11+
* [#18021](https://github.com/netbox-community/netbox/issues/18021) - Automatically clear cache on restart when `DEBUG` is enabled
12+
* [#18061](https://github.com/netbox-community/netbox/issues/18061) - Omit stack trace from rendered device/VM configuration when an exception is raised
13+
* [#18065](https://github.com/netbox-community/netbox/issues/18065) - Include status in device details when hovering on rack elevation
14+
* [#18211](https://github.com/netbox-community/netbox/issues/18211) - Enable the dynamic registration of context managers for request processing
15+
16+
### Bug Fixes
17+
18+
* [#14044](https://github.com/netbox-community/netbox/issues/14044) - Fix unhandled AttributeError exception when bulk renaming objects
19+
* [#17490](https://github.com/netbox-community/netbox/issues/17490) - Fix dynamic inclusion support for config templates
20+
* [#17810](https://github.com/netbox-community/netbox/issues/17810) - Fix validation of racked device fields when modifying via REST API
21+
* [#17820](https://github.com/netbox-community/netbox/issues/17820) - Ensure default custom field values are populated when creating new modules
22+
* [#18044](https://github.com/netbox-community/netbox/issues/18044) - Show plugin-generated alerts within UI views for custom scripts
23+
* [#18150](https://github.com/netbox-community/netbox/issues/18150) - Fix REST API pagination for low `MAX_PAGE_SIZE` values
24+
* [#18183](https://github.com/netbox-community/netbox/issues/18183) - Omit UI navigation bar when printing
25+
* [#18213](https://github.com/netbox-community/netbox/issues/18213) - Fix searching for ASN ranges by name
26+
27+
---
28+
29+
## v4.1.7 (2024-11-21)
430

531
### Enhancements
632

netbox/core/apps.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
from django.apps import AppConfig
2+
from django.conf import settings
3+
from django.core.cache import cache
24
from django.db import models
35
from django.db.migrations.operations import AlterModelOptions
46

@@ -22,3 +24,7 @@ def ready(self):
2224

2325
# Register models
2426
register_models(*self.get_models())
27+
28+
# Clear Redis cache on startup in development mode
29+
if settings.DEBUG:
30+
cache.clear()

netbox/dcim/forms/bulk_edit.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,11 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
362362
queryset=RackRole.objects.all(),
363363
required=False
364364
)
365+
rack_type = DynamicModelChoiceField(
366+
label=_('Rack type'),
367+
queryset=RackType.objects.all(),
368+
required=False,
369+
)
365370
serial = forms.CharField(
366371
max_length=50,
367372
required=False,
@@ -441,7 +446,7 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
441446

442447
model = Rack
443448
fieldsets = (
444-
FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'description', name=_('Rack')),
449+
FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'rack_type', 'description', name=_('Rack')),
445450
FieldSet('region', 'site_group', 'site', 'location', name=_('Location')),
446451
FieldSet(
447452
'form_factor', 'width', 'u_height', 'desc_units', 'airflow', 'outer_width', 'outer_depth', 'outer_unit',

netbox/dcim/forms/bulk_import.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,13 @@ class RackImportForm(NetBoxModelImportForm):
258258
to_field_name='name',
259259
help_text=_('Name of assigned role')
260260
)
261+
rack_type = CSVModelChoiceField(
262+
label=_('Rack type'),
263+
queryset=RackType.objects.all(),
264+
to_field_name='model',
265+
required=False,
266+
help_text=_('Rack type model')
267+
)
261268
form_factor = CSVChoiceField(
262269
label=_('Type'),
263270
choices=RackFormFactorChoices,
@@ -267,8 +274,13 @@ class RackImportForm(NetBoxModelImportForm):
267274
width = forms.ChoiceField(
268275
label=_('Width'),
269276
choices=RackWidthChoices,
277+
required=False,
270278
help_text=_('Rail-to-rail width (in inches)')
271279
)
280+
u_height = forms.IntegerField(
281+
required=False,
282+
label=_('Height (U)')
283+
)
272284
outer_unit = CSVChoiceField(
273285
label=_('Outer unit'),
274286
choices=RackDimensionUnitChoices,
@@ -291,9 +303,9 @@ class RackImportForm(NetBoxModelImportForm):
291303
class Meta:
292304
model = Rack
293305
fields = (
294-
'site', 'location', 'name', 'facility_id', 'tenant', 'status', 'role', 'form_factor', 'serial', 'asset_tag',
295-
'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'airflow',
296-
'weight', 'max_weight', 'weight_unit', 'description', 'comments', 'tags',
306+
'site', 'location', 'name', 'facility_id', 'tenant', 'status', 'role', 'rack_type', 'form_factor', 'serial',
307+
'asset_tag', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit',
308+
'mounting_depth', 'airflow', 'weight', 'max_weight', 'weight_unit', 'description', 'comments', 'tags',
297309
)
298310

299311
def __init__(self, data=None, *args, **kwargs):
@@ -305,6 +317,16 @@ def __init__(self, data=None, *args, **kwargs):
305317
params = {f"site__{self.fields['site'].to_field_name}": data.get('site')}
306318
self.fields['location'].queryset = self.fields['location'].queryset.filter(**params)
307319

320+
def clean(self):
321+
super().clean()
322+
323+
# width & u_height must be set if not specifying a rack type on import
324+
if not self.instance.pk:
325+
if not self.cleaned_data.get('rack_type') and not self.cleaned_data.get('width'):
326+
raise forms.ValidationError(_("Width must be set if not specifying a rack type."))
327+
if not self.cleaned_data.get('rack_type') and not self.cleaned_data.get('u_height'):
328+
raise forms.ValidationError(_("U height must be set if not specifying a rack type."))
329+
308330

309331
class RackReservationImportForm(NetBoxModelImportForm):
310332
site = CSVModelChoiceField(

netbox/dcim/models/devices.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1277,6 +1277,11 @@ def save(self, *args, **kwargs):
12771277
if not disable_replication:
12781278
create_instances.append(template_instance)
12791279

1280+
# Set default values for any applicable custom fields
1281+
if cf_defaults := CustomField.objects.get_defaults_for_model(component_model):
1282+
for component in create_instances:
1283+
component.custom_field_data = cf_defaults
1284+
12801285
if component_model is not ModuleBay:
12811286
component_model.objects.bulk_create(create_instances)
12821287
# Emit the post_save signal for each newly created object

netbox/dcim/svg/racks.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,15 @@ def get_device_description(device):
4848
4949
Name: <name>
5050
Role: <role>
51+
Status: <status>
5152
Device Type: <manufacturer> <model> (<u_height>)
5253
Asset tag: <asset_tag> (if defined)
5354
Serial: <serial> (if defined)
5455
Description: <description> (if defined)
5556
"""
5657
description = f'Name: {device.name}'
5758
description += f'\nRole: {device.role}'
59+
description += f'\nStatus: {device.get_status_display()}'
5860
u_height = f'{floatformat(device.device_type.u_height)}U'
5961
description += f'\nDevice Type: {device.device_type.manufacturer.name} {device.device_type.model} ({u_height})'
6062
if device.asset_tag:

0 commit comments

Comments
 (0)