Skip to content

Commit

Permalink
Merge pull request #17763 from netbox-community/develop
Browse files Browse the repository at this point in the history
Release v4.1.4
  • Loading branch information
jeremystretch authored Oct 15, 2024
2 parents 6ea0c0c + d2cbdfe commit 4deb6e5
Show file tree
Hide file tree
Showing 187 changed files with 9,788 additions and 8,943 deletions.
17 changes: 16 additions & 1 deletion .github/ISSUE_TEMPLATE/01-feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
attributes:
label: NetBox version
description: What version of NetBox are you currently running?
placeholder: v4.1.3
placeholder: v4.1.4
validations:
required: true
- type: dropdown
Expand All @@ -24,6 +24,21 @@ body:
- Data model extension
- New functionality
- Change to existing functionality
- Other
validations:
required: true
- type: dropdown
attributes:
label: Triage priority
description: >
Issue triage may be prioritized in some cases. Select whichever of the following
conditions applies, if any.
options:
- I volunteer to perform this work (if approved)
- I'm a NetBox Labs customer
- This is a very minor change
- N/A
default: 3
validations:
required: true
- type: textarea
Expand Down
16 changes: 15 additions & 1 deletion .github/ISSUE_TEMPLATE/02-bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,25 @@ body:
- Self-hosted
validations:
required: true
- type: dropdown
attributes:
label: Triage priority
description: >
Issue triage may be prioritized in some cases. Select whichever of the following
conditions applies, if any.
options:
- I volunteer to perform this work (if approved)
- I'm a NetBox Labs customer
- This is preventing me from using NetBox
- N/A
default: 3
validations:
required: true
- type: input
attributes:
label: NetBox Version
description: What version of NetBox are you currently running?
placeholder: v4.1.3
placeholder: v4.1.4
validations:
required: true
- type: dropdown
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pycodestyle coverage tblib
pip install ruff coverage tblib
- name: Build documentation
run: mkdocs build
Expand All @@ -85,7 +85,7 @@ jobs:
run: python netbox/manage.py makemigrations --check

- name: Check PEP8 compliance
run: pycodestyle --ignore=W504,E501 --exclude=node_modules netbox/
run: ruff check netbox/

- name: Check UI ESLint, TypeScript, and Prettier Compliance
run: yarn --cwd netbox/project-static validate
Expand Down
44 changes: 44 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
name: "Ruff linter"
args: [ netbox/ ]
- repo: local
hooks:
- id: django-check
name: "Django system check"
description: "Run Django's internal check for common problems"
entry: python netbox/manage.py check
language: system
pass_filenames: false
types: [python]
- id: django-makemigrations
name: "Django migrations check"
description: "Check for any missing Django migrations"
entry: python netbox/manage.py makemigrations --check
language: system
pass_filenames: false
types: [python]
- id: mkdocs-build
name: "Build documentation"
description: "Build the documentation with mkdocs"
files: 'docs/'
entry: mkdocs build
language: system
pass_filenames: false
- id: yarn-validate
name: "Yarn validate"
description: "Check UI ESLint, TypeScript, and Prettier compliance"
files: 'netbox/project-static/'
entry: yarn --cwd netbox/project-static validate
language: system
pass_filenames: false
- id: verify-bundles
name: "Verify static asset bundles"
description: "Ensure that any modified static assets have been compiled"
files: 'netbox/project-static/'
entry: scripts/verify-bundles.sh
language: system
pass_filenames: false
3 changes: 3 additions & 0 deletions contrib/generated_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"left-to-right",
"right-to-left",
"side-to-rear",
"rear-to-side",
"bottom-to-top",
"top-to-bottom",
"passive",
"mixed"
]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Microsoft Azure AD
# Microsoft Entra ID

