netbox-acls icon indicating copy to clipboard operation
netbox-acls copied to clipboard

[Bug]: 4.0 Prep

Open jchambers2012 opened this issue 1 year ago • 2 comments

NetBox access-list plugin version

v1.5.0

NetBox version

v3.7.6->v4.0

Steps to Reproduce

Followed steps: https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins

  1. Upgrade netbox to v4.0: docker compose build --no-cache
  2. Start Docker Plugin docker compose up -d
  3. Fails at step RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input
0.993   File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_acls/__init__.py", line 5, in <module>
0.993     from extras.plugins import PluginConfig

Expected Behavior

I believe this line needs updating and maybe other based on this guide https://docs.netbox.dev/en/feature/plugins/development/migration-v4/

https://github.com/netbox-community/netbox-acls/blob/685a91bb07c0e54d4a59abee87d8827964ca60ac/netbox_acls/init.py#L5

too

from netbox.plugins import PluginConfig

Observed Behavior

Fails to build/start with the follow error

docker compose build --no-cache
[+] Building 31.5s (10/10) FINISHED                                                                                                                                                                                           docker:default
 => [netbox internal] load build definition from Dockerfile-Plugins                                                                                                                                                                     0.0s
 => => transferring dockerfile: 642B                                                                                                                                                                                                    0.0s
 => [netbox internal] load .dockerignore                                                                                                                                                                                                0.0s
 => => transferring context: 219B                                                                                                                                                                                                       0.0s
 => [netbox internal] load metadata for docker.io/netboxcommunity/netbox:latest                                                                                                                                                         0.5s
 => [netbox 1/6] FROM docker.io/netboxcommunity/netbox:latest@sha256:e5aae263d51d18fce9630c58035eed09a9cbfa69473fea0008724302f980555a                                                                                                  26.7s
 => => resolve docker.io/netboxcommunity/netbox:latest@sha256:e5aae263d51d18fce9630c58035eed09a9cbfa69473fea0008724302f980555a                                                                                                          0.0s
 => => sha256:8ad3ce0e76d0ed9e76cd21899d94c63437a7024f6c7c7239a7b48b1e78764486 42.15MB / 42.15MB                                                                                                                                        0.8s
 => => sha256:f1be1bc9a3690dcb235823106514ef93fcf7f09c38eac10d5634ace73bf41d8e 8.56kB / 8.56kB                                                                                                                                          0.0s
 => => sha256:56c566a8d234cbea1867522f63b812f51bb091866286e8f350f23a951171b9f5 27.23MB / 27.23MB                                                                                                                                        0.9s
 => => sha256:0f40d05267d641b8316b092aa91bda88dccf0ff3f7dfe1a98b640688bedac42b 2.95kB / 2.95kB                                                                                                                                          0.0s
 => => sha256:e5aae263d51d18fce9630c58035eed09a9cbfa69473fea0008724302f980555a 1.61kB / 1.61kB                                                                                                                                          0.0s
 => => sha256:f8563a8b848b17835eea32a1b1c02375bb53bcf1f2f8f489028fad419fd30254 111.46MB / 111.46MB                                                                                                                                      2.4s
 => => sha256:d9338d0404b7890f01f7f5fc6bed25bc6f6a513758c9c1b9922e2a773b345ae2 17.71MB / 17.71MB                                                                                                                                        1.2s
 => => extracting sha256:56c566a8d234cbea1867522f63b812f51bb091866286e8f350f23a951171b9f5                                                                                                                                               2.3s
 => => sha256:128035b57a0eaeef158cff39cb84a58a0bea19d687d7bcd7cbf3ca0b63124e19 730B / 730B                                                                                                                                              1.0s
 => => sha256:2a5dcbdc2fe168d9fee01d9c64e8fb2c04c161af825f03f0d6eb0050be39fa83 1.12kB / 1.12kB                                                                                                                                          1.1s
 => => sha256:aa1425cf4585272b3da9e68d7475c62f19d9ab0b3984c3e4af289edfb4dc3f3f 417B / 417B                                                                                                                                              1.3s
 => => sha256:8349b762e88a2e820e1233a072341ce263c7e2febeb5a9763d13645d4bc1a6dd 890B / 890B                                                                                                                                              1.4s
 => => sha256:e1f4e4511fd59bb465aa68e31b69da24f6cf382f49fc3d4ac657501f0033d214 1.60kB / 1.60kB                                                                                                                                          1.3s
 => => sha256:6fd6fcbb48acb704c0536bf1832eb24cd06e6b1801c18a5b8c02f9736ab7c351 319B / 319B                                                                                                                                              1.3s
 => => sha256:9df04d904323b163765c1f6f5f41bbe52bf85bc3317e8f852e2e55a749532dc2 9.37kB / 9.37kB                                                                                                                                          1.6s
 => => sha256:6aed878451e76e39be3c1b9bff9da3c60462f47c98acd7121eb5a7bf66241043 475B / 475B                                                                                                                                              1.5s
 => => sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1 32B / 32B                                                                                                                                                1.6s
 => => sha256:706013e6fa391cb4d94ec60ffe4ca70ef656321babc311345a9da84d53b62aad 28.74MB / 28.74MB                                                                                                                                        2.2s
 => => extracting sha256:8ad3ce0e76d0ed9e76cd21899d94c63437a7024f6c7c7239a7b48b1e78764486                                                                                                                                               2.9s
 => => extracting sha256:f8563a8b848b17835eea32a1b1c02375bb53bcf1f2f8f489028fad419fd30254                                                                                                                                              16.6s
 => => extracting sha256:d9338d0404b7890f01f7f5fc6bed25bc6f6a513758c9c1b9922e2a773b345ae2                                                                                                                                               1.0s
 => => extracting sha256:128035b57a0eaeef158cff39cb84a58a0bea19d687d7bcd7cbf3ca0b63124e19                                                                                                                                               0.0s
 => => extracting sha256:2a5dcbdc2fe168d9fee01d9c64e8fb2c04c161af825f03f0d6eb0050be39fa83                                                                                                                                               0.0s
 => => extracting sha256:aa1425cf4585272b3da9e68d7475c62f19d9ab0b3984c3e4af289edfb4dc3f3f                                                                                                                                               0.0s
 => => extracting sha256:e1f4e4511fd59bb465aa68e31b69da24f6cf382f49fc3d4ac657501f0033d214                                                                                                                                               0.0s
 => => extracting sha256:6fd6fcbb48acb704c0536bf1832eb24cd06e6b1801c18a5b8c02f9736ab7c351                                                                                                                                               0.0s
 => => extracting sha256:8349b762e88a2e820e1233a072341ce263c7e2febeb5a9763d13645d4bc1a6dd                                                                                                                                               0.0s
 => => extracting sha256:9df04d904323b163765c1f6f5f41bbe52bf85bc3317e8f852e2e55a749532dc2                                                                                                                                               0.0s
 => => extracting sha256:6aed878451e76e39be3c1b9bff9da3c60462f47c98acd7121eb5a7bf66241043                                                                                                                                               0.0s
 => => extracting sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1                                                                                                                                               0.0s
 => => extracting sha256:706013e6fa391cb4d94ec60ffe4ca70ef656321babc311345a9da84d53b62aad                                                                                                                                               1.9s
 => [netbox internal] load build context                                                                                                                                                                                                0.0s
 => => transferring context: 400B                                                                                                                                                                                                       0.0s
 => [netbox 2/6] COPY ./plugin_requirements.txt /opt/netbox/                                                                                                                                                                            0.3s
 => [netbox 3/6] RUN /opt/netbox/venv/bin/pip install  --no-warn-script-location -r /opt/netbox/plugin_requirements.txt                                                                                                                 2.7s
 => [netbox 4/6] COPY configuration/configuration.py /etc/netbox/config/configuration.py                                                                                                                                                0.0s
 => [netbox 5/6] COPY configuration/plugins.py /etc/netbox/config/plugins.py                                                                                                                                                            0.0s
 => ERROR [netbox 6/6] RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input                                                            1.1s
------
 > [netbox 6/6] RUN SECRET_KEY="dummydummydummydummydummydummydummydummydummydummy" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input:
0.991 Traceback (most recent call last):
0.991   File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 255, in fetch_command
0.991     app_name = commands[subcommand]
0.991                ~~~~~~~~^^^^^^^^^^^^
0.991 KeyError: 'collectstatic'
0.991
0.991 During handling of the above exception, another exception occurred:
0.991
0.991 Traceback (most recent call last):
0.991   File "/opt/netbox/netbox/manage.py", line 10, in <module>
0.991     execute_from_command_line(sys.argv)
0.991   File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
0.991 🧬 loaded config '/etc/netbox/config/configuration.py'
0.991 🧬 loaded config '/etc/netbox/config/extra.py'
0.991 🧬 loaded config '/etc/netbox/config/logging.py'
0.991 🧬 loaded config '/etc/netbox/config/plugins.py'
0.991     utility.execute()
0.991   File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 436, in execute
0.991     self.fetch_command(subcommand).run_from_argv(self.argv)
0.991     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.991   File "/opt/netbox/venv/lib/python3.11/site-packages/django/core/management/__init__.py", line 262, in fetch_command
0.991     settings.INSTALLED_APPS
0.991   File "/opt/netbox/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 89, in __getattr__
0.991     self._setup(name)
0.991   File "/opt/netbox/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 76, in _setup
0.992     self._wrapped = Settings(settings_module)
0.992                     ^^^^^^^^^^^^^^^^^^^^^^^^^
0.992   File "/opt/netbox/venv/lib/python3.11/site-packages/django/conf/__init__.py", line 190, in __init__
0.992     mod = importlib.import_module(self.SETTINGS_MODULE)
0.992           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.992   File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
0.992     return _bootstrap._gcd_import(name[level:], package, level)
0.992            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.992   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
0.992   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
0.992   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
0.992   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
0.992   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
0.992   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
0.992   File "/opt/netbox/netbox/netbox/settings.py", line 742, in <module>
0.993     raise e
0.993   File "/opt/netbox/netbox/netbox/settings.py", line 735, in <module>
0.993     plugin = importlib.import_module(plugin_name)
0.993              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.993   File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
0.993     return _bootstrap._gcd_import(name[level:], package, level)
0.993            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
0.993   File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
0.993   File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
0.993   File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
0.993   File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
0.993   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
0.993   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
0.993   File "/opt/netbox/venv/lib/python3.11/site-packages/netbox_acls/__init__.py", line 5, in <module>
0.993     from extras.plugins import PluginConfig
0.993 ModuleNotFoundError: No module named 'extras.plugins'
------
failed to solve: process "/bin/sh -c SECRET_KEY=\"dummydummydummydummydummydummydummydummydummydummy\" /opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py collectstatic --no-input" did not complete successfully: exit code: 1

jchambers2012 avatar May 07 '24 13:05 jchambers2012

Thanks for opening this Issue! We really appreciate the feedback & testing from users like you!

github-actions[bot] avatar May 07 '24 13:05 github-actions[bot]

Change-list (pending update/PR) - fixes breaking for 4.0

netbox-acls/netbox_acls/init.py: * from: from extras.plugins import PluginConfig * to: from netbox.plugins import PluginConfig

netbox-acls/netbox_acls/navigation.py * from: from extras.plugins import PluginMenu, PluginMenuButton, PluginMenuItem * to: from netbox.plugins import PluginMenu, PluginMenuButton, PluginMenuItem

* From: from utilities.choices import ButtonColorChoices
* To: from netbox.choices import ButtonColorChoices

netbox-acls/netbox_acls/choices.py:
 * From: from utilities.choices import ChoiceSet
 * To: netbox.choices import ChoiceSet

Note: still various warnings:


netbox-1               | /opt/netbox/netbox/utilities/templatetags/form_helpers.py:60: UserWarning: <class 'netbox_acls.forms.filtersets.ACLExtendedRuleFilterForm'> fieldsets contains a non-FieldSet item: (None, ('q', 'tag'))

netbox-1 | warnings.warn( netbox-1 | /opt/netbox/netbox/utilities/templatetags/for

cruse1977 avatar May 08 '24 14:05 cruse1977