amyasnikov / validity

NetBox plugin to validate network devices
MIT License
136 stars 8 forks source link

Problem with installation #46

Closed rodjerzz closed 1 year ago

rodjerzz commented 1 year ago

Hello. I'm trying to install you plugin but when I try to install I have a problem netbox = 3.5.2 python = 3.11 plugin version = 1.2.1 Used steps from manual

./manage.py migrate validity

Traceback (most recent call last):
  File "/opt/netbox/netbox/manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/opt/netbox-3.5.2/venv/lib64/python3.11/site-packages/django/core/management/__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "/opt/netbox-3.5.2/venv/lib64/python3.11/site-packages/django/core/management/__init__.py", line 420, in execute
    django.setup()
  File "/opt/netbox-3.5.2/venv/lib64/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/opt/netbox-3.5.2/venv/lib64/python3.11/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/opt/netbox-3.5.2/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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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-3.5.2/venv/lib64/python3.11/site-packages/validity/models/__init__.py", line 2, in <module>
    from .device import VDevice
  File "/opt/netbox-3.5.2/venv/lib64/python3.11/site-packages/validity/models/device.py", line 7, in <module>
    from validity.managers import VDeviceQS
  File "/opt/netbox-3.5.2/venv/lib64/python3.11/site-packages/validity/managers.py", line 11, in <module>
    from validity.choices import DeviceGroupByChoices, SeverityChoices
  File "/opt/netbox-3.5.2/venv/lib64/python3.11/site-packages/validity/choices.py", line 38, in <module>
    class BoolOperationChoices(TextChoices, metaclass=ColoredChoiceMeta):
  File "/opt/netbox-3.5.2/venv/lib64/python3.11/site-packages/validity/choices.py", line 28, in __new__
    namespace[key] = attr
    ~~~~~~~~~^^^^^
  File "/usr/lib64/python3.11/enum.py", line 452, in __setitem__
    self._member_names[key] = None
    ~~~~~~~~~~~~~~~~~~^^^^^
TypeError: list indices must be integers or slices, not str
amyasnikov commented 1 year ago

Hi, I confirm this as a bug. It's an issue with Python 3.11. As a quick workaround you may try python 3.10 if it's acceptable for you

amyasnikov commented 1 year ago

This fix will be a part of 1.3.0, I'm going to release it within a week.

Alternatively you can install development version right now via pip

pip install git+https://github.com/amyasnikov/validity.git@devel