From 12de3b35ef468e1cac94726d5a97642fc17f326b Mon Sep 17 00:00:00 2001 From: Matthias Dellweg Date: Mon, 24 Jun 2024 11:51:54 +0200 Subject: [PATCH] Add a sentinal value to CONTENT_ORIGIN This helps circumventing issues where plugins rely on the setting, but a command is bypassing the checks. fixes #5510 (cherry picked from commit a809c1010e641670ef05d234ac08e3f6e9a1611c) --- CHANGES/5510.bugfix | 1 + pulpcore/app/checks.py | 2 +- pulpcore/app/settings.py | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 CHANGES/5510.bugfix diff --git a/CHANGES/5510.bugfix b/CHANGES/5510.bugfix new file mode 100644 index 0000000000..947e7fd998 --- /dev/null +++ b/CHANGES/5510.bugfix @@ -0,0 +1 @@ +Fixed openapi command where plugins relied on CONTENT_ORIGIN to be set. diff --git a/pulpcore/app/checks.py b/pulpcore/app/checks.py index b5c89e21c2..0cd4a0478b 100644 --- a/pulpcore/app/checks.py +++ b/pulpcore/app/checks.py @@ -7,7 +7,7 @@ @register(deploy=True) def content_origin_check(app_configs, **kwargs): messages = [] - if not getattr(settings, "CONTENT_ORIGIN", None): + if getattr(settings, "CONTENT_ORIGIN", "UNREACHABLE") == "UNREACHABLE": messages.append( CheckError( "CONTENT_ORIGIN is a required setting but it was not configured. This may be " diff --git a/pulpcore/app/settings.py b/pulpcore/app/settings.py index 61e3329097..6ba98056e4 100644 --- a/pulpcore/app/settings.py +++ b/pulpcore/app/settings.py @@ -248,6 +248,8 @@ DRF_ACCESS_POLICY = {"reusable_conditions": ["pulpcore.app.global_access_conditions"]} +# This is a sentinal value for deploy checks, since we don't want to set a default one. +CONTENT_ORIGIN = "UNREACHABLE" CONTENT_PATH_PREFIX = "/pulp/content/" API_APP_TTL = 120 # The heartbeat is called from gunicorn notify (defaulting to 45 sec).