From aaacacbcf6b331af3733bda1824ab5e0b625518b Mon Sep 17 00:00:00 2001 From: shiny-code-bot <332303085+shiny-code-app[bot]@users.noreply.github.com> Date: Mon, 9 Nov 2026 10:18:52 -0500 Subject: [PATCH] fix: skip optional Website bootstrap on databases without Website Launchplane marks required Website intent with LAUNCHPLANE_WEBSITE_BOOTSTRAP_REQUIRED. Without it, a payload for a database that lacks the website module logs the skip and continues instead of failing the data workflow. --- docker/scripts/odoo_website_bootstrap.py | 5 ++++- docs/tooling/workspace-cli.md | 4 +++- tests/test_odoo_website_bootstrap.py | 12 ++++++++++-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docker/scripts/odoo_website_bootstrap.py b/docker/scripts/odoo_website_bootstrap.py index 162d07c..d8b13f1 100644 --- a/docker/scripts/odoo_website_bootstrap.py +++ b/docker/scripts/odoo_website_bootstrap.py @@ -431,7 +431,10 @@ def apply_website_bootstrap(env: Any, parsed_payload: dict[str, object] | None) if not website_payload: return if not website_is_loaded(env): - raise RuntimeError("Website bootstrap supplied, but the website module is not installed.") + if _env_flag_enabled(LAUNCHPLANE_WEBSITE_BOOTSTRAP_REQUIRED_ENV_KEY): + raise RuntimeError("Website bootstrap supplied, but the website module is not installed.") + print("Website bootstrap skipped: the website module is not installed.") + return canonical_url = str(website_payload.get("canonical_url") or _payload_web_base_url(parsed_payload) or "").strip() diff --git a/docs/tooling/workspace-cli.md b/docs/tooling/workspace-cli.md index 56b7af5..0efad34 100644 --- a/docs/tooling/workspace-cli.md +++ b/docs/tooling/workspace-cli.md @@ -450,7 +450,9 @@ Notes `LAUNCHPLANE_INSTANCE_OVERRIDES_REQUIRED=true` to require a valid typed override payload with managed settings before startup or data workflows continue. `LAUNCHPLANE_WEBSITE_BOOTSTRAP_REQUIRED=true` additionally requires - a non-empty `website_bootstrap` object in that payload. These flags are + a non-empty `website_bootstrap` object in that payload and fails when the + website module is not installed; without it, a payload for a database that + lacks Website logs the skip and continues. These flags are runtime assertions supplied by Launchplane-managed records or operator input; local runtimes remain optional unless a caller explicitly sets them. - Legacy setting-shaped inputs such as `ENV_OVERRIDE_CONFIG_PARAM__*`, diff --git a/tests/test_odoo_website_bootstrap.py b/tests/test_odoo_website_bootstrap.py index 6118566..9de0910 100644 --- a/tests/test_odoo_website_bootstrap.py +++ b/tests/test_odoo_website_bootstrap.py @@ -177,11 +177,19 @@ def test_pending_website_stays_loaded_but_route_modules_require_installed(self) env, {"website_bootstrap": {"homepage_url": "/shop", "routes_source": {"module": "website_sale"}}} ) - def test_base_website_without_installed_addon_refuses_bootstrap(self) -> None: + def test_required_bootstrap_refuses_when_website_is_not_installed(self) -> None: env = FakeEnv() env.modules.record = FakeRecord(truthy=False) - with self.assertRaisesRegex(RuntimeError, "website module is not installed"): + with patch.dict(os.environ, {website_bootstrap.LAUNCHPLANE_WEBSITE_BOOTSTRAP_REQUIRED_ENV_KEY: "true"}, clear=False): + with self.assertRaisesRegex(RuntimeError, "website module is not installed"): + website_bootstrap.apply_website_bootstrap(env, {"website_bootstrap": {"name": "Unsupported"}}) + + def test_optional_bootstrap_does_not_fail_a_database_without_website(self) -> None: + env = FakeEnv() + env.modules.record = FakeRecord(truthy=False) + with patch.dict(os.environ, {website_bootstrap.LAUNCHPLANE_WEBSITE_BOOTSTRAP_REQUIRED_ENV_KEY: ""}, clear=False): website_bootstrap.apply_website_bootstrap(env, {"website_bootstrap": {"name": "Unsupported"}}) + self.assertIsNone(env.website.name) def test_attachment_binary_uses_encoded_content_instead_of_proxy_text(self) -> None: class BinaryAttachment: