|
|
@@ -1,7 +1,6 @@
|
|
|
import platform
|
|
|
|
|
|
from django import __version__ as DJANGO_VERSION
|
|
|
-from django.apps import apps
|
|
|
from django.conf import settings
|
|
|
from django_rq.queues import get_connection
|
|
|
from drf_spectacular.types import OpenApiTypes
|
|
|
@@ -13,6 +12,7 @@ from rq.worker import Worker
|
|
|
|
|
|
from netbox.api.authentication import IsAuthenticatedOrLoginNotRequired
|
|
|
from netbox.plugins.utils import get_installed_plugins
|
|
|
+from utilities.apps import get_installed_apps
|
|
|
|
|
|
|
|
|
class APIRootView(APIView):
|
|
|
@@ -52,21 +52,10 @@ class StatusView(APIView):
|
|
|
|
|
|
@extend_schema(responses={200: OpenApiTypes.OBJECT})
|
|
|
def get(self, request):
|
|
|
- # Gather the version numbers from all installed Django apps
|
|
|
- installed_apps = {}
|
|
|
- for app_config in apps.get_app_configs():
|
|
|
- app = app_config.module
|
|
|
- version = getattr(app, 'VERSION', getattr(app, '__version__', None))
|
|
|
- if version:
|
|
|
- if type(version) is tuple:
|
|
|
- version = '.'.join(str(n) for n in version)
|
|
|
- installed_apps[app_config.name] = version
|
|
|
- installed_apps = {k: v for k, v in sorted(installed_apps.items())}
|
|
|
-
|
|
|
return Response({
|
|
|
'django-version': DJANGO_VERSION,
|
|
|
'hostname': settings.HOSTNAME,
|
|
|
- 'installed-apps': installed_apps,
|
|
|
+ 'installed_apps': get_installed_apps(),
|
|
|
'netbox-version': settings.RELEASE.version,
|
|
|
'netbox-full-version': settings.RELEASE.full_version,
|
|
|
'plugins': get_installed_plugins(),
|