diff --git a/.ci/ansible/start_container.yaml b/.ci/ansible/start_container.yaml index 43d4d47098..bdf35b4315 100644 --- a/.ci/ansible/start_container.yaml +++ b/.ci/ansible/start_container.yaml @@ -81,13 +81,22 @@ command: "docker logs pulp" failed_when: true - - name: "Check version of component being tested" - assert: - that: - - (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] | canonical_semver == (component_version | canonical_semver) - fail_msg: | - Component {{ component_name }} was expected to be installed in version {{ component_version }}. - Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] }}. + - block: + - name: "Check version of component being tested" + assert: + that: + - (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] | canonical_semver == (component_version | canonical_semver) + fail_msg: | + Component {{ component_name }} was expected to be installed in version {{ component_version }}. + Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[component_name] }}. + rescue: + - name: "Check version of component being tested (legacy)" + assert: + that: + - (result.json.versions | items2dict(key_name="component", value_name="version"))[legacy_component_name] | canonical_semver == (component_version | canonical_semver) + fail_msg: | + Component {{ legacy_component_name }} was expected to be installed in version {{ component_version }}. + Instead it is reported as version {{ (result.json.versions | items2dict(key_name="component", value_name="version"))[legacy_component_name] }}. - name: "Set pulp password in .netrc" copy: diff --git a/.github/workflows/scripts/before_install.sh b/.github/workflows/scripts/before_install.sh index 72492bbf13..f175b9dd61 100755 --- a/.github/workflows/scripts/before_install.sh +++ b/.github/workflows/scripts/before_install.sh @@ -34,7 +34,8 @@ else fi mkdir .ci/ansible/vars || true echo "---" > .ci/ansible/vars/main.yaml -echo "component_name: pulpcore" >> .ci/ansible/vars/main.yaml +echo "legacy_component_name: pulpcore" >> .ci/ansible/vars/main.yaml +echo "component_name: core" >> .ci/ansible/vars/main.yaml echo "component_version: '${COMPONENT_VERSION}'" >> .ci/ansible/vars/main.yaml export PRE_BEFORE_INSTALL=$PWD/.github/workflows/scripts/pre_before_install.sh diff --git a/CHANGES/8198.removal b/CHANGES/8198.removal new file mode 100644 index 0000000000..0a28a6f41f --- /dev/null +++ b/CHANGES/8198.removal @@ -0,0 +1,3 @@ +The ``component`` field of the ``versions`` section of the status API ```/pulp/api/v3/status/`` now +lists the Django app name, not the Python package name. Similarly the OpenAPI schema at +``/pulp/api/v3`` does also. diff --git a/pulpcore/app/views/status.py b/pulpcore/app/views/status.py index 24e4b7bfb3..55a74a91a3 100644 --- a/pulpcore/app/views/status.py +++ b/pulpcore/app/views/status.py @@ -5,14 +5,13 @@ from django.conf import settings from django.core.files.storage import default_storage from drf_spectacular.utils import extend_schema -from pkg_resources import get_distribution from rest_framework.response import Response from rest_framework.views import APIView +from pulpcore.app.apps import pulp_plugin_configs from pulpcore.app.models.status import ContentAppStatus from pulpcore.app.models.task import Worker from pulpcore.app.serializers.status import StatusSerializer -from pulpcore.app.settings import INSTALLED_PULP_PLUGINS from pulpcore.tasking.connection import get_redis_connection _logger = logging.getLogger(__name__) @@ -42,16 +41,22 @@ class StatusView(APIView): operation_id="status_read", responses={200: StatusSerializer}, ) - def get(self, request, format=None): + def get(self, request): """ - Returns app information including the version of pulpcore and loaded pulp plugins, - known workers, database connection status, and messaging connection status + Returns status and app information about Pulp. + + Information includes: + * version of pulpcore and loaded pulp plugins + * known workers + * known content apps + * database connection status + * redis connection status + * disk usage information """ - components = ["pulpcore"] + INSTALLED_PULP_PLUGINS - versions = [ - {"component": component, "version": get_distribution(component).version} - for component in components - ] + versions = [] + for app in pulp_plugin_configs(): + versions.append({"component": app.label, "version": app.version}) + redis_status = {"connected": self._get_redis_conn_status()} db_status = {"connected": self._get_db_conn_status()} diff --git a/pulpcore/openapi/__init__.py b/pulpcore/openapi/__init__.py index 0cfd926635..67eea40df6 100644 --- a/pulpcore/openapi/__init__.py +++ b/pulpcore/openapi/__init__.py @@ -18,11 +18,10 @@ from drf_spectacular.settings import spectacular_settings from drf_spectacular.types import OpenApiTypes from drf_spectacular.utils import OpenApiParameter -from pkg_resources import get_distribution from rest_framework import mixins, serializers from rest_framework.schemas.utils import get_pk_description -from pulpcore.app.settings import INSTALLED_PULP_PLUGINS +from pulpcore.app.apps import pulp_plugin_configs class PulpAutoSchema(AutoSchema): @@ -446,11 +445,12 @@ def get_schema(self, request=None, public=False): result["info"]["x-logo"] = { "url": "https://pulp.plan.io/attachments/download/517478/pulp_logo_word_rectangle.svg" } + # Adding plugin version config - components = ["pulpcore"] + INSTALLED_PULP_PLUGINS - result["info"]["x-pulp-app-versions"] = { - component: get_distribution(component).version for component in components - } + result["info"]["x-pulp-app-versions"] = {} + for app in pulp_plugin_configs(): + result["info"]["x-pulp-app-versions"][app.label] = app.version + # Adding current host as server (it will provide a default value for the bindings) server_url = "http://localhost:24817" if not request else request.build_absolute_uri("/") result["servers"] = [{"url": server_url}] diff --git a/template_config.yml b/template_config.yml index ebe809d52f..97d5f999a2 100644 --- a/template_config.yml +++ b/template_config.yml @@ -19,7 +19,7 @@ deploy_daily_client_to_rubygems: true deploy_to_pypi: true docker_fixtures: true docs_test: true -plugin_app_label: pulpcore +plugin_app_label: core plugin_camel: Pulpcore plugin_camel_short: Pulpcore plugin_caps: PULPCORE