fix(deploy): clarify device postgres bootstrap plan
This commit is contained in:
parent
e217723784
commit
1102e25e6e
|
|
@ -8124,6 +8124,14 @@ def preflight_device_plane_postgres_bootstrap():
|
||||||
return "absent"
|
return "absent"
|
||||||
|
|
||||||
|
|
||||||
|
def device_plane_postgres_plan_selection(postgres_preflight):
|
||||||
|
if postgres_preflight is None:
|
||||||
|
return "preserved-prerequisite:not-selected"
|
||||||
|
if postgres_preflight != "absent":
|
||||||
|
die("Device Plane PostgreSQL plan preflight state is invalid")
|
||||||
|
return "bootstrap-selected:create-if-absent"
|
||||||
|
|
||||||
|
|
||||||
def component_compose_root(component):
|
def component_compose_root(component):
|
||||||
return COMPONENTS[component].get("compose_root", component_root(component))
|
return COMPONENTS[component].get("compose_root", component_root(component))
|
||||||
|
|
||||||
|
|
@ -13492,7 +13500,10 @@ def plan_artifact(artifact):
|
||||||
print(f"runtime_secret=runner-managed:{DEVICE_PLANE_POSTGRES_PASSWORD_FILE}")
|
print(f"runtime_secret=runner-managed:{DEVICE_PLANE_POSTGRES_PASSWORD_FILE}")
|
||||||
print(f"runtime_secret=runner-managed:{DEVICE_PLANE_GATEWAY_CORE_TOKEN_FILE}")
|
print(f"runtime_secret=runner-managed:{DEVICE_PLANE_GATEWAY_CORE_TOKEN_FILE}")
|
||||||
print(f"runtime_secret=runner-managed:{DEVICE_PLANE_IDENTIFIER_PEPPER_FILE}")
|
print(f"runtime_secret=runner-managed:{DEVICE_PLANE_IDENTIFIER_PEPPER_FILE}")
|
||||||
print("device_postgres=preserved-prerequisite:not-selected")
|
print(
|
||||||
|
"device_postgres="
|
||||||
|
f"{device_plane_postgres_plan_selection(device_plane_postgres_preflight)}"
|
||||||
|
)
|
||||||
print("device_postgres_volume=preserved:nodedc-device-plane-postgres-data")
|
print("device_postgres_volume=preserved:nodedc-device-plane-postgres-data")
|
||||||
print("device_gateway_public_ingress=disabled")
|
print("device_gateway_public_ingress=disabled")
|
||||||
print("device_gateway_command_transport=disabled")
|
print("device_gateway_command_transport=disabled")
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,21 @@ class DevicePlanePostgresBootstrapTest(unittest.TestCase):
|
||||||
):
|
):
|
||||||
RUNNER.preflight_device_plane_postgres_bootstrap()
|
RUNNER.preflight_device_plane_postgres_bootstrap()
|
||||||
|
|
||||||
|
def test_plan_selection_is_unambiguous_for_bootstrap_and_application(self):
|
||||||
|
self.assertEqual(
|
||||||
|
RUNNER.device_plane_postgres_plan_selection(None),
|
||||||
|
"preserved-prerequisite:not-selected",
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
RUNNER.device_plane_postgres_plan_selection("absent"),
|
||||||
|
"bootstrap-selected:create-if-absent",
|
||||||
|
)
|
||||||
|
with self.assertRaisesRegex(
|
||||||
|
RUNNER.DeployError,
|
||||||
|
"plan preflight state is invalid",
|
||||||
|
):
|
||||||
|
RUNNER.device_plane_postgres_plan_selection("unknown")
|
||||||
|
|
||||||
def test_bootstrap_health_acceptance_is_database_service_only(self):
|
def test_bootstrap_health_acceptance_is_database_service_only(self):
|
||||||
with mock.patch.object(
|
with mock.patch.object(
|
||||||
RUNNER,
|
RUNNER,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue