Skip to content

v0.5.0 not compatible with Netbox prior to v4.5.2 #511

@mathieued

Description

@mathieued

Plugin Version

v0.5.0

NetBox Version

v4.4.10

Python Version

v3.11.11

Steps to Reproduce

  1. Install Netbox v4.4.10
  2. Install netbox-custom-objects plugin v0.5.0
  3. Apply migration to the database with ./manage.py migrate

Expected Behavior

Migration should run smooth and not generate any errors.

Observed Behavior

An error is generated because Netbox v4.5.1 and older doesn't have the get_config_value_ci method in the utilities.data python file.

Here is the output of the error:

  File "/opt/netbox-4.4.10/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox-4.4.10/venv/lib64/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/opt/netbox-4.4.10/venv/lib64/python3.11/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/opt/netbox-4.4.10/venv/lib64/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/opt/netbox-4.4.10/venv/lib64/python3.11/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/opt/netbox-4.4.10/venv/lib64/python3.11/site-packages/django/apps/config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/netbox-4.4.10/venv/lib64/python3.11/site-packages/netbox_custom_objects/models.py", line 53, in <module>
    from utilities.data import get_config_value_ci
ImportError: cannot import name 'get_config_value_ci' from 'utilities.data' (/opt/netbox-4.4.10/netbox/utilities/data.py)

This method has been added in Netbox v4.5.2 and used in the netbox_custom_objects/models.py file.
Not sure if a fix is necessary, or at least an update to the compatibility matrix file.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions