artyomovs / netbox-plugin-config-officer

NetBox plugin that stores configuration diffs and checks templates compliance
Apache License 2.0
101 stars 7 forks source link

A few issues #2

Closed jpobeda closed 1 year ago

jpobeda commented 3 years ago

Hi there,

I watched your youtube video and decided to give it a go. It looks very neat. Good work :)

I found a few things. I don't run netbox-docker so I went the pip install way

1) There is an import that doesn't look right on `config_officer/views.py` ``` from netbox.views.generic import ( ObjectListView, ObjectEditView, BulkDeleteView, ObjectDeleteView ) ``` Shouldn't this be? ``` from utilities.views import ( ObjectListView, ObjectEditView, BulkDeleteView, ObjectDeleteView ) ```
2) The other issue is the migrations file, it has a dependency that can't be met ``` django.db.migrations.exceptions.NodeNotFoundError: Migration config_officer.0001_initial dependencies reference nonexistent parent node ('dcim', '0122_standardize_name_length') ```
3) Custom fields don't get created Either that or the README is misleading.

After making those changes I was able to get the plugin and netbox back up. I couldn't actually test its functionality yet.

I'd also recommend adding a netbox supported version because I suspect some of the above might be related to earlier versions of netbox. I'm currently testing on 2.9.11

Cheers,

artyomovs commented 3 years ago

Hi @jpobeda . Thank you for feedback. The reason of the first point - the plugin is compatible only with Netbox >= 2.10 version. It's absolutely my fault that I didn't mention this. I'll do my best to make it compatible with 2.8 and 2.9 versions as well. Cusctom fields are not supposed to be created. It's optionally, so I decided to not create them automatically. Probably, I should change this behavior.

Thanks for your comment. I won't close it until I fix these issues.

LassePettsson commented 3 years ago

Found issues with upper/lower case on filenames, hostgname and device names in netbox. ended up with a lot of problem where files could not be found in git because of the upper/lowercase names. also could not get the SSH connection working. could not find out why.

artyomovs commented 3 years ago

Hello @LassePettsson . Please check out new version 0.0.3. I fixed the issue with upper/lower case. For SSH - did you removed the line "user: '101'" from docker-compose.yml file? To be honest, I don't know how to handle with ssh and this line, so you should comment or delete it.

andrewm659 commented 2 years ago

So I also installed it via pip on AlmaLinux 8.4. I am getting the following error when starting netbox with the plugin enabled.

Oct 27 11:11:45 dcim001 systemd[1]: Started NetBox Request Queue Worker. Oct 27 11:11:46 dcim001 python3[17731]: Traceback (most recent call last): Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/netbox/manage.py", line 10, in <module> Oct 27 11:11:46 dcim001 python3[17731]: execute_from_command_line(sys.argv) Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line Oct 27 11:11:46 dcim001 python3[17731]: utility.execute() Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/management/__init__.py", line 413, in execute Oct 27 11:11:46 dcim001 python3[17731]: self.fetch_command(subcommand).run_from_argv(self.argv) Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv Oct 27 11:11:46 dcim001 python3[17731]: self.execute(*args, **cmd_options) Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/management/base.py", line 393, in execute Oct 27 11:11:46 dcim001 python3[17731]: self.check() Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/management/base.py", line 419, in check Oct 27 11:11:46 dcim001 python3[17731]: all_issues = checks.run_checks( Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/checks/registry.py", line 76, in run_checks Oct 27 11:11:46 dcim001 python3[17731]: new_errors = check(app_configs=app_configs, databases=databases) Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config Oct 27 11:11:46 dcim001 python3[17731]: return check_resolver(resolver) Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver Oct 27 11:11:46 dcim001 python3[17731]: return check_method() Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/urls/resolvers.py", line 412, in check Oct 27 11:11:46 dcim001 python3[17731]: for pattern in self.url_patterns: Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/utils/functional.py", line 48, in __get__ Oct 27 11:11:46 dcim001 python3[17731]: res = instance.__dict__[self.name] = self.func(instance) Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/urls/resolvers.py", line 598, in url_patterns Oct 27 11:11:46 dcim001 python3[17731]: patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/utils/functional.py", line 48, in __get__ Oct 27 11:11:46 dcim001 python3[17731]: res = instance.__dict__[self.name] = self.func(instance) Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/django/urls/resolvers.py", line 591, in urlconf_module Oct 27 11:11:46 dcim001 python3[17731]: return import_module(self.urlconf_name) Oct 27 11:11:46 dcim001 python3[17731]: File "/usr/lib64/python3.8/importlib/__init__.py", line 127, in import_module Oct 27 11:11:46 dcim001 python3[17731]: return _bootstrap._gcd_import(name[level:], package, level) Oct 27 11:11:46 dcim001 python3[17731]: File "<frozen importlib._bootstrap>", line 1014, in _gcd_import Oct 27 11:11:46 dcim001 python3[17731]: File "<frozen importlib._bootstrap>", line 991, in _find_and_load Oct 27 11:11:46 dcim001 python3[17731]: File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked Oct 27 11:11:46 dcim001 python3[17731]: File "<frozen importlib._bootstrap>", line 671, in _load_unlocked Oct 27 11:11:46 dcim001 python3[17731]: File "<frozen importlib._bootstrap_external>", line 783, in exec_module Oct 27 11:11:46 dcim001 python3[17731]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox-3.0.7/netbox/netbox/urls.py", line 9, in <module> Oct 27 11:11:46 dcim001 python3[17731]: from extras.plugins.urls import plugin_admin_patterns, plugin_patterns, plugin_api_patterns Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox-3.0.7/netbox/extras/plugins/urls.py", line 28, in <module> Oct 27 11:11:46 dcim001 python3[17731]: urlpatterns = import_object(f"{plugin_path}.urls.urlpatterns") Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox-3.0.7/netbox/extras/plugins/utils.py", line 31, in import_object Oct 27 11:11:46 dcim001 python3[17731]: spec.loader.exec_module(module) Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/config_officer/urls.py", line 2, in <module> Oct 27 11:11:46 dcim001 python3[17731]: from . import views Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/config_officer/views.py", line 26, in <module> Oct 27 11:11:46 dcim001 python3[17731]: from .filters import CollectionFilter, ServiceMappingFilter Oct 27 11:11:46 dcim001 python3[17731]: File "/opt/netbox/venv/lib64/python3.8/site-packages/config_officer/filters.py", line 1, in <module> Oct 27 11:11:46 dcim001 python3[17731]: from utilities.filters import NameSlugSearchFilterSet Oct 27 11:11:46 dcim001 python3[17731]: ImportError: cannot import name 'NameSlugSearchFilterSet' from 'utilities.filters' (/opt/netbox-3.0.7/netbox/utilities/filters.py) Oct 27 11:11:47 dcim001 systemd[1]: netbox-rq.service: Main process exited, code=exited, status=1/FAILURE Oct 27 11:11:47 dcim001 systemd[1]: netbox-rq.service: Failed with result 'exit-code'. [ameyer@dcim001 log]$

artyomovs commented 1 year ago

I'm working on the 3.x version, will be fixed there.