Close #18635: Show only the semantic version

This modifies the 'netbox-version' to only show the semantic version of Netbox
and adds 'netbox-full-version' to show the full version.

Related issues:
- https://github.com/netbox-community/netbox/issues/15908
- https://github.com/netbox-community/ansible_modules/issues/1381
This commit is contained in:
Tobias Genannt 2025-02-16 09:47:10 +01:00 committed by Tobias Genannt
parent ef89fc1264
commit 2eaee8bf45

View File

@ -4,15 +4,15 @@ from django import __version__ as DJANGO_VERSION
from django.apps import apps from django.apps import apps
from django.conf import settings from django.conf import settings
from django_rq.queues import get_connection from django_rq.queues import get_connection
from drf_spectacular.utils import extend_schema
from drf_spectacular.types import OpenApiTypes from drf_spectacular.types import OpenApiTypes
from drf_spectacular.utils import extend_schema
from rest_framework.response import Response from rest_framework.response import Response
from rest_framework.reverse import reverse from rest_framework.reverse import reverse
from rest_framework.views import APIView from rest_framework.views import APIView
from rq.worker import Worker from rq.worker import Worker
from netbox.plugins.utils import get_installed_plugins
from netbox.api.authentication import IsAuthenticatedOrLoginNotRequired from netbox.api.authentication import IsAuthenticatedOrLoginNotRequired
from netbox.plugins.utils import get_installed_plugins
class APIRootView(APIView): class APIRootView(APIView):
@ -66,7 +66,8 @@ class StatusView(APIView):
return Response({ return Response({
'django-version': DJANGO_VERSION, 'django-version': DJANGO_VERSION,
'installed-apps': installed_apps, 'installed-apps': installed_apps,
'netbox-version': settings.RELEASE.full_version, 'netbox-version': settings.RELEASE.version,
'netbox-full-version': settings.RELEASE.full_version,
'plugins': get_installed_plugins(), 'plugins': get_installed_plugins(),
'python-version': platform.python_version(), 'python-version': platform.python_version(),
'rq-workers-running': Worker.count(get_connection('default')), 'rq-workers-running': Worker.count(get_connection('default')),