Skip to content

Commit

Permalink
net-mgmt/netbox: Update to 3.3.4
Browse files Browse the repository at this point in the history
* Prune obsolete update instructions/notes for NetBox releases older
  than 3.0.

* Add a directive to the netbox rc sample script that also simplifies
  the upgrade process. [1]

* Fix a typo regarding the housekeeping script in the upgrade
  instructions. [1]

Changelog since 3.2.9:

It contains many bugfixes/enhancements and the following new features:

* Multi-object Cable Terminations
* L2VPN Modeling
* PoE Interface Attributes
* Half-Height Rack Units
* Restrict API Tokens by Client IP
* Reference User in Permission Constraints
* Custom Field Grouping
* Toggle Custom Field Visibility

https://netbox.readthedocs.io/en/stable/release-notes/version-3.3/

Reported by:	Thomas Kurschel (via e-mail) [1]
MFH:		No (feature release)
  • Loading branch information
knobix committed Sep 17, 2022
1 parent 1cc1137 commit 8b9888a
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 157 deletions.
17 changes: 9 additions & 8 deletions net-mgmt/netbox/Makefile
@@ -1,6 +1,6 @@
PORTNAME= netbox
DISTVERSIONPREFIX= v
DISTVERSION= 3.2.9
DISTVERSION= 3.3.4
CATEGORIES= net-mgmt python

MAINTAINER= kai@FreeBSD.org
Expand All @@ -25,35 +25,36 @@ LICENSE_FILE= ${WRKSRC}/LICENSE.txt
#
RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}django40>=4.0.7<4.1:www/py-django40@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-cors-headers>=3.13.0<4:www/py-dj40-django-cors-headers@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-debug-toolbar>=3.5.0<4:www/py-dj40-django-debug-toolbar@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-debug-toolbar>=3.6.0<4:www/py-dj40-django-debug-toolbar@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-filter>=22.1<23:www/py-dj40-django-filter@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-graphiql-debug-toolbar>=0.2.0<1:www/py-dj40-django-graphiql-debug-toolbar@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-mptt>=0.13.4<0.14:www/py-dj40-django-mptt@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-prometheus>=2.2.0<2.3:www/py-dj40-django-prometheus@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-redis>=5.2.0<6:www/py-dj40-django-redis@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-rich>=1.4.0<2:www/py-dj40-django-rich@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-rq>=2.5.1<2.6:devel/py-dj40-django-rq@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-tables2>=2.4.1<2.5:www/py-dj40-django-tables2@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-taggit>=2.1.0<3:www/py-dj40-django-taggit@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-taggit>=3.0.0<4:www/py-dj40-django-taggit@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-django-timezone-field>=5.0<6:www/py-dj40-django-timezone-field@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-djangorestframework>=3.13.1<3.14.0:www/py-dj40-djangorestframework@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-drf-yasg>=1.20.0<1.22:www/py-dj40-drf-yasg@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-drf-yasg>=1.21.3<1.22:www/py-dj40-drf-yasg@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}dj40-graphene-django>=2.15.0<3:devel/py-dj40-graphene-django@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}django-pglocks>=1.0.4<1.1:www/py-django-pglocks@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}bleach>=5.0.1<6:www/py-bleach@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}Jinja2>=3.0.1<4:devel/py-Jinja2@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}markdown>=3.3.7<3.5:textproc/py-markdown@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}markdown-include>=0.6.0<1:textproc/py-markdown-include@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}markdown-include>=0.7.0<1:textproc/py-markdown-include@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}mkdocs-material>=8.2.11<9:textproc/py-mkdocs-material@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}mkdocstrings>=0.17.0<1:textproc/py-mkdocstrings@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}netaddr>=0.8.0<1:net/py-netaddr@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pillow>=9.1.1:graphics/py-pillow@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}pillow>=9.2.0:graphics/py-pillow@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}psycopg2>=2.9.3<3:databases/py-psycopg2@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}sentry-sdk>=1.5.12<2:devel/py-sentry-sdk@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}social-auth-app-django>=5.0.0<6:www/py-social-auth-app-django@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}social-auth-core>=4.2.0<5:security/py-social-auth-core@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}social-auth-core>=4.3.0<5:security/py-social-auth-core@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}svgwrite>=1.4.3<2:graphics/py-svgwrite@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}tablib>=3.2.1<4:textproc/py-tablib@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}tzdata>=2022.1:devel/py-tzdata@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}tzdata>=2022.2:devel/py-tzdata@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}yaml>=5.4.1<7:devel/py-yaml@${PY_FLAVOR} \
${PYTHON_PKGNAMEPREFIX}gunicorn>=20.1.0<21:www/py-gunicorn@${PY_FLAVOR}