This guide explains how to configure single sign-on (SSO) support for NetBox using [Microsoft Azure Active Directory (AD)](https://azure.microsoft.com/en-us/services/active-directory/) as an authentication backend.
This guide explains how to configure single sign-on (SSO) support for NetBox using [Microsoft Entra ID](https://www.microsoft.com/en-us/security/business/identity-access/microsoft-entra-id) as an authentication backend.

## Azure AD Configuration
## Entra ID Configuration

### 1. Create a test user (optional)

Expand All @@ -16,7 +16,7 @@ Under the Azure Active Directory dashboard, navigate to **Add > App registration

Enter a name for the registration (e.g. "NetBox") and ensure that the "single tenant" option is selected.

Under "Redirect URI", select "Web" for the platform and enter the path to your NetBox installation, ending with `/oauth/complete/azuread-oauth2/`. Note that this URI **must** begin with `https://` unless you are referencing localhost (for development purposes).
Under "Redirect URI", select "Web" for the platform and enter the path to your NetBox installation, ending with `/oauth/complete/entraid-oauth2/`. Note that this URI **must** begin with `https://` unless you are referencing localhost (for development purposes).

![App registration parameters](../../media/authentication/azure_ad_app_registration.png)

Expand Down
39 changes: 22 additions & 17 deletions docs/development/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,7 @@ $issue-$description

The description should be just two or three words to imply the focus of the work being performed. For example, bug #1234 to fix a TypeError exception when creating a device might be named `1234-device-typerror`. This ensures that branches are always follow some logical ordering (e.g. when running `git branch -a`) and helps other developers quickly identify the purpose of each.

### 3. Enable Pre-Commit Hooks

NetBox ships with a [git pre-commit hook](https://githooks.com/) script that automatically checks for style compliance and missing database migrations prior to committing changes. This helps avoid erroneous commits that result in CI test failures. You are encouraged to enable it by creating a link to `scripts/git-hooks/pre-commit`:

```no-highlight
cd .git/hooks/
ln -s ../../scripts/git-hooks/pre-commit
```
For the pre-commit hooks to work, you will also need to install the pycodestyle package:

```no-highlight
python -m pip install pycodestyle
```
...and set up the yarn packages as shown in the [Web UI Development Guide](web-ui.md)

### 4. Create a Python Virtual Environment
### 3. Create a Python Virtual Environment

A [virtual environment](https://docs.python.org/3/tutorial/venv.html) (or "venv" for short) is like a container for a set of Python packages. These allow you to build environments suited to specific projects without interfering with system packages or other projects. When installed per the documentation, NetBox uses a virtual environment in production.

Expand All @@ -101,14 +86,34 @@ source ~/.venv/netbox/bin/activate

Notice that the console prompt changes to indicate the active environment. This updates the necessary system environment variables to ensure that any Python scripts are run within the virtual environment.

### 5. Install Required Packages
### 4. Install Required Packages

With the virtual environment activated, install the project's required Python packages using the `pip` module. Required packages are defined in `requirements.txt`. Each line in this file specifies the name and specific version of a required package.

```no-highlight
python -m pip install -r requirements.txt
```

### 5. Install Pre-Commit

NetBox uses [`pre-commit`](https://pre-commit.com/) to automatically validate code when commiting new changes. This includes the following operations:

* Run the `ruff` Python linter
* Run Django's internal system check
* Check for missing database migrations
* Validate any changes to the documentation with `mkdocs`
* Validate Typescript & Sass styling with `yarn`
* Ensure that any modified static front end assets have been recompiled

Enable `pre-commit` with the following commands _prior_ to commiting any changes:

```no-highlight
python -m pip install ruff pre-commit
pre-commit install
```

You may also need to set up the yarn packages as shown in the [Web UI Development Guide](web-ui.md).

### 6. Configure NetBox

Within the `netbox/netbox/` directory, copy `configuration_example.py` to `configuration.py` and update the following parameters:
Expand Down
32 changes: 16 additions & 16 deletions docs/development/style-guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Style Guide

NetBox generally follows the [Django style guide](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/coding-style/), which is itself based on [PEP 8](https://www.python.org/dev/peps/pep-0008/). [Pycodestyle](https://github.com/pycqa/pycodestyle) is used to validate code formatting, ignoring certain violations.
NetBox generally follows the [Django style guide](https://docs.djangoproject.com/en/stable/internals/contributing/writing-code/coding-style/), which is itself based on [PEP 8](https://www.python.org/dev/peps/pep-0008/). [ruff](https://docs.astral.sh/ruff/) is used for linting (with certain [exceptions](#linter-exceptions)).

## Code

Expand All @@ -20,32 +20,32 @@ NetBox generally follows the [Django style guide](https://docs.djangoproject.com

* Nested API serializers generate minimal representations of an object. These are stored separately from the primary serializers to avoid circular dependencies. Always import nested serializers from other apps directly. For example, from within the DCIM app you would write `from ipam.api.nested_serializers import NestedIPAddressSerializer`.

### PEP 8 Exceptions
### Linting

NetBox ignores certain PEP8 assertions. These are listed below.
The [ruff](https://docs.astral.sh/ruff/) linter is used to enforce code style. A [pre-commit hook](./getting-started.md#3-enable-pre-commit-hooks) which runs this automatically is included with NetBox. To invoke `ruff` manually, run:

#### Wildcard Imports
```
ruff check netbox/
```

Wildcard imports (for example, `from .constants import *`) are acceptable under any of the following conditions:
#### Linter Exceptions

* The library being import contains only constant declarations (e.g. `constants.py`)
* The library being imported explicitly defines `__all__`
The following rules are ignored when linting.

#### Maximum Line Length (E501)
##### [E501](https://docs.astral.sh/ruff/rules/line-too-long/): Line too long

NetBox does not restrict lines to a maximum length of 79 characters. We use a maximum line length of 120 characters, however this is not enforced by CI. The maximum length does not apply to HTML templates or to automatically generated code (e.g. database migrations).
NetBox does not enforce a hard restriction on line length, although a maximum length of 120 characters is strongly encouraged for Python code where possible. The maximum length does not apply to HTML templates or to automatically generated code (e.g. database migrations).

#### Line Breaks Following Binary Operators (W504)
##### [F403](https://docs.astral.sh/ruff/rules/undefined-local-with-import-star/): Undefined local with import star

Line breaks are permitted following binary operators.
Wildcard imports (for example, `from .constants import *`) are acceptable under any of the following conditions:

### Enforcing Code Style
* The library being import contains only constant declarations (e.g. `constants.py`)
* The library being imported explicitly defines `__all__`

The [`pycodestyle`](https://pypi.org/project/pycodestyle/) utility (formerly `pep8`) is used by the CI process to enforce code style. A [pre-commit hook](./getting-started.md#3-enable-pre-commit-hooks) which runs this automatically is included with NetBox. To invoke `pycodestyle` manually, run:
##### [F405](https://docs.astral.sh/ruff/rules/undefined-local-with-import-star-usage/): Undefined local with import star usage

```
pycodestyle --ignore=W504,E501 netbox/
```
The justification for ignoring this rule is the same as F403 above.

### Introducing New Dependencies

Expand Down
2 changes: 1 addition & 1 deletion docs/features/authentication-permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ NetBox integrates with the open source [python-social-auth](https://github.com/p
* Google
* Hashicorp Vault
* Keycloak
* Microsoft Azure AD
* Microsoft Entra ID
* Microsoft Graph
* Okta
* OIDC
Expand Down
1 change: 1 addition & 0 deletions docs/models/vpn/l2vpn.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ The technology employed in forming and operating the L2VPN. Choices include:
* VXLAN-EVPN
* MPLS-EVPN
* PBB-EVPN
* EVPN-VPWS

!!! note
Designating the type as VPWS, EPL, EP-LAN, EP-TREE will limit the L2VPN instance to two terminations.
Expand Down
28 changes: 28 additions & 0 deletions docs/release-notes/version-4.1.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
# NetBox v4.1

## v4.1.4 (2024-10-15)

### Enhancements

* [#11671](https://github.com/netbox-community/netbox/issues/11671) - Display device's rack position in cable traces
* [#15829](https://github.com/netbox-community/netbox/issues/15829) - Rename Microsoft Azure AD SSO backend to Microsoft Entra ID
* [#16009](https://github.com/netbox-community/netbox/issues/16009) - Float form & bulk operation buttons within UI
* [#17079](https://github.com/netbox-community/netbox/issues/17079) - Introduce additional choices for device airflow direction
* [#17216](https://github.com/netbox-community/netbox/issues/17216) - Add EVPN-VPWS L2VPN type
* [#17655](https://github.com/netbox-community/netbox/issues/17655) - Limit the display of tagged VLANs within interface tables
* [#17669](https://github.com/netbox-community/netbox/issues/17669) - Enable filtering VLANs by assigned device or VM interface

### Bug Fixes

* [#16024](https://github.com/netbox-community/netbox/issues/16024) - Fix AND/OR filtering in GraphQL API for selection fields
* [#17400](https://github.com/netbox-community/netbox/issues/17400) - Fix cable tracing across split paths
* [#17562](https://github.com/netbox-community/netbox/issues/17562) - Fix GraphQL API query support for custom field choices
* [#17566](https://github.com/netbox-community/netbox/issues/17566) - Fix AttributeError exception resulting from background jobs with no associated object type
* [#17614](https://github.com/netbox-community/netbox/issues/17614) - Disallow removal of a master device from its virtual chassis
* [#17636](https://github.com/netbox-community/netbox/issues/17636) - Fix filtering of related objects when adding a power port, rear port, or inventory item template to a device type
* [#17644](https://github.com/netbox-community/netbox/issues/17644) - Correct sizing of logo & SSO icons on login page
* [#17648](https://github.com/netbox-community/netbox/issues/17648) - Fix AttributeError exception when attempting to delete a background job under certain conditions
* [#17663](https://github.com/netbox-community/netbox/issues/17663) - Fix extended lookups for choice field filters
* [#17671](https://github.com/netbox-community/netbox/issues/17671) - Fix the display of rack types in global search results
* [#17713](https://github.com/netbox-community/netbox/issues/17713) - Fix UnboundLocalError exception when attempting to sync data source in parallel

---

## v4.1.3 (2024-10-02)

### Enhancements
Expand Down
2 changes: 1 addition & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ nav:
- Administration:
- Authentication:
- Overview: 'administration/authentication/overview.md'
- Microsoft Azure AD: 'administration/authentication/microsoft-azure-ad.md'
- Microsoft Entra ID: 'administration/authentication/microsoft-entra-id.md'
- Okta: 'administration/authentication/okta.md'
- Permissions: 'administration/permissions.md'
- Error Reporting: 'administration/error-reporting.md'
Expand Down
2 changes: 1 addition & 1 deletion netbox/circuits/api/nested_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

# TODO: Remove in v4.2
warnings.warn(
f"Dedicated nested serializers will be removed in NetBox v4.2. Use Serializer(nested=True) instead.",
"Dedicated nested serializers will be removed in NetBox v4.2. Use Serializer(nested=True) instead.",
DeprecationWarning
)

Expand Down
2 changes: 1 addition & 1 deletion netbox/circuits/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CircuitsConfig(AppConfig):

def ready(self):
from netbox.models.features import register_models
from . import signals, search
from . import signals, search # noqa: F401

# Register models
register_models(*self.get_models())
1 change: 0 additions & 1 deletion netbox/circuits/forms/bulk_import.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django import forms
from django.utils.safestring import mark_safe
from django.utils.translation import gettext_lazy as _

from circuits.choices import *
Expand Down
3 changes: 1 addition & 2 deletions netbox/circuits/graphql/filters.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import strawberry
import strawberry_django
from circuits import filtersets, models

from circuits import filtersets, models
from netbox.graphql.filter_mixins import autotype_decorator, BaseFilterMixin

__all__ = (
Expand Down
2 changes: 1 addition & 1 deletion netbox/circuits/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def setUpTestData(cls):
)

cls.csv_update_data = (
f"id,cid,description,status",
"id,cid,description,status",
f"{circuits[0].pk},Circuit 7,New description7,{CircuitStatusChoices.STATUS_DECOMMISSIONED}",
f"{circuits[1].pk},Circuit 8,New description8,{CircuitStatusChoices.STATUS_DECOMMISSIONED}",
f"{circuits[2].pk},Circuit 9,New description9,{CircuitStatusChoices.STATUS_DECOMMISSIONED}",
Expand Down
2 changes: 1 addition & 1 deletion netbox/core/api/nested_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

# TODO: Remove in v4.2
warnings.warn(
f"Dedicated nested serializers will be removed in NetBox v4.2. Use Serializer(nested=True) instead.",
"Dedicated nested serializers will be removed in NetBox v4.2. Use Serializer(nested=True) instead.",
DeprecationWarning
)

Expand Down
4 changes: 1 addition & 3 deletions netbox/core/api/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
build_basic_type, build_choice_field, build_media_type_object, build_object_type, get_doc,
)
from drf_spectacular.types import OpenApiTypes
from rest_framework import serializers
from rest_framework.relations import ManyRelatedField

from netbox.api.fields import ChoiceField, SerializedPKRelatedField
from netbox.api.fields import ChoiceField
from netbox.api.serializers import WritableNestedSerializer

# see netbox.api.routers.NetBoxRouter
Expand Down
2 changes: 0 additions & 2 deletions netbox/core/api/serializers_/jobs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from rest_framework import serializers

from core.choices import *
from core.models import Job
from netbox.api.fields import ChoiceField, ContentTypeField
Expand Down
Loading

0 comments on commit 4deb6e5

Please sign in to comment.