netbox-community / netbox

The premier source of truth powering network automation. Open source under Apache 2. Try NetBox Cloud free: https://netboxlabs.com/free-netbox-cloud/
http://netboxlabs.com/oss/netbox/
Apache License 2.0
16.3k stars 2.59k forks source link

Unable to upgrade from v3.5.7 to v3.5.8 #13480

Closed mgades closed 1 year ago

mgades commented 1 year ago

NetBox version

v3.5.8

Python version

3.10

Steps to Reproduce

cd /opt/netbox sudo git checkout master sudo git pull origin master sudo ./upgrade.sh

Expected Behavior

Usually the above is enough to update NetBox :)

Observed Behavior

I get the following TraceBack on database migrations (all run from upgrade.sh). I have the following in /opt/netbox/local_requirements.txt:

django-auth-ldap netbox-napalm-plugin napalm-procurve

I tried removing "napalm-procurve". Same error.

File "/opt/netbox/venv/lib/python3.10/site-packages/netbox_napalm_plugin/api/views.py", line 3, in <module>
    from extras.plugins import get_plugin_config

ImportError: cannot import name 'get_plugin_config' from 'extras.plugins' (/opt/netbox/netbox/extras/plugins/__init__.py)
<snip>
Installing collected packages: pyserial, yamlordereddictloader, ttp, transitions, pyparsing, pyeapi, pyasn1-modules, netutils, lxml, future, bcrypt, ttp-templates, textfsm, python-ldap, pynacl, paramiko, ntc-templates, django-auth-ldap, scp, ncclient, netmiko, junos-eznc, napalm, netbox-napalm-plugin, napalm-procurve
Successfully installed bcrypt-4.0.1 django-auth-ldap-4.5.0 future-0.18.3 junos-eznc-2.6.7 lxml-4.9.3 napalm-4.1.0 napalm-procurve-0.6.0 ncclient-0.6.13 netbox-napalm-plugin-0.1.2 netmiko-4.2.0 netutils-1.5.0 ntc-templates-3.5.0 paramiko-3.3.1 pyasn1-modules-0.3.0 pyeapi-1.0.2 pynacl-1.5.0 pyparsing-3.1.1 pyserial-3.5 python-ldap-3.4.3 scp-0.14.5 textfsm-1.1.3 transitions-0.9.0 ttp-0.9.5 ttp-templates-0.3.5 yamlordereddictloader-0.4.0
Applying database migrations (python3 netbox/manage.py migrate)...
Traceback (most recent call last):
  File "/opt/netbox/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 96, in wrapped
    res = handle_func(*args, **kwargs)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/commands/migrate.py", line 97, in handle
    self.check(databases=[database])
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/management/base.py", line 475, in check
    all_issues = checks.run_checks(
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/checks/registry.py", line 88, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/checks/urls.py", line 14, in check_url_config
    return check_resolver(resolver)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/core/checks/urls.py", line 24, in check_resolver
    return check_method()
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/urls/resolvers.py", line 494, in check
    for pattern in self.url_patterns:
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/urls/resolvers.py", line 715, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/functional.py", line 57, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/urls/resolvers.py", line 708, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/netbox/netbox/netbox/urls.py", line 8, in <module>
    from extras.plugins.urls import plugin_admin_patterns, plugin_patterns, plugin_api_patterns
  File "/opt/netbox/netbox/extras/plugins/urls.py", line 38, in <module>
    urlpatterns = import_string(f"{plugin_path}.api.urls.urlpatterns")
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/module_loading.py", line 30, in import_string
    return cached_import(module_path, class_name)
  File "/opt/netbox/venv/lib/python3.10/site-packages/django/utils/module_loading.py", line 15, in cached_import
    module = import_module(module_path)
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "/opt/netbox/venv/lib/python3.10/site-packages/netbox_napalm_plugin/api/urls.py", line 4, in <module>
    from .views import NapalmPlatformConfigViewSet
  File "/opt/netbox/venv/lib/python3.10/site-packages/netbox_napalm_plugin/api/views.py", line 3, in <module>
    from extras.plugins import get_plugin_config
ImportError: cannot import name 'get_plugin_config' from 'extras.plugins' (/opt/netbox/netbox/extras/plugins/__init__.py)
</snip>
kkthxbye-code commented 1 year ago

Issue is with the napalm plugin, see: https://github.com/netbox-community/netbox-napalm/issues/16