PRD: reprovision on gateway startup - bottle ca (chunk 1/5) #519

Open
didericis-claude wants to merge 14 commits from prd-0081-reconcile-1-ca into main
2 changed files with 13 additions and 0 deletions
Showing only changes of commit e49f9a4e53 - Show all commits
@@ -89,6 +89,11 @@ def running_agent_containers(
"docker", "network", "inspect", "--format",
"{{range .Containers}}{{.Name}}\n{{end}}", network,
])
if proc.returncode != 0:
Review

Fixed in e49f9a4: nonzero docker network inspect now raises InfraLaunchError with stderr (or the exit code), and the regression test covers a completed process returning failure.

Fixed in `e49f9a4`: nonzero `docker network inspect` now raises `InfraLaunchError` with stderr (or the exit code), and the regression test covers a completed process returning failure.
detail = proc.stderr.strip() or f"exit {proc.returncode}"
raise InfraLaunchError(
f"could not enumerate bottles on gateway network {network}: {detail}"
)
return [
name for name in (line.strip() for line in proc.stdout.splitlines())
if name and name != gateway_name
@@ -262,6 +262,14 @@ class TestDockerAttachPrimitives(unittest.TestCase):
with self.assertRaises(FileNotFoundError):
docker.running_agent_containers()
def test_running_agent_containers_fails_hard_on_inspect_failure(self) -> None:
inspect = _proc(1, stderr="network unavailable")
with patch.object(docker, "run_docker", return_value=inspect):
with self.assertRaisesRegex(
docker.InfraLaunchError, "network unavailable",
):
docker.running_agent_containers(network="net")
def test_push_ca_cp_then_rebuilds_trust_store(self) -> None:
with patch.object(
docker, "run_docker", side_effect=[_proc(), _proc(), _proc()],