Skip to content

Commit a461123

Browse files
committed
Merge branch 'develop' into feature
2 parents 169869b + 7ebfa4c commit a461123

File tree

21 files changed

+189
-167
lines changed

21 files changed

+189
-167
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

+1-1
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.4.3
17+
placeholder: v3.4.4
1818
validations:
1919
required: true
2020
- type: dropdown

.github/ISSUE_TEMPLATE/feature_request.yaml

+1-1
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.4.3
17+
placeholder: v3.4.4
1818
validations:
1919
required: true
2020
- type: dropdown

README.md

+42-83
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,59 @@
11
<div align="center">
22
<img src="https://raw.githubusercontent.com/netbox-community/netbox/develop/docs/netbox_logo.svg" width="400" alt="NetBox logo" />
3+
4+
The premiere source of truth powering network automation
35
</div>
46

7+
![Master branch build status](https://github.com/netbox-community/netbox/workflows/CI/badge.svg?branch=master)
8+
59
NetBox is the leading solution for modeling and documenting modern networks. By
610
combining the traditional disciplines of IP address management (IPAM) and
711
datacenter infrastructure management (DCIM) with powerful APIs and extensions,
812
NetBox provides the ideal "source of truth" to power network automation.
9-
Available as open source software under the Apache 2.0 license, NetBox is
10-
employed by thousands of organizations around the world.
13+
Available as open source software under the Apache 2.0 license, NetBox serves
14+
as the cornerstone for network automation in thousands of organizations.
15+
16+
* **Physical infrasucture:** Accurately model the physical world, from global regions down to individual racks of gear. Then connect everything - network, console, and power!
17+
* **Modern IPAM:** All the standard IPAM functionality you expect, plus VRF import/export tracking, VLAN management, and overlay support.
18+
* **Data circuits:** Confidently manage the delivery of crtical circuits from various service providers, modeled seamlessly alongside your own infrastructure.
19+
* **Power tracking:** Map the distribution of power from upstream sources to individual feeds and outlets.
20+
* **Organization:** Manage tenant and contact assignments natively.
21+
* **Powerful search:** Easily find anything you need using a single global search function.
22+
* **Comprehensive logging:** Leverage both automatic change logging and user-submitted journal entries to track your network's growth over time.
23+
* **Endless customization:** Custom fields, custom links, tags, export templates, custom validation, reports, scripts, and more!
24+
* **Flexible permissions:** An advanced permissions systems enables very flexible delegation of permissions.
25+
* **Integrations:** Easily connect NetBox to your other tooling via its REST & GraphQL APIs.
26+
* **Plugins:** Not finding what you need in the core application? Try one of many community plugins - or build your own!
1127

12-
![Master branch build status](https://github.com/netbox-community/netbox/workflows/CI/badge.svg?branch=master)
28+
![Screenshot of NetBox UI](docs/media/screenshots/netbox-ui.png "NetBox UI")
1329

14-
[![Timeline graph](https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_timeline.svg)](https://github.com/netbox-community/netbox/commits)
15-
[![Issue status graph](https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_issues.svg)](https://github.com/netbox-community/netbox/issues)
16-
[![Pull request status graph](https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_prs.svg)](https://github.com/netbox-community/netbox/pulls)
17-
[![Top contributors](https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_users.svg)](https://github.com/netbox-community/netbox/graphs/contributors)
18-
<br />Stats via [Repography](https://repography.com)
30+
## Getting Started
1931

20-
## About NetBox
32+
* Just want to explore? Check out [our public demo](https://demo.netbox.dev/) right now!
33+
* The [official documentation](https://docs.netbox.dev) offers a comprehensive introduction.
34+
* Choose your deployment: [self-hosted](https://github.com/netbox-community/netbox), [Docker](https://github.com/netbox-community/netbox-docker), or [NetBox Cloud](https://netboxlabs.com/netbox-cloud/).
35+
* Check out [our wiki](https://github.com/netbox-community/netbox/wiki/Community-Contributions) for even more projects to get the most out of NetBox!
2136

22-
![Screenshot of NetBox UI](docs/media/screenshots/netbox-ui.png "NetBox UI")
37+
## Get Involved
38+
39+
* Follow [@NetBoxOfficial](https://twitter.com/NetBoxOfficial) on Twitter!
40+
* Join the conversation on [the discussion forum](https://github.com/netbox-community/netbox/discussions) and [Slack](https://netdev.chat/)!
41+
* Already a power user? You can [suggest a feature](https://github.com/netbox-community/netbox/issues/new?assignees=&labels=type%3A+feature&template=feature_request.yaml) or [report a bug](https://github.com/netbox-community/netbox/issues/new?assignees=&labels=type%3A+bug&template=bug_report.yaml) on GitHub.
42+
* Contributions from the community are encouraged and appreciated! Check out our [contributing guide](CONTRIBUTING.md) to get started.
43+
44+
## Project Stats
45+
46+
<div align="center">
47+
<a href="https://github.com/netbox-community/netbox/commits"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_timeline.svg" alt="Timeline graph"></a>
48+
<a href="https://github.com/netbox-community/netbox/issues"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_issues.svg" alt="Issues graph"></a>
49+
<a href="https://github.com/netbox-community/netbox/pulls"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_prs.svg" alt="Pull requests graph"></a>
50+
<a href="https://github.com/netbox-community/netbox/graphs/contributors"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_users.svg" alt="Top contributors"></a>
51+
<br />Stats via <a href="https://repography.com">Repography</a>
52+
</div>
2353

24-
Myriad infrastructure components can be modeled in NetBox, including:
25-
26-
* Hierarchical regions, site groups, sites, and locations
27-
* Racks, devices, and device components
28-
* Cables and wireless connections
29-
* Power distribution
30-
* Data circuits and providers
31-
* Virtual machines and clusters
32-
* IP prefixes, ranges, and addresses
33-
* VRFs and route targets
34-
* L2VPN and overlays
35-
* FHRP groups (VRRP, HSRP, etc.)
36-
* AS numbers
37-
* VLANs and scoped VLAN groups
38-
* Organizational tenants and contacts
39-
40-
In addition to its extensive built-in models and functionality, NetBox can be
41-
customized and extended through the use of:
42-
43-
* Custom fields
44-
* Custom links
45-
* Configuration contexts
46-
* Custom model validation rules
47-
* Reports
48-
* Custom scripts
49-
* Export templates
50-
* Conditional webhooks
51-
* Plugins
52-
* Single sign-on (SSO) authentication
53-
* NAPALM integration
54-
* Detailed change logging
55-
56-
NetBox also features a complete REST API as well as a GraphQL API for easily
57-
integrating with other tools and systems.
58-
59-
The complete documentation for NetBox can be found at [docs.netbox.dev](https://docs.netbox.dev/).
60-
A public demo instance is available at [demo.netbox.dev](https://demo.netbox.dev).
61-
62-
NetBox runs as a web application atop the [Django](https://www.djangoproject.com/)
63-
Python framework with a [PostgreSQL](https://www.postgresql.org/) database. For a
64-
complete list of requirements, see `requirements.txt`. The code is available
65-
[on GitHub](https://github.com/netbox-community/netbox).
54+
## Sponsors
6655

6756
<div align="center">
68-
<h3>Thank you to our sponsors!</h3>
6957

7058
[![NetBox Labs](https://raw.githubusercontent.com/wiki/netbox-community/netbox/images/sponsors/netbox_labs.png)](https://netboxlabs.com)
7159
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
@@ -76,34 +64,10 @@ complete list of requirements, see `requirements.txt`. The code is available
7664
[![Sentry](https://raw.githubusercontent.com/wiki/netbox-community/netbox/images/sponsors/sentry.png)](https://sentry.io)
7765
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
7866
[![Equinix Metal](https://raw.githubusercontent.com/wiki/netbox-community/netbox/images/sponsors/equinix.png)](https://metal.equinix.com)
79-
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
80-
[![Stellar Technologies](https://raw.githubusercontent.com/wiki/netbox-community/netbox/images/sponsors/stellar.png)](https://stellar.tech)
8167

8268
</div>
8369

84-
### Discussion
85-
86-
* [GitHub Discussions](https://github.com/netbox-community/netbox/discussions) - Discussion forum hosted by GitHub; ideal for Q&A and other structured discussions
87-
* [Slack](https://netdev.chat/) - Real-time chat hosted by the NetDev Community; best for unstructured discussion or just hanging out
88-
89-
### Installation
90-
91-
Please see [the documentation](https://docs.netbox.dev/) for
92-
instructions on installing NetBox. To upgrade NetBox, please download the
93-
[latest release](https://github.com/netbox-community/netbox/releases) and
94-
run `upgrade.sh`.
95-
96-
### Providing Feedback
97-
98-
The best platform for general feedback, assistance, and other discussion is our
99-
[GitHub discussions](https://github.com/netbox-community/netbox/discussions).
100-
To report a bug or request a specific feature, please open a GitHub issue using
101-
the [appropriate template](https://github.com/netbox-community/netbox/issues/new/choose).
102-
103-
If you are interested in contributing to the development of NetBox, please read
104-
our [contributing guide](CONTRIBUTING.md) prior to beginning any work.
105-
106-
### Screenshots
70+
## Screenshots
10771

10872
![Screenshot of main page (dark mode)](docs/media/screenshots/home-dark.png "Main page (dark mode)")
10973

@@ -112,8 +76,3 @@ our [contributing guide](CONTRIBUTING.md) prior to beginning any work.
11276
![Screenshot of prefixes hierarchy](docs/media/screenshots/prefixes-list.png "Prefixes hierarchy")
11377

11478
![Screenshot of cable trace](docs/media/screenshots/cable-trace.png "Cable tracing")
115-
116-
### Related projects
117-
118-
Please see [our wiki](https://github.com/netbox-community/netbox/wiki/Community-Contributions)
119-
for a list of relevant community projects.

base_requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# HTML sanitizer
22
# https://github.com/mozilla/bleach
3-
bleach
3+
bleach<6.0
44

55
# The Python web framework on which NetBox is built
66
# https://github.com/django/django

docs/customization/custom-scripts.md

+13
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,19 @@ obj.full_clean()
140140
obj.save()
141141
```
142142

143+
## Error handling
144+
145+
Sometimes things go wrong and a script will run into an `Exception`. If that happens and an uncaught exception is raised by the custom script, the execution is aborted and a full stack trace is reported.
146+
147+
Although this is helpful for debugging, in some situations it might be required to cleanly abort the execution of a custom script (e.g. because of invalid input data) and thereby make sure no changes are performed on the database. In this case the script can throw an `AbortScript` exception, which will prevent the stack trace from being reported, but still terminating the script's execution and reporting a given error message.
148+
149+
```python
150+
from utilities.exceptions import AbortScript
151+
152+
if some_error:
153+
raise AbortScript("Some meaningful error message")
154+
```
155+
143156
## Variable Reference
144157

145158
### Default Options

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,4 @@ NetBox is built on the enormously popular [Django](http://www.djangoproject.com/
5252
* Try out our [public demo](https://demo.netbox.dev/) if you want to jump right in
5353
* The [installation guide](./installation/index.md) will help you get your own deployment up and running
5454
* Or try the community [Docker image](https://github.com/netbox-community/netbox-docker) for a low-touch approach
55-
* [NetBox Cloud](https://www.getnetbox.io/) is a hosted solution offered by NS1
55+
* [NetBox Cloud](https://netboxlabs.com/netbox-cloud) is a managed solution offered by [NetBox Labs](https://netboxlabs.com/)

docs/plugins/development/navigation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ menu_items = (item1, item2, item3)
4848

4949
Each menu item represents a link and (optionally) a set of buttons comprising one entry in NetBox's navigation menu. Menu items are defined as PluginMenuItem instances. An example is shown below.
5050

51-
```python filename="navigation.py"
51+
```python title="navigation.py"
5252
from extras.plugins import PluginMenuButton, PluginMenuItem
5353
from utilities.choices import ButtonColorChoices
5454

docs/release-notes/version-3.4.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
# NetBox v3.4
22

3-
## v3.4.4 (FUTURE)
3+
## v3.4.5 (FUTURE)
4+
5+
---
6+
7+
## v3.4.4 (2023-02-02)
48

59
### Enhancements
610

711
* [#10762](https://github.com/netbox-community/netbox/issues/10762) - Permit selection custom fields to have only one choice
12+
* [#11152](https://github.com/netbox-community/netbox/issues/11152) - Introduce AbortScript exception to elegantly abort scripts
13+
* [#11554](https://github.com/netbox-community/netbox/issues/11554) - Add module types count to manufacturers list
814
* [#11585](https://github.com/netbox-community/netbox/issues/11585) - Add IP address filters for services
15+
* [#11598](https://github.com/netbox-community/netbox/issues/11598) - Add buttons to easily switch between rack list and elevations views
916

1017
### Bug Fixes
1118

19+
* [#11267](https://github.com/netbox-community/netbox/issues/11267) - Avoid catching ImportErrors when loading plugin resources
1220
* [#11487](https://github.com/netbox-community/netbox/issues/11487) - Remove "set null" option from non-writable custom fields during bulk edit
1321
* [#11491](https://github.com/netbox-community/netbox/issues/11491) - Show edit/delete buttons in user tokens table
1422
* [#11528](https://github.com/netbox-community/netbox/issues/11528) - Permit import of devices using uploaded file
1523
* [#11555](https://github.com/netbox-community/netbox/issues/11555) - Avoid inadvertent interpretation of search query as regular expression under global search (previously [#11516](https://github.com/netbox-community/netbox/issues/11516))
1624
* [#11562](https://github.com/netbox-community/netbox/issues/11562) - Correct ordering of virtual chassis interfaces with duplicate names
25+
* [#11574](https://github.com/netbox-community/netbox/issues/11574) - Fix exception when attempting to schedule reports/scripts
26+
* [#11620](https://github.com/netbox-community/netbox/issues/11620) - Correct available filter choices for interface PoE type
27+
* [#11635](https://github.com/netbox-community/netbox/issues/11635) - Pre-populate assigned VRF when following "first available IP" link from prefix view
28+
* [#11650](https://github.com/netbox-community/netbox/issues/11650) - Display error message when attempting to create device component with duplicate name
1729

1830
---
1931

netbox/dcim/forms/filtersets.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ class InterfaceFilterForm(PathEndpointFilterForm, DeviceComponentFilterForm):
11701170
label='PoE mode'
11711171
)
11721172
poe_type = MultipleChoiceField(
1173-
choices=InterfacePoEModeChoices,
1173+
choices=InterfacePoETypeChoices,
11741174
required=False,
11751175
label='PoE type'
11761176
)

netbox/dcim/views.py

+1
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,7 @@ class RackListView(generic.ObjectListView):
595595
filterset = filtersets.RackFilterSet
596596
filterset_form = forms.RackFilterForm
597597
table = tables.RackTable
598+
template_name = 'dcim/rack_list.html'
598599

599600

600601
class RackElevationListView(generic.ObjectListView):

netbox/extras/forms/scripts.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,16 @@ def __init__(self, *args, **kwargs):
4545
self.fields['_interval'] = interval
4646
self.fields['_commit'] = commit
4747

48-
def clean__schedule_at(self):
48+
def clean(self):
4949
scheduled_time = self.cleaned_data['_schedule_at']
50-
if scheduled_time and scheduled_time < timezone.now():
50+
if scheduled_time and scheduled_time < local_now():
5151
raise forms.ValidationError(_('Scheduled time must be in the future.'))
5252

53-
return scheduled_time
53+
# When interval is used without schedule at, raise an exception
54+
if self.cleaned_data['_interval'] and not scheduled_time:
55+
raise forms.ValidationError(_('Scheduled time must be set when recurs is used.'))
56+
57+
return self.cleaned_data
5458

5559
@property
5660
def requires_input(self):

netbox/extras/plugins/__init__.py

+39-34
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import collections
2+
from importlib import import_module
23

34
from django.apps import AppConfig
45
from django.conf import settings
@@ -21,6 +22,15 @@
2122
'template_extensions': collections.defaultdict(list),
2223
}
2324

25+
DEFAULT_RESOURCE_PATHS = {
26+
'search_indexes': 'search.indexes',
27+
'graphql_schema': 'graphql.schema',
28+
'menu': 'navigation.menu',
29+
'menu_items': 'navigation.menu_items',
30+
'template_extensions': 'template_content.template_extensions',
31+
'user_preferences': 'preferences.preferences',
32+
}
33+
2434

2535
#
2636
# Plugin AppConfig class
@@ -58,58 +68,53 @@ class PluginConfig(AppConfig):
5868
# Django apps to append to INSTALLED_APPS when plugin requires them.
5969
django_apps = []
6070

61-
# Default integration paths. Plugin authors can override these to customize the paths to
62-
# integrated components.
63-
search_indexes = 'search.indexes'
64-
graphql_schema = 'graphql.schema'
65-
menu = 'navigation.menu'
66-
menu_items = 'navigation.menu_items'
67-
template_extensions = 'template_content.template_extensions'
68-
user_preferences = 'preferences.preferences'
71+
# Optional plugin resources
72+
search_indexes = None
73+
graphql_schema = None
74+
menu = None
75+
menu_items = None
76+
template_extensions = None
77+
user_preferences = None
78+
79+
def _load_resource(self, name):
80+
# Import from the configured path, if defined.
81+
if getattr(self, name):
82+
return import_string(f"{self.__module__}.{self.name}")
83+
84+
# Fall back to the resource's default path. Return None if the module has not been provided.
85+
default_path = f'{self.__module__}.{DEFAULT_RESOURCE_PATHS[name]}'
86+
default_module, resource_name = default_path.rsplit('.', 1)
87+
try:
88+
module = import_module(default_module)
89+
return getattr(module, resource_name, None)
90+
except ModuleNotFoundError:
91+
pass
6992

7093
def ready(self):
7194
plugin_name = self.name.rsplit('.', 1)[-1]
7295

7396
# Register search extensions (if defined)
74-
try:
75-
search_indexes = import_string(f"{self.__module__}.{self.search_indexes}")
76-
for idx in search_indexes:
77-
register_search(idx)
78-
except ImportError:
79-
pass
97+
search_indexes = self._load_resource('search_indexes') or []
98+
for idx in search_indexes:
99+
register_search(idx)
80100

81101
# Register template content (if defined)
82-
try:
83-
template_extensions = import_string(f"{self.__module__}.{self.template_extensions}")
102+
if template_extensions := self._load_resource('template_extensions'):
84103
register_template_extensions(template_extensions)
85-
except ImportError:
86-
pass
87104

88105
# Register navigation menu and/or menu items (if defined)
89-
try:
90-
menu = import_string(f"{self.__module__}.{self.menu}")
106+
if menu := self._load_resource('menu'):
91107
register_menu(menu)
92-
except ImportError:
93-
pass
94-
try:
95-
menu_items = import_string(f"{self.__module__}.{self.menu_items}")
108+
if menu_items := self._load_resource('menu_items'):
96109
register_menu_items(self.verbose_name, menu_items)
97-
except ImportError:
98-
pass
99110

100111
# Register GraphQL schema (if defined)
101-
try:
102-
graphql_schema = import_string(f"{self.__module__}.{self.graphql_schema}")
112+
if graphql_schema := self._load_resource('graphql_schema'):
103113
register_graphql_schema(graphql_schema)
104-
except ImportError:
105-
pass
106114

107115
# Register user preferences (if defined)
108-
try:
109-
user_preferences = import_string(f"{self.__module__}.{self.user_preferences}")
116+
if user_preferences := self._load_resource('user_preferences'):
110117
register_user_preferences(plugin_name, user_preferences)
111-
except ImportError:
112-
pass
113118

114119
@classmethod
115120
def validate(cls, user_config, netbox_version):

0 commit comments

Comments
 (0)