networktocode / ntc-netbox-plugin-onboarding

A plugin for NetBox to easily onboard new devices.
Other
245 stars 46 forks source link

Add support for NetBox 2.11.x #138

Closed xth0331 closed 3 years ago

xth0331 commented 3 years ago

Environment

PieterL75 commented 3 years ago

I get the same error: django.core.exceptions.ImproperlyConfigured: Plugin netbox_onboarding requires NetBox maximum version 2.10.99.

Python 3.7.3 Netbox 2.11.1 ntc_netbox_plugin_onboarding-2.1.0-py3-none-any.whl (598 kB)

Is it already updated ?

Pieter

jabehnken commented 3 years ago

It seems like someone could just update init.py to a max version of 2.11.99 and test it out. If someone could point me in the right direction i could stand up an environment quickly to test it.

dagolovach commented 3 years ago

I get the same error

theandrelima commented 3 years ago

It seems like someone could just update init.py to a max version of 2.11.99 and test it out. If someone could point me in the right direction i could stand up an environment quickly to test it.

@jabehnken I just did that and still I get the same error.

worker_1 | File "/opt/netbox/netbox/netbox/configuration.py", line 110, in worker_1 | raise ImproperlyConfigured(f"Version {NETBOX_RELEASE_CURRENT} of NetBox is unsupported at this time.") worker_1 | django.core.exceptions.ImproperlyConfigured: Version 2.11.3 of NetBox is unsupported at this time.

omula commented 3 years ago

This patch makes it work with version 2.11.7 although it breaks compatibility with previous versions. Maybe using conditionals and import as may make it work with backwards compatibility.

diff -Nur ntc-netbox-plugin-onboarding/netbox_onboarding/filters.py /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/filters.py                                                                                              
--- ntc-netbox-plugin-onboarding/netbox_onboarding/filters.py   2021-06-25 20:58:22.758370826 +0200
+++ /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/filters.py   2021-06-25 20:27:34.074016037 +0200
@@ -16,12 +16,12 @@
 from django.db.models import Q

 from dcim.models import Site, DeviceRole, Platform
-from utilities.filters import NameSlugSearchFilterSet
+from netbox.filtersets import OrganizationalModelFilterSet

 from .models import OnboardingTask                                                                                                                                                                                                        

-class OnboardingTaskFilter(NameSlugSearchFilterSet):                                                                                                                                                                                      
+class OnboardingTaskFilter(OrganizationalModelFilterSet):                                                                                                                                                                                 
     """Filter capabilities for OnboardingTask instances."""

     q = django_filters.CharFilter(method="search", label="Search",)                                                                                                                                                                       
diff -Nur ntc-netbox-plugin-onboarding/netbox_onboarding/__init__.py /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/__init__.py                                                                                            
--- ntc-netbox-plugin-onboarding/netbox_onboarding/__init__.py  2021-06-25 20:58:22.757370823 +0200                                                                                                                                        
+++ /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/__init__.py  2021-06-25 20:13:11.906056588 +0200                                                                                                                        
@@ -28,7 +28,7 @@                                                                                                                                                                                                                          
     base_url = "onboarding"                                                                                                                                                                                                               
     required_settings = []                                                                                                                                                                                                                
     min_version = "2.8.1"                                                                                                                                                                                                                 
-    max_version = "2.10.99"                                                                                                                                                                                                               
+    max_version = "2.11.99"                                                                                                                                                                                                               
     default_settings = {                                                                                                                                                                                                                  
         "create_platform_if_missing": True,                                                                                                                                                                                               
         "create_manufacturer_if_missing": True,                                                                                                                                                                                           
diff -Nur ntc-netbox-plugin-onboarding/netbox_onboarding/models.py /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/models.py                                                                                                
--- ntc-netbox-plugin-onboarding/netbox_onboarding/models.py    2021-06-25 20:58:22.758370826 +0200                                                                                                                                        
+++ /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/models.py    2021-06-25 20:20:15.307509349 +0200                                                                                                                        
@@ -17,14 +17,17 @@                                                                                                                                                                                                                        
 from django.urls import reverse                                                                                                                                                                                                           
 from dcim.models import Device                                                                                                                                                                                                            
 from .choices import OnboardingStatusChoices, OnboardingFailChoices                                                                                                                                                                       
-from .release import NETBOX_RELEASE_CURRENT, NETBOX_RELEASE_29                                                                                                                                                                            
+from .release import NETBOX_RELEASE_CURRENT, NETBOX_RELEASE_29, NETBOX_RELEASE_210                                                                                                                                                        

 # Support NetBox 2.8                                                                                                                                                                                                                      
 if NETBOX_RELEASE_CURRENT < NETBOX_RELEASE_29:
     from utilities.models import ChangeLoggedModel  # pylint: disable=no-name-in-module, import-error                                                                                                                                     
-# Support NetBox 2.9                                                                                                                                                                                                                      
-else:                                                                                                                                                                                                                                     
+# Support NetBox 2.9 to 2.10                                                                                                                                                                                                              
+elif NETBOX_RELEASE_CURRENT <= NETBOX_RELEASE_210:                                                                                                                                                                                         
     from extras.models import ChangeLoggedModel  # pylint: disable=no-name-in-module, import-error
+# Support NetBox 2.11
+else:
+    from netbox.models import ChangeLoggedModel  # pylint: disable=no-name-in-module, import-error

 class OnboardingTask(ChangeLoggedModel):
sdktr commented 3 years ago

This patch makes it work with version 2.11.7 although it breaks compatibility with previous versions. Maybe using conditionals and import as may make it work with backwards compatibility.

Your import in models.py is already conditional, yes? If you add the same logic to filters.py it's all good? Could you make a PR for that?

jaheshkhan commented 3 years ago

This patch makes it work with version 2.11.7 although it breaks compatibility with previous versions. Maybe using conditionals and import as may make it work with backwards compatibility.

diff -Nur ntc-netbox-plugin-onboarding/netbox_onboarding/filters.py /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/filters.py                                                                                              
--- ntc-netbox-plugin-onboarding/netbox_onboarding/filters.py   2021-06-25 20:58:22.758370826 +0200
+++ /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/filters.py   2021-06-25 20:27:34.074016037 +0200
@@ -16,12 +16,12 @@
 from django.db.models import Q

 from dcim.models import Site, DeviceRole, Platform
-from utilities.filters import NameSlugSearchFilterSet
+from netbox.filtersets import OrganizationalModelFilterSet

 from .models import OnboardingTask                                                                                                                                                                                                        

-class OnboardingTaskFilter(NameSlugSearchFilterSet):                                                                                                                                                                                      
+class OnboardingTaskFilter(OrganizationalModelFilterSet):                                                                                                                                                                                 
     """Filter capabilities for OnboardingTask instances."""

     q = django_filters.CharFilter(method="search", label="Search",)                                                                                                                                                                       
diff -Nur ntc-netbox-plugin-onboarding/netbox_onboarding/__init__.py /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/__init__.py                                                                                            
--- ntc-netbox-plugin-onboarding/netbox_onboarding/__init__.py  2021-06-25 20:58:22.757370823 +0200                                                                                                                                        
+++ /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/__init__.py  2021-06-25 20:13:11.906056588 +0200                                                                                                                        
@@ -28,7 +28,7 @@                                                                                                                                                                                                                          
     base_url = "onboarding"                                                                                                                                                                                                               
     required_settings = []                                                                                                                                                                                                                
     min_version = "2.8.1"                                                                                                                                                                                                                 
-    max_version = "2.10.99"                                                                                                                                                                                                               
+    max_version = "2.11.99"                                                                                                                                                                                                               
     default_settings = {                                                                                                                                                                                                                  
         "create_platform_if_missing": True,                                                                                                                                                                                               
         "create_manufacturer_if_missing": True,                                                                                                                                                                                           
diff -Nur ntc-netbox-plugin-onboarding/netbox_onboarding/models.py /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/models.py                                                                                                
--- ntc-netbox-plugin-onboarding/netbox_onboarding/models.py    2021-06-25 20:58:22.758370826 +0200                                                                                                                                        
+++ /opt/netbox/venv/lib/python3.8/site-packages/netbox_onboarding/models.py    2021-06-25 20:20:15.307509349 +0200                                                                                                                        
@@ -17,14 +17,17 @@                                                                                                                                                                                                                        
 from django.urls import reverse                                                                                                                                                                                                           
 from dcim.models import Device                                                                                                                                                                                                            
 from .choices import OnboardingStatusChoices, OnboardingFailChoices                                                                                                                                                                       
-from .release import NETBOX_RELEASE_CURRENT, NETBOX_RELEASE_29                                                                                                                                                                            
+from .release import NETBOX_RELEASE_CURRENT, NETBOX_RELEASE_29, NETBOX_RELEASE_210                                                                                                                                                        

 # Support NetBox 2.8                                                                                                                                                                                                                      
 if NETBOX_RELEASE_CURRENT < NETBOX_RELEASE_29:
     from utilities.models import ChangeLoggedModel  # pylint: disable=no-name-in-module, import-error                                                                                                                                     
-# Support NetBox 2.9                                                                                                                                                                                                                      
-else:                                                                                                                                                                                                                                     
+# Support NetBox 2.9 to 2.10                                                                                                                                                                                                              
+elif NETBOX_RELEASE_CURRENT <= NETBOX_RELEASE_210:                                                                                                                                                                                         
     from extras.models import ChangeLoggedModel  # pylint: disable=no-name-in-module, import-error
+# Support NetBox 2.11
+else:
+    from netbox.models import ChangeLoggedModel  # pylint: disable=no-name-in-module, import-error

 class OnboardingTask(ChangeLoggedModel):

how to apply this patch. I want to try this in 2.11.7.

since im not expert in linux, please tell me how to make it work this patch?

why 2.11.x still not supported by this plugin? is this plugin dead?

mzbroch commented 3 years ago

Thank you for your interest in the plugin and support for NetBox 2.11!

This feature was on our internal roadmap, however work on it has been delayed - current possible target could be mid/end July 2021.

For us, here at Network to Code, frequent NetBox releases provide impacting changes to the plugin's code we have to discover and support. Those efforts are not supported by the NetBox project, and NetBox's features used by the plugin have never been guaranteed for use, stability and longevity by the NetBox team.

Code integration, long-term support and plugin compatibility were one of key decisions for us to move to Nautobot app platform - please see https://www.networktocode.com/nautobot/apps/ and https://blog.networktocode.com/post/why-did-network-to-code-fork-netbox/ for more details.

mzbroch commented 3 years ago

Implemented in #143