diff --git a/CHANGES/9070.bugfix b/CHANGES/9070.bugfix new file mode 100644 index 0000000000..d4f8572cc0 --- /dev/null +++ b/CHANGES/9070.bugfix @@ -0,0 +1,2 @@ +Set Redis connection information in status to null unless it's used. Redis is +needed for RQ tasking or content caching. diff --git a/pulpcore/app/serializers/status.py b/pulpcore/app/serializers/status.py index 79cf4f0f22..abd48d643d 100644 --- a/pulpcore/app/serializers/status.py +++ b/pulpcore/app/serializers/status.py @@ -74,6 +74,9 @@ class StatusSerializer(serializers.Serializer): help_text=_("Database connection information") ) - redis_connection = RedisConnectionSerializer(help_text=_("Redis connection information")) + redis_connection = RedisConnectionSerializer( + required=False, + help_text=_("Redis connection information"), + ) storage = StorageSerializer(required=False, help_text=_("Storage information")) diff --git a/pulpcore/app/views/status.py b/pulpcore/app/views/status.py index 55a74a91a3..c9d035652d 100644 --- a/pulpcore/app/views/status.py +++ b/pulpcore/app/views/status.py @@ -57,7 +57,11 @@ def get(self, request): for app in pulp_plugin_configs(): versions.append({"component": app.label, "version": app.version}) - redis_status = {"connected": self._get_redis_conn_status()} + if settings.CACHE_ENABLED or not settings.USE_NEW_WORKER_TYPE: + redis_status = {"connected": self._get_redis_conn_status()} + else: + redis_status = None + db_status = {"connected": self._get_db_conn_status()} try: diff --git a/pulpcore/tests/functional/api/test_status.py b/pulpcore/tests/functional/api/test_status.py index 169d51293c..8ff15dc98f 100644 --- a/pulpcore/tests/functional/api/test_status.py +++ b/pulpcore/tests/functional/api/test_status.py @@ -1,6 +1,7 @@ """Test the status page.""" import unittest +from django.test import override_settings from jsonschema import validate from pulp_smash import api, cli, config, utils from pulp_smash.pulp3.constants import STATUS_PATH @@ -91,6 +92,7 @@ def verify_get_response(self, status): """ validate(status, self.status_response) self.assertTrue(status["database_connection"]["connected"]) + self.assertIsNotNone(status["redis_connection"]) self.assertTrue(status["redis_connection"]["connected"]) self.assertNotEqual(status["online_workers"], []) self.assertNotEqual(status["versions"], []) @@ -98,3 +100,12 @@ def verify_get_response(self, status): self.assertIsNotNone(status["storage"]) else: self.assertIsNone(status["storage"]) + + @override_settings(CACHE_ENABLED=False, USE_NEW_WORKER_TYPE=True) + def verify_get_response_without_redis(self, status): + """Verify the response to an HTTP GET call when Redis is not used. + + Verify that redis_connection is null + """ + validate(status, self.status_response) + self.assertIsNone(status["redis_connection"])