Expand Down
6 changes: 3 additions & 3 deletions net-mgmt/netbox/distinfo
@@ -1,3 +1,3 @@
TIMESTAMP = 1660761613
SHA256 (netbox-community-netbox-v3.2.9_GH0.tar.gz) = 4d22ed99ea9244b4c167b268eda0af2951f832a0a7b4e653c1b72ea4be2bcb3b
SIZE (netbox-community-netbox-v3.2.9_GH0.tar.gz) = 4837923
TIMESTAMP = 1663407064
SHA256 (netbox-community-netbox-v3.3.4_GH0.tar.gz) = 88de5e90a7632572416bcd52327bd208b2a96f569cbd2987206bd9f5c841f8ab
SIZE (netbox-community-netbox-v3.3.4_GH0.tar.gz) = 5217432
19 changes: 19 additions & 0 deletions net-mgmt/netbox/files/netboxrc.sample.in
Expand Up @@ -44,10 +44,12 @@
name="netbox"
rcvar=netbox_enable
netbox_path=%%DATADIR%%
extra_commands="upgrade"

load_rc_config $name

start_precmd="netbox_precmd"
upgrade_cmd="netbox_upgrade"
command=${netbox_program:-%%LOCALBASE%%/bin/gunicorn}
procname=${netbox_procname:-%%PYTHON_CMD%%}
netbox_chdir=${netbox_path}
Expand Down Expand Up @@ -88,4 +90,21 @@ netbox_precmd()
install -d -o ${netbox_user} `dirname ${pidfile}`
}

netbox_upgrade()
{
if [ -f ${pidfile} ]; then
cd ${netbox_path}
%%PYTHON_CMD%% manage.py migrate
%%PYTHON_CMD%% manage.py trace_paths --no-input
%%LOCALBASE%%/bin/mkdocs build
%%PYTHON_CMD%% manage.py collectstatic --no-input
%%PYTHON_CMD%% manage.py remove_stale_contenttypes --no-input
%%PYTHON_CMD%% manage.py clearsessions
%%PYTHON_CMD%% manage.py clearcache
echo "Please restart NetBox and the WSGI environment."
else
echo "NetBox is not running!"
fi
}

run_rc_command "$1"
161 changes: 55 additions & 106 deletions net-mgmt/netbox/files/pkg-message.in
Expand Up @@ -33,110 +33,6 @@ The following steps are required to finish the upgrade:
2. Restart WSGI/httpd environment (supervisord/apache/nginx/etc.)
EOD
}
{ type: upgrade
maximum_version: 2.9.8
message: <<EOD
Changes related to the NetBox configuration:

1. If in use, LDAP authentication must be enabled by setting
REMOTE_AUTH_BACKEND to 'netbox.authentication.LDAPBackend'. (The LDAP
configuration parameters in ldap_config.py remain unchanged.)

2. REMOTE_AUTH_DEFAULT_PERMISSIONS now takes a dictionary rather than a list.
This is a mapping of permission names to a dictionary of constraining
attributes, or None.

For example, ['dcim.add_site', 'dcim.change_site'] would become
{'dcim.add_site': None, 'dcim.change_site': None}.

3. Support for the DEFAULT_TIMEOUT parameter under REDIS database configuration
was removed. Set RQ_DEFAULT_TIMEOUT as a global configuration parameter
instead.


Changes related to permissions:

1. Any permissions referencing the legacy ReportResult model (e.g.
'extras.view_reportresult') should be updated to reference the Report model.

2. The 'secrets.activate_userkey' permission no longer exists. Instead,
'secrets.change_userkey' is checked to determine whether a user has the
ability to activate a UserKey.

3. The 'users.delete_token permission' is no longer enforced. All users are
permitted to delete their own API tokens.


Changes to the REST API:

Numerous changes have been made to the REST API. Please check the changelogs
for more details.


Workaround for issues with invalid nested data:

Users that are experiencing invalid nested data with regions, rack groups, or
tenant groups can perform a one-time operation using the NetBox shell to
rebuild the correct nested relationships after upgrading:

# cd %%DATADIR%%
# python%%PYTHON_VER%% manage.py nbshell
### NetBox interactive shell (localhost)
### Python 3.x.x | Django 3.1.x | NetBox 2.9.x
### lsmodels() will show available models. Use help(<model>) for more info.
>>> Region.objects.rebuild()
>>> RackGroup.objects.rebuild()
>>> TenantGroup.objects.rebuild()
EOD
}
{ type: upgrade
maximum_version: 2.9.9
message: <<EOD
An new sample rc script has been added to manage the RQ-worker service. If the
EXAMPLES option is enabled (which is the default) it can be found in the
following directory:

%%EXAMPLESDIR%%/netbox_rq.sample
EOD
}
{ type: upgrade
maximum_version: 2.10.3
message: <<EOD
The Django templating language (DTL) is no longer supported for export
templates. Please ensure that all export templates use Jinja2 before
upgrading.

Also the support for embedded graphs was completely removed and several changes
to the REST API were made. Please check the changelogs for further details.
EOD
}
{ type: upgrade
maximum_version: 2.11.9
message: <<EOD
* All objects now use numeric IDs in their UI view URLs instead of slugs. You
may need to update external references to NetBox objects. (Note that this
does _not_ affect the REST API.)

* The UI now uses numeric IDs when filtering object lists. You may need to
update external links to filtered object lists. (Note that the slug- and
name-based filters will continue to work, however the filter selection fields
within the UI will not be automatically populated.)

* The RackGroup model has been renamed to "Location". Its REST API endpoint
has changed from /api/dcim/rack-groups/ to /api/dcim/locations/.

* The foreign key field "group" on dcim.Rack has been renamed to "location".

* The foreign key field "site" on ipam.VLANGroup has been replaced with the
"scope" generic foreign key.

* Custom script ObjectVars no longer support the "queryset" parameter:
Use "model" instead.

Several changes to the REST API were made as well. Please check the changelogs
for further details.
EOD
}
{ type: upgrade
maximum_version: 3.0.4
message: <<EOD
Expand Down Expand Up @@ -202,8 +98,8 @@ The NetBox 3.0 release contains major changes, so at least items 1.), 2.) and

Please run following commands to enable the new script:

# cp %%EXAMPLESDIR%%/850-netbox-housekeeping.sample %%LOCALBASE%%/etc/periodic/daily/850-netbox-housekeeping
# chmod 555 %%LOCALBASE%%/etc/periodic/daily/850-netbox-housekeeping
# cp %%EXAMPLESDIR%%/850.netbox-housekeeping.sample %%LOCALBASE%%/etc/periodic/daily/850.netbox-housekeeping
# chmod 555 %%LOCALBASE%%/etc/periodic/daily/850.netbox-housekeeping
# sysrc -f /etc/periodic.conf daily_netbox_housekeeping_enable="YES"
EOD
}
Expand Down Expand Up @@ -331,4 +227,57 @@ to be issued after each update:
# python%%PYTHON_VER%% manage.py clearcache
EOD
}
{ type: upgrade
maximum_version: 3.3.4
message: <<EOD
The NetBox 3.3 release contains some breaking API changes, so please check the
following items before running the database migrations:

* Device position, device type height, and rack unit values are now reported
as decimals (e.g. 1.0 or 1.5) to support modeling half-height rack units.

* The "nat_outside" relation on the IP address model now returns a list of zero
or more related IP addresses, rather than a single instance (or None).

* Several fields on the cable API serializers have been altered or removed to
support multiple-object cable terminations:

+------------------------------+------+-------------------------------+------+
| Old Name | Type | New Name | Type |
+------------------------------+------+-------------------------------+------+
| termination_a_type | str | Removed | - |
| termination_b_type | str | Removed | - |
| termination_a_id | int | Removed | - |
| termination_b_id | int | Removed | - |
| termination_a | obj | a_terminations | list |
| termination_b | obj | b_terminations | list |
+------------------------------+------+-------------------------------+------+

* As with the cable model, several API fields on all objects to which cables
can be connected (interfaces, circuit terminations, etc.) have been changed:

+------------------------------+------+-------------------------------+------+
| Old Name | Type | New Name | Type |
+------------------------------+------+-------------------------------+------+
| link_peer | obj | link_peers | list |
| link_peer_type | str | link_peers_type | str |
| connected_endpoint | obj | connected_endpoints | list |
| connected_endpoint_type | str | connected_endpoints_type | str |
| connected_endpoint_reachable | bool | connected_endpoints_reachable | bool |
+------------------------------+------+-------------------------------+------+

* The cable path serialization returned by the "/paths/" endpoint for
pass-through ports has been simplified, and the following fields removed:

"origin_type", "origin", "destination_type", "destination". (Additionally,
"is_complete" has been added.)

* Several changes to the REST API were made as well. Please check the
changelogs for further details.

* The netbox sample rc script got a new "upgrade" directive that also
simplifies the upgrade process (database migrations, building the embedded
documentation, etc.).
EOD
}
]

0 comments on commit 8b9888a

Please sign in to comment.