Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docker/scripts/odoo_website_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
4 changes: 3 additions & 1 deletion docs/tooling/workspace-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -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__*`,
Expand Down
12 changes: 10 additions & 2 deletions tests/test_odoo_website_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading