hosted slice 2: review fixes, unfence and controller reboot
Task 32 finding 2. ops unfence detaches deny_launches only with the proof: the run fenced, every controller host reads terminated, no image creation is unresolved and every image was settled with its repeat after the last fence; the detach is read back before UNFENCED. ops controller terminate (R.6) terminates the controller host and reads it back. ops tf services destroy-* refuses while the policy is attached or its attachment does not read. Safe-stop never unfences. The account plan's R.6 runs terminate, unfence, then the services destroy. For finding 3's restart: ops controller reboot --enabled 1|0 reboots the one controller host (refused after a fence) and waits for /v1/status to show the launch switch controller/env now holds.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
12 files changed,
+589
−23
.rastrillo/budgets.txt+1 −1docs/superpowers/plans/2026-11-30-hosted-prod-account-plan.md+10 −2internal/hostedops/cloud.go+3 −0internal/hostedops/fake_test.go+28 −1internal/hostedops/ops.go+3 −0internal/hostedops/ops_test.go+1 −0internal/hostedops/singleton.go+33 −19internal/hostedops/t32_test.go+215 −0internal/hostedops/tf.go+5 −0internal/hostedops/unfence.go+232 −0internal/isolatedjob/awsjob/opsaws/cloud.go+15 −0internal/isolatedjob/awsjob/opsaws/t32_test.go+43 −0
diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt| index 0cd00f42..155d20ae 100644 |
| --- a/.rastrillo/budgets.txt |
| +++ b/.rastrillo/budgets.txt |
| @@ -88,4 +88,4 @@ perf GET /native/preview/exchange skip Rejects GET with 404; only a same-origin, |
| # and the same bounded cardView as the snapshot; no list scan or new route. |
| perf GET /api/v1/tasks/{id}/changes/diff skip Device-only bounded display patch JSON: indexed step/attempt lookup, 64 KiB patch and 128 KiB response, no Git or network work at read time; not an HTML screen. |
| size internal/hostedctl 6079 10017 Hosted controller core plus its lifecycle simulation; split planned for slice 1b; measured 5313/8516 source/test lines after the Task 17 pre-flight review rounds (R36, R38 ref checks); slice 2 Task 2 wires the egress manifest snapshot and LaunchRequest.Validate into Launch (logic in ctlegress), and maps ErrServiceUnset to 503 service_unset; measured 5341/8729; slice 2 Task 3 replaces Config.Images with the certificate set (logic in hostedcert and ctlcert), keeps the certificate digest and launch-by time on each intent, enforces launch-by before saving and before every provider call (it gates the dispatch path, so it stays here), and adds the admission record and route; measured 5444/9119; Task 3 review round 1 returns ErrLaunchExpired to a Launch whose own intent expired during dispatch (binding certificates to provider image versions is in ctlcert); measured 5462/9279; round 2 reports the launch-by time whichever abandonment reason is given; measured 5465/9325; slice 2 Task 4 wires the proxy client CA and feed (logic in ctlproxy): the three proxy routes and their transaction (proxy.go), the proxy role, Config.ProxyCA, the BootstrapV2 launch payload with its proxy code minted at intent save, revocation on stop, proof and resume, the code window opened by the first running sighting, the silent-proxy check in the reaper pass and its metric; measured 5662/9340. Task 4 review round 1: the proxy code is derived (HMAC key in Config, stripped from the saved bootstrap, derived again at each provider call; a changed key abandons the intent), and silence alerts are delivered from the store; measured 5689/9355. Slice 2 Task 5 wires the operator routes (ops.go: certification launch, certificate list, reload, restart, alert test, status; candidates, reload and the certification attempt are in ctlops): Launch and CertLaunch share one launch path, a certification intent is gated at dispatch by its image still being a candidate, the restart hook answers 202, and the reaper keeps its last clean pass for the status; operator_test.go is the brief's; measured 5939/9749. Task 5 review round 1: the reload fetches through an injected Deps.Fetcher first (ctlops.FetchAndReload; the S3 fetcher is in the command), the status reads the audit under one lock, and operator_test.go gains a fake config bucket and the fetch, failure and snapshot tests; measured 5954/9907. Slice 2 Task 13 wires certification reports (logic in ctlcert/report.go and hostedcert): the cert-report proxy route, its transaction and the controller's own stop of the reported VM (proxy.go), the operator evidence route, the proxy header check and two error codes (http.go), the Handler's signing key kept for evidence (controller.go), the stop reason, and schema version 5; measured 6022/9907. Task 13 review round 1: the report's stop is recorded in the transaction that keeps its evidence (recordStop, split out of requestStop so both share it) and driven on a context the request's end does not cancel; measured 6037/9907. Round 2: the stop rule moves to schema version 6 (the migration list line wraps) with TestUpgradeFromVersion5 upgrading a database made at bec02feb; measured 6038/9990. Round 3: the upgrade test also starts from a116d330's version 5; measured 6038/9996. Task 21 ruling: Get and Admission answer a signed 404 absent for an attempt with no record at all (ErrAbsent), keeping the 403 for another key's attempt, and the tests that pin it; measured 6049/10016. Task 22 review 2: Admission answers the job's current deadline (DeadlineInMS, counted from the answer) so the instance caps hosted credentials by a deadline moved earlier after launch, and its assertion; measured 6050/10017. Task 29: healthz.go, the metrics listener's GET /healthz (Controller.Healthz, a store read; the command mounts it beside /metrics and the API has no such route); wiring only, the CloudWatch publisher and Litestream lag live in the command; measured 6079/10017. |
| -size internal/hostedops 6610 - Hosted slice 2 Task 33: equipo-hosted-ops, the dev drill's and production bring-up's run kit; every subcommand the account plan uses (ledger, guard, estimate, VM settlement, connector, buckets, singletons, units, block and safe stop, tf and its reconcile, tfvars, named assertions, report and bundle) shares one journal and one Ops, so it is one package; measured 5499. Task 33 fix round 1 (Astra t33-r1 F1 to F18): the wait-human watchdog unit, unit wait into safe-stop, safe-stop's own context and unit, creation identity on intents, verify-gone's declared parents, fence by identity, MFA policy evaluation, connector identity, the release AMI, litestream-install, import-block adoption, decoded trail records, usage errors and the unit probe; 6258. Fix round 2 (t33-r2 N1 to N6): the one recovery unit and its lock, cgroup membership, identity lookups that prove absence only under the recorded parent, settlement after a second fence, IAM action matching, launches bound at their intent, and adoption through a checked import plan rebuilt from durable records; 6575. After-cap fix (t33-r3): the unit wrapper keeping INVOCATION_ID, recovery only inside its unit, joining a start collision, contained types for deleted-parent inference, the group usage line; 6610. |
| +size internal/hostedops 6960 - Hosted slice 2 Task 33: equipo-hosted-ops, the dev drill's and production bring-up's run kit; every subcommand the account plan uses (ledger, guard, estimate, VM settlement, connector, buckets, singletons, units, block and safe stop, tf and its reconcile, tfvars, named assertions, report and bundle) shares one journal and one Ops, so it is one package; measured 5499. Task 33 fix round 1 (Astra t33-r1 F1 to F18): the wait-human watchdog unit, unit wait into safe-stop, safe-stop's own context and unit, creation identity on intents, verify-gone's declared parents, fence by identity, MFA policy evaluation, connector identity, the release AMI, litestream-install, import-block adoption, decoded trail records, usage errors and the unit probe; 6258. Fix round 2 (t33-r2 N1 to N6): the one recovery unit and its lock, cgroup membership, identity lookups that prove absence only under the recorded parent, settlement after a second fence, IAM action matching, launches bound at their intent, and adoption through a checked import plan rebuilt from durable records; 6575. After-cap fix (t33-r3): the unit wrapper keeping INVOCATION_ID, recovery only inside its unit, joining a start collision, contained types for deleted-parent inference, the group usage line; 6610. Task 32 fix wave (whole-branch review): the fence lifecycle (unfence.go: ops unfence with its proofs and read-back, ops controller terminate, the services destroy refused while deny_launches is attached, controllerHosts shared with fence), ops controller reboot for controller/env, PRE-RUN VPC and gateway facts from the inventory, guard -print-role and tfvars through the manifest host check; 6955. |
diff --git a/docs/superpowers/plans/2026-11-30-hosted-prod-account-plan.md b/docs/superpowers/plans/2026-11-30-hosted-prod-account-plan.md| index 61b9f5eb..95495629 100644 |
| --- a/docs/superpowers/plans/2026-11-30-hosted-prod-account-plan.md |
| +++ b/docs/superpowers/plans/2026-11-30-hosted-prod-account-plan.md |
| @@ -644,7 +644,14 @@ asks for T: |
| minutes, for a launch that was already in flight. Then `ops ledger reconcile` resolves every other |
| unresolved intent. |
| 5. Image: `img delete --arn <image ARN>` (all versions), verified absent by list. |
| -6. `ops tf services destroy-services`; `ops connector delete` (Task 17b's 10.2 logic: on |
| +6. `ops controller terminate` terminates every controller host of the run and reads each back |
| + `terminated` (journalled `HOST-TERMINATED`). Then `ops unfence`, immediately before the services |
| + stack's destroy: it refuses (99), leaving the policy attached, unless the run fenced, a direct read |
| + shows every controller host terminated, no image creation is unresolved, and every image was |
| + settled with its repeat after the last fence; then it detaches `deny_launches` from the controller |
| + role, reads it back detached and journals `UNFENCED`. IAM will not delete an attached policy, and |
| + `ops tf services destroy-services` refuses while the policy is attached or its attachment does not |
| + read (Task 32). Then `ops tf services destroy-services`; `ops connector delete` (Task 17b's 10.2 logic: on |
| `DELETE_FAILED`, one retry with the managed-operator condition dropped and the subnet condition |
| kept; interfaces left after a successful deletion are waited for within the same 120-minute budget and |
| verified gone, never deleted by hand); |
| @@ -673,7 +680,8 @@ settlement run again. S.3 R.3's VM identification. S.4 R.4's settlement, with it |
| intents' reconciliation, with `ops tf reconcile` for any root whose apply did not finish. S.5 `ops bundle` and |
| `ops report --stopped`: what exists and what it costs a day (about $1.10 with the controller host |
| stopped); the run waits for Paul. If a cloud step's own credential check fails, S does the local steps, |
| -records the failure, and waits. Nothing but VMs is deleted in S without Paul's word. |
| +records the failure, and waits. Nothing but VMs is deleted in S without Paul's word. S never unfences |
| +and never terminates the controller host: both are R.6's, with Paul's word. |
| ## 11. Spend |
diff --git a/internal/hostedops/cloud.go b/internal/hostedops/cloud.go| index d05abb13..d305e157 100644 |
| --- a/internal/hostedops/cloud.go |
| +++ b/internal/hostedops/cloud.go |
| @@ -208,10 +208,13 @@ type Cloud interface { |
| RoleTrustPolicy(ctx context.Context, role string) (string, error) |
| AttachRolePolicy(ctx context.Context, role, policyARN string) error |
| RolePolicyAttached(ctx context.Context, role, policyARN string) (bool, error) |
| + DetachRolePolicy(ctx context.Context, role, policyARN string) error // ErrNotFound when not attached |
| // EC2 hosts. |
| StopInstance(ctx context.Context, id string) error |
| InstanceState(ctx context.Context, id string) (string, error) // ErrNotFound when gone |
| + TerminateInstance(ctx context.Context, id string) error // ErrNotFound when gone |
| + RebootInstance(ctx context.Context, id string) error |
| // S3. Every call carries the expected owner. |
| HeadBucket(ctx context.Context, bucket, owner string) error // ErrNotFound; *StopError when another owner |
diff --git a/internal/hostedops/fake_test.go b/internal/hostedops/fake_test.go| index 1ebbc4c0..f7db405d 100644 |
| --- a/internal/hostedops/fake_test.go |
| +++ b/internal/hostedops/fake_test.go |
| @@ -71,6 +71,11 @@ type fakeCloud struct { |
| attachErr error |
| objects map[string][]byte // bucket/key |
| inv Inventory |
| + // attached, when set, is the role policy attachments ("ROLE POLICY"), |
| + // kept by attach and detach; nil reads every policy attached. |
| + attached map[string]bool |
| + attachedErr error // RolePolicyAttached's error, with attached set |
| + detachSticks bool // a detach that answers but leaves it attached |
| } |
| func newCloud(clock *fakeClock) *fakeCloud { |
| @@ -182,11 +187,33 @@ func (f *fakeCloud) RoleTrustPolicy(_ context.Context, role string) (string, err |
| } |
| func (f *fakeCloud) AttachRolePolicy(_ context.Context, role, p string) error { |
| f.rec("AttachRolePolicy %s %s", role, p) |
| + if f.attached != nil && f.attachErr == nil { |
| + f.attached[role+" "+p] = true |
| + } |
| return f.attachErr |
| } |
| func (f *fakeCloud) RolePolicyAttached(_ context.Context, role, p string) (bool, error) { |
| f.rec("RolePolicyAttached %s", role) |
| - return true, nil |
| + if f.attached == nil { |
| + return true, nil |
| + } |
| + return f.attached[role+" "+p], f.attachedErr |
| +} |
| +func (f *fakeCloud) DetachRolePolicy(_ context.Context, role, p string) error { |
| + f.rec("DetachRolePolicy %s %s", role, p) |
| + if f.attached != nil && !f.detachSticks { |
| + delete(f.attached, role+" "+p) |
| + } |
| + return nil |
| +} |
| +func (f *fakeCloud) TerminateInstance(_ context.Context, id string) error { |
| + f.rec("TerminateInstance %s", id) |
| + f.instState = "terminated" |
| + return nil |
| +} |
| +func (f *fakeCloud) RebootInstance(_ context.Context, id string) error { |
| + f.rec("RebootInstance %s", id) |
| + return nil |
| } |
| func (f *fakeCloud) StopInstance(_ context.Context, id string) error { |
| f.rec("StopInstance %s", id) |
diff --git a/internal/hostedops/ops.go b/internal/hostedops/ops.go| index 6488f16b..9b04fe40 100644 |
| --- a/internal/hostedops/ops.go |
| +++ b/internal/hostedops/ops.go |
| @@ -294,6 +294,9 @@ func init() { |
| "keys upload": {true, cmdKeysUpload, "--bucket B --expected-owner A --keys DIR"}, |
| "inventory": {true, cmdInventory, ""}, |
| "fence": {true, cmdFence, ""}, |
| + "unfence": {true, cmdUnfence, ""}, |
| + "controller terminate": {true, cmdControllerTerminate, ""}, |
| + "controller reboot": {true, cmdControllerReboot, "--enabled 1|0 [--max D] [controller flags]"}, |
| "cloudtrail stop-logging": {true, cmdTrailStop, ""}, |
| } |
| } |
diff --git a/internal/hostedops/ops_test.go b/internal/hostedops/ops_test.go| index dbd89632..ff9c25cc 100644 |
| --- a/internal/hostedops/ops_test.go |
| +++ b/internal/hostedops/ops_test.go |
| @@ -46,6 +46,7 @@ var awsCommands = [][]string{ |
| {"mfa-check"}, {"litestream-check", "--bucket", "b-149757027610"}, |
| {"keys", "upload", "--bucket", "b-149757027610", "--expected-owner", ProdAccount, "--keys", "/nonexistent"}, |
| {"inventory"}, {"fence"}, {"cloudtrail", "stop-logging"}, |
| + {"unfence"}, {"controller", "terminate"}, {"controller", "reboot", "--enabled", "1"}, |
| {"assert", "trail"}, {"assert", "network"}, {"assert", "budget-limit", "150"}, {"block", "x", "--", "true"}, |
| } |
diff --git a/internal/hostedops/singleton.go b/internal/hostedops/singleton.go| index 4c680331..959a7087 100644 |
| --- a/internal/hostedops/singleton.go |
| +++ b/internal/hostedops/singleton.go |
| @@ -258,8 +258,7 @@ func (o *Ops) fence() error { |
| if err != nil { |
| return err |
| } |
| - role := o.namePrefix() + "-controller" |
| - policy := "arn:aws:iam::" + o.Account + ":policy/" + o.namePrefix() + "-deny-launches" |
| + role, policy := o.denyPolicy() |
| var problems []string |
| policyKnown := false |
| for _, r := range l.Recorded("tf") { |
| @@ -290,9 +289,31 @@ func (o *Ops) fence() error { |
| return err |
| } |
| } |
| - var ids []string |
| + ids, found := o.controllerHosts(l, false, "fence", "stopping") |
| + problems = append(problems, found...) |
| + for _, id := range ids { |
| + if err := o.stopHost(id); err != nil { |
| + problems = append(problems, err.Error()) |
| + } |
| + } |
| + if len(ids) == 0 { |
| + _ = o.jw("SKIP", "fence host: no controller host recorded or found") |
| + } |
| + if len(problems) > 0 { |
| + _ = o.jw("ABORT", "fence: %s", strings.Join(problems, "; ")) |
| + return stopf("fence incomplete: %s", strings.Join(problems, "; ")) |
| + } |
| + o.out("fenced: %s on %s; controller hosts stopped: %v", policy, role, ids) |
| + return o.jw("FENCED", "%s %s %s", role, policy, strings.Join(ids, ",")) |
| +} |
| + |
| +// controllerHosts are the run's controller hosts: every recorded one not |
| +// yet gone (with all, gone ones too), and any open controller intent's |
| +// instance, found by its creation identity (a FINDING naming step and |
| +// what it does to it). problems are the intents no direct read can settle. |
| +func (o *Ops) controllerHosts(l *Ledger, all bool, step, doing string) (ids, problems []string) { |
| for _, h := range l.Hosts { |
| - if strings.HasSuffix(h.Address, "aws_instance.controller") && h.Gone.IsZero() { |
| + if strings.HasSuffix(h.Address, "aws_instance.controller") && (all || h.Gone.IsZero()) { |
| ids = append(ids, h.ID) |
| } |
| } |
| @@ -309,7 +330,7 @@ func (o *Ops) fence() error { |
| for _, id := range res.IDs { |
| if !slices.Contains(ids, id) { |
| ids = append(ids, id) |
| - _ = o.finding("fence: controller %s exists only as an open intent (%s); stopping it", id, in.Name) |
| + _ = o.finding("%s: controller %s exists only as an open intent (%s); %s it", step, id, in.Name, doing) |
| } |
| } |
| case !res.Definitive: |
| @@ -317,20 +338,13 @@ func (o *Ops) fence() error { |
| } |
| } |
| slices.Sort(ids) |
| - for _, id := range ids { |
| - if err := o.stopHost(id); err != nil { |
| - problems = append(problems, err.Error()) |
| - } |
| - } |
| - if len(ids) == 0 { |
| - _ = o.jw("SKIP", "fence host: no controller host recorded or found") |
| - } |
| - if len(problems) > 0 { |
| - _ = o.jw("ABORT", "fence: %s", strings.Join(problems, "; ")) |
| - return stopf("fence incomplete: %s", strings.Join(problems, "; ")) |
| - } |
| - o.out("fenced: %s on %s; controller hosts stopped: %v", policy, role, ids) |
| - return o.jw("FENCED", "%s %s %s", role, policy, strings.Join(ids, ",")) |
| + return ids, problems |
| +} |
| + |
| +// denyPolicy is the services stack's deny_launches policy and the role |
| +// the fence attaches it to. |
| +func (o *Ops) denyPolicy() (role, policy string) { |
| + return o.namePrefix() + "-controller", "arn:aws:iam::" + o.Account + ":policy/" + o.namePrefix() + "-deny-launches" |
| } |
| // stopHost stops one EC2 host and waits up to 10 minutes for stopped. |
diff --git a/internal/hostedops/t32_test.go b/internal/hostedops/t32_test.go| index 1b837618..a4881d36 100644 |
| --- a/internal/hostedops/t32_test.go |
| +++ b/internal/hostedops/t32_test.go |
| @@ -1,13 +1,19 @@ |
| package hostedops |
| import ( |
| + "context" |
| + "crypto/ed25519" |
| + "encoding/base64" |
| + "errors" |
| "os" |
| "path/filepath" |
| "slices" |
| "strings" |
| "testing" |
| + "time" |
| "amadan.net/oficina/equipo/internal/hostedctl/ctlegress" |
| + "amadan.net/oficina/equipo/internal/hostedwire" |
| ) |
| // Task 32 (the whole-branch review's fix wave): the run kit's fixes. |
| @@ -150,3 +156,212 @@ func TestPreRunFactsOnlyBeforeTheRun(t *testing.T) { |
| r.cloud.lookup = gatewayLookup("igw-0ours") |
| r.want(ExitStop, "tf", "reconcile", "network") |
| } |
| + |
| +// Finding 2: the launch fence's lifecycle. ops fence attaches deny_launches |
| +// to the controller role outside OpenTofu, and the services stack's destroy |
| +// cannot delete an attached policy; so the teardown fences, settles every |
| +// image, terminates the controller host (ops controller terminate), and only |
| +// then unfences (ops unfence: proof first, then the detach, read back), |
| +// immediately before destroying the services stack, which refuses while the |
| +// policy is attached. Safe-stop never unfences. |
| + |
| +const denyPolicy = "arn:aws:iam::149757027610:policy/equipo-hosted-deny-launches" |
| + |
| +// fenceRig is a run with the services stack applied (the deny policy and |
| +// the controller host recorded), one image, a services root and a fake |
| +// tofu whose destroy plan deletes the policy. |
| +func fenceRig(t *testing.T) (*rig, string) { |
| + r, fake := tfRig(t, "REC microvm-image "+image1, ctlPol, ctlVM) |
| + root := filepath.Join(r.dir, "repo", "infra", "hosted", "envs", "prod", "services") |
| + os.MkdirAll(root, 0o700) |
| + os.WriteFile(filepath.Join(root, "main.tf"), []byte("terraform {\n backend \"s3\" {}\n}\n"), 0o600) |
| + os.WriteFile(filepath.Join(fake, "plan.json"), []byte(`{"resource_changes":[{"address":"module.controller.aws_iam_policy.deny_launches","type":"aws_iam_policy","change":{"actions":["delete"],"before":{"arn":"`+denyPolicy+`"}}}]}`), 0o600) |
| + os.WriteFile(filepath.Join(fake, "state.json"), []byte(`{"values":{"root_module":{}}}`), 0o600) |
| + r.cloud.attached = map[string]bool{} |
| + r.cloud.listVMs = func(int, string) ([]VM, error) { return nil, nil } |
| + return r, fake |
| +} |
| + |
| +func (r *rig) attachedNow() bool { return r.cloud.attached["equipo-hosted-controller "+denyPolicy] } |
| + |
| +// TestFenceToDestroy: fence, then the services destroy and the unfence are |
| +// refused until the proof is in; settle, terminate, unfence, destroy. |
| +func TestFenceToDestroy(t *testing.T) { |
| + r, fake := fenceRig(t) |
| + r.want(0, "fence") |
| + if !r.attachedNow() || r.cloud.index("StopInstance i-0ctl") < 0 { |
| + t.Fatalf("fence did not attach and stop: %v", r.cloud.log()) |
| + } |
| + r.want(ExitStop, "tf", "services", "destroy-services") |
| + if strings.Contains(calls(t, fake), " plan ") { |
| + t.Fatalf("the services stack was planned for destruction with the policy attached:\n%s", calls(t, fake)) |
| + } |
| + r.want(ExitStop, "unfence") // the host is only stopped, and nothing is settled |
| + r.want(0, "vms", "settle", "--image", image1, "--terminate", "--max", "15m") |
| + r.want(ExitStop, "unfence") // settled, but the host is only stopped |
| + if !r.attachedNow() || r.cloud.count("DetachRolePolicy") != 0 || r.has("UNFENCED", "") { |
| + t.Fatalf("unfenced before the host was terminated: %v", r.cloud.log()) |
| + } |
| + r.want(0, "controller", "terminate") |
| + if r.cloud.index("TerminateInstance i-0ctl") < 0 || !r.has("HOST-TERMINATED", "i-0ctl") { |
| + t.Fatalf("the controller host was not terminated and read back: %v", r.cloud.log()) |
| + } |
| + r.want(0, "unfence") |
| + if r.attachedNow() || !r.has("UNFENCED", "equipo-hosted-controller") { |
| + t.Fatalf("unfence left the policy attached: %v", r.cloud.log()) |
| + } |
| + if d, rb := r.cloud.index("DetachRolePolicy"), strings.LastIndex(strings.Join(r.cloud.log(), "\n"), "RolePolicyAttached"); d < 0 || rb < 0 { |
| + t.Fatalf("the detach was not read back: %v", r.cloud.log()) |
| + } |
| + r.want(0, "tf", "services", "destroy-services") |
| + if !r.has("DELETED", "deny_launches") { |
| + t.Fatalf("the destroy did not delete the policy:\n%s", journalText(r)) |
| + } |
| +} |
| + |
| +// TestUnfenceNeedsSettlementAfterTheLastFence: a settlement before the last |
| +// fence proves nothing about what the fence came after (N3). |
| +func TestUnfenceNeedsSettlementAfterTheLastFence(t *testing.T) { |
| + r, _ := fenceRig(t) |
| + r.want(0, "fence") |
| + r.want(0, "vms", "settle", "--image", image1, "--terminate", "--max", "15m") |
| + r.clock.Sleep(r.ctx, time.Minute) |
| + r.want(0, "fence") |
| + r.want(0, "controller", "terminate") |
| + r.want(ExitStop, "unfence") |
| + if !r.attachedNow() || r.cloud.count("DetachRolePolicy") != 0 { |
| + t.Fatalf("unfenced on a settlement older than the fence: %v", r.cloud.log()) |
| + } |
| + r.want(0, "vms", "settle", "--image", image1, "--terminate", "--max", "15m") |
| + r.want(0, "unfence") |
| +} |
| + |
| +// TestUnfenceNeedsAFence: without a fence there is nothing to undo, and |
| +// the policy stays as it is. |
| +func TestUnfenceNeedsAFence(t *testing.T) { |
| + r, _ := fenceRig(t) |
| + r.want(0, "vms", "settle", "--image", image1, "--terminate", "--max", "15m") |
| + r.want(0, "controller", "terminate") |
| + r.want(ExitStop, "unfence") |
| + if r.cloud.count("DetachRolePolicy") != 0 { |
| + t.Fatal("unfence detached without a fence") |
| + } |
| +} |
| + |
| +// TestUnfenceNeedsKnownImages: an image whose creation is unresolved |
| +// cannot be proved settled, so the unfence is refused. |
| +func TestUnfenceNeedsKnownImages(t *testing.T) { |
| + r, _ := fenceRig(t) |
| + r.want(0, "fence") |
| + r.want(0, "vms", "settle", "--image", image1, "--terminate", "--max", "15m") |
| + r.want(0, "controller", "terminate") |
| + r.journal("INTENT microvm-image equipo-hosted-prod-r1-b tok") |
| + r.want(ExitStop, "unfence") |
| + if r.cloud.count("DetachRolePolicy") != 0 { |
| + t.Fatal("unfenced with an image creation unresolved") |
| + } |
| +} |
| + |
| +// TestUnfenceReadsBack: a detach that answers but leaves the policy |
| +// attached is not an unfence, and the destroy stays refused. |
| +func TestUnfenceReadsBack(t *testing.T) { |
| + r, fake := fenceRig(t) |
| + r.want(0, "fence") |
| + r.want(0, "vms", "settle", "--image", image1, "--terminate", "--max", "15m") |
| + r.want(0, "controller", "terminate") |
| + r.cloud.detachSticks = true |
| + r.want(ExitStop, "unfence") |
| + if r.has("UNFENCED", "") { |
| + t.Fatal("an unfence that did not read back detached was journalled") |
| + } |
| + r.want(ExitStop, "tf", "services", "destroy-services") |
| + if strings.Contains(calls(t, fake), " plan ") { |
| + t.Fatal("planned with the policy still attached") |
| + } |
| +} |
| + |
| +// TestDestroyServicesRefusesUnreadAttachment: when the attachment cannot |
| +// be read, the services destroy is refused too. |
| +func TestDestroyServicesRefusesUnreadAttachment(t *testing.T) { |
| + r, fake := fenceRig(t) |
| + r.cloud.attachedErr = errors.New("AccessDenied") |
| + r.want(ExitStop, "tf", "services", "destroy-services") |
| + if strings.Contains(calls(t, fake), " plan ") { |
| + t.Fatal("planned with the attachment unread") |
| + } |
| +} |
| + |
| +// TestSafeStopNeverUnfences: a safe stop after a full settlement and a |
| +// terminated host still never detaches the policy. |
| +func TestSafeStopNeverUnfences(t *testing.T) { |
| + r, _ := fenceRig(t) |
| + r.journal("NOTE instance-app equipo", "NOTE instance-account acme") |
| + r.deps.Carlos = "/bin/true" |
| + r.cloud.instState = "terminated" |
| + r.want(0, "safe-stop") |
| + if r.cloud.count("DetachRolePolicy") != 0 || !r.attachedNow() { |
| + t.Fatalf("safe-stop unfenced: %v", r.cloud.log()) |
| + } |
| +} |
| + |
| +// Finding 3 (the restart 6.1 needs): controller/env is read only when the |
| +// unit starts, so ops controller reboot reboots the one controller host |
| +// and waits for GET /v1/status to answer with launches as controller/env |
| +// now says. A fenced run is refused. |
| + |
| +// statusCtl answers Status from a list (an error entry is an outage); |
| +// the last answer repeats. |
| +type statusCtl struct { |
| + answers []any |
| + n int |
| +} |
| + |
| +func (c *statusCtl) Status(context.Context) (hostedwire.StatusResponse, error) { |
| + a := c.answers[min(c.n, len(c.answers)-1)] |
| + c.n++ |
| + if err, ok := a.(error); ok { |
| + return hostedwire.StatusResponse{}, err |
| + } |
| + return a.(hostedwire.StatusResponse), nil |
| +} |
| +func (c *statusCtl) VMs(context.Context) (hostedwire.VMListResponse, error) { |
| + return hostedwire.VMListResponse{}, errors.New("not in this test") |
| +} |
| +func (c *statusCtl) Certs(context.Context) (hostedwire.CertsResponse, error) { |
| + return hostedwire.CertsResponse{}, errors.New("not in this test") |
| +} |
| + |
| +// rebootRig is a run with its controller host recorded, the operator and |
| +// controller keys on disk and the controller answering from answers. |
| +func rebootRig(t *testing.T, answers ...any) (*rig, *statusCtl) { |
| + r := newRig(t, ctlVM, "REC controller-pin "+strings.Repeat("a", 64)) |
| + pub, key, _ := ed25519.GenerateKey(nil) |
| + os.MkdirAll(filepath.Join(r.dir, "keys"), 0o700) |
| + os.WriteFile(filepath.Join(r.dir, "keys", "operator.key"), []byte(base64.StdEncoding.EncodeToString(key.Seed())), 0o600) |
| + os.WriteFile(filepath.Join(r.dir, "keys", "controller.pub"), []byte(base64.StdEncoding.EncodeToString(pub)), 0o600) |
| + ctl := &statusCtl{answers: answers} |
| + r.deps.Controller = func(ControllerArgs) (ControllerClient, error) { return ctl, nil } |
| + return r, ctl |
| +} |
| + |
| +func TestControllerReboot(t *testing.T) { |
| + on, off := hostedwire.StatusResponse{Enabled: true}, hostedwire.StatusResponse{Enabled: false} |
| + r, ctl := rebootRig(t, off, errors.New("connection refused"), on) |
| + r.want(0, "controller", "reboot", "--enabled", "1", "--controller", "https://198.51.100.7") |
| + if r.cloud.index("RebootInstance i-0ctl") < 0 || !r.has("REBOOT", "i-0ctl enabled=1") || !r.has("REBOOTED", "i-0ctl enabled=true") || ctl.n != 3 { |
| + t.Fatalf("reboot: calls %v, %d status reads:\n%s", r.cloud.log(), ctl.n, journalText(r)) |
| + } |
| + r, _ = rebootRig(t, off) |
| + r.want(ExitStop, "controller", "reboot", "--enabled", "1", "--controller", "https://198.51.100.7", "--max", "2m") |
| + if r.has("REBOOTED", "") { |
| + t.Fatal("a controller that never answered enabled was journalled rebooted") |
| + } |
| + r, _ = rebootRig(t, on) |
| + r.journal("FENCED equipo-hosted-controller " + denyPolicy + " i-0ctl") |
| + r.want(ExitStop, "controller", "reboot", "--enabled", "1", "--controller", "https://198.51.100.7") |
| + if r.cloud.count("RebootInstance") != 0 { |
| + t.Fatal("a fenced controller was rebooted") |
| + } |
| + r, _ = rebootRig(t, on) |
| + r.want(ExitFail, "controller", "reboot", "--controller", "https://198.51.100.7") |
| +} |
diff --git a/internal/hostedops/tf.go b/internal/hostedops/tf.go| index 4904d2ba..bdc2e3ce 100644 |
| --- a/internal/hostedops/tf.go |
| +++ b/internal/hostedops/tf.go |
| @@ -240,6 +240,11 @@ func cmdTf(o *Ops, args []string) error { |
| _ = o.jw("UNRESOLVED-TEARDOWN", "%s: %s", phase, strings.Join(b, " ")) |
| return stopf("%s: unresolved intents block it: %s", phase, strings.Join(b, " ")) |
| } |
| + if root == "services" { // the stack holding deny_launches (Task 32) |
| + if err := o.refuseWhileFenced(phase); err != nil { |
| + return err |
| + } |
| + } |
| } |
| vars := o.tfvarsFile() |
| if _, err := os.Stat(vars); err != nil { |
diff --git a/internal/hostedops/unfence.go b/internal/hostedops/unfence.go| new file mode 100644 |
| index 00000000..13cac702 |
| --- /dev/null |
| +++ b/internal/hostedops/unfence.go |
| @@ -0,0 +1,232 @@ |
| +package hostedops |
| + |
| +import ( |
| + "errors" |
| + "flag" |
| + "fmt" |
| + "strings" |
| + "time" |
| +) |
| + |
| +// The launch fence's end (whole-branch review finding 2, Task 32). ops |
| +// fence attaches deny_launches to the controller role outside OpenTofu; |
| +// IAM will not delete an attached policy, so the services stack's destroy |
| +// would stop there. R.6 therefore terminates the controller host (ops |
| +// controller terminate), then ops unfence detaches the policy, only with |
| +// the proof that nothing can launch any more, immediately before ops tf |
| +// services destroy-services, which refuses while the policy is attached. |
| +// Safe-stop never unfences. |
| + |
| +// hostWait bounds a controller host's termination or a reboot's return. |
| +const hostWait = 10 * time.Minute |
| + |
| +// cmdUnfence detaches deny_launches from the controller role. It refuses |
| +// (99), detaching nothing, unless the run fenced, every controller host |
| +// reads terminated (a direct read, journalled HOST-TERMINATED), no image |
| +// creation is unresolved, and every image of the run was settled with its |
| +// repeat (vms settle --terminate) after the last fence. The detach is read |
| +// back before UNFENCED is journalled. |
| +func cmdUnfence(o *Ops, args []string) error { |
| + if len(args) != 0 { |
| + return usagef("unfence takes no arguments") |
| + } |
| + l, err := o.ledger() |
| + if err != nil { |
| + return err |
| + } |
| + var fenced time.Time |
| + for _, e := range l.Entries { |
| + if e.Verb == "FENCED" { |
| + fenced = e.At |
| + } |
| + } |
| + var problems []string |
| + if fenced.IsZero() { |
| + problems = append(problems, "the run never fenced (R.2 first)") |
| + } |
| + ids, found := o.controllerHosts(l, true, "unfence", "reading") |
| + problems = append(problems, found...) |
| + for _, id := range ids { |
| + st, err := o.cloud.InstanceState(o.ctx, id) |
| + switch { |
| + case errors.Is(err, ErrNotFound) || err == nil && st == "terminated": |
| + if err := o.jw("HOST-TERMINATED", "%s read", id); err != nil { |
| + return err |
| + } |
| + case err != nil: |
| + problems = append(problems, fmt.Sprintf("the controller host %s did not read: %v", id, err)) |
| + default: |
| + problems = append(problems, fmt.Sprintf("the controller host %s is %s, not terminated (ops controller terminate)", id, st)) |
| + } |
| + } |
| + for _, in := range l.Open("microvm-image") { |
| + problems = append(problems, fmt.Sprintf("the image creation %s is unresolved", in.Name)) |
| + } |
| + for _, r := range l.Recorded("microvm-image") { |
| + if !settledAfter(l, r.Value, fenced) { |
| + problems = append(problems, fmt.Sprintf("image %s has no settlement with its repeat after the last fence", r.Value)) |
| + } |
| + } |
| + if len(problems) > 0 { |
| + _ = o.jw("ABORT", "unfence: %s", strings.Join(problems, "; ")) |
| + return stopf("unfence refused, the policy stays attached: %s", strings.Join(problems, "; ")) |
| + } |
| + role, policy := o.denyPolicy() |
| + if err := o.cloud.DetachRolePolicy(o.ctx, role, policy); err != nil && !errors.Is(err, ErrNotFound) { |
| + _ = o.jw("ABORT", "unfence: detaching %s from %s failed: %v", policy, role, err) |
| + return stopf("detaching %s from %s failed: %v", policy, role, err) |
| + } |
| + if on, err := o.policyAttached(role, policy); err != nil || on { |
| + _ = o.jw("ABORT", "unfence: %s does not read back detached from %s (%v)", policy, role, err) |
| + return stopf("%s does not read back detached from %s (attached %t, %v)", policy, role, on, err) |
| + } |
| + o.out("unfenced: %s detached from %s", policy, role) |
| + return o.jw("UNFENCED", "%s %s", role, policy) |
| +} |
| + |
| +// settledAfter reports whether image has a settlement with its repeat |
| +// (SETTLED IMAGE repeat=done) journalled after since. |
| +func settledAfter(l *Ledger, image string, since time.Time) bool { |
| + for _, e := range l.Entries { |
| + if e.Verb == "SETTLED" && e.Field(0) == image && e.Attr("repeat") == "done" && e.At.After(since) { |
| + return true |
| + } |
| + } |
| + return false |
| +} |
| + |
| +// policyAttached reads whether policy is attached to role; a role that is |
| +// gone holds no policy. |
| +func (o *Ops) policyAttached(role, policy string) (bool, error) { |
| + on, err := o.cloud.RolePolicyAttached(o.ctx, role, policy) |
| + if errors.Is(err, ErrNotFound) { |
| + return false, nil |
| + } |
| + return on, err |
| +} |
| + |
| +// refuseWhileFenced is the services destroy's check: while deny_launches |
| +// is attached to the controller role, or the attachment cannot be read, |
| +// the destroy would stop at the policy, so it is refused before any plan. |
| +func (o *Ops) refuseWhileFenced(phase string) error { |
| + role, policy := o.denyPolicy() |
| + on, err := o.policyAttached(role, policy) |
| + if err == nil && !on { |
| + return nil |
| + } |
| + _ = o.jw("ABORT", "%s: %s attached to %s (%t, %v); ops unfence first", phase, policy, role, on, err) |
| + return stopf("%s refused: %s is attached to %s, or the attachment does not read (%t, %v); ops unfence first", phase, policy, role, on, err) |
| +} |
| + |
| +// cmdControllerTerminate is R.6's first step: every controller host of the |
| +// run is terminated and read back terminated, each journalled. Only the |
| +// teardown runs it (Paul's word); safe-stop only stops the host. |
| +func cmdControllerTerminate(o *Ops, args []string) error { |
| + if len(args) != 0 { |
| + return usagef("controller terminate takes no arguments") |
| + } |
| + l, err := o.ledger() |
| + if err != nil { |
| + return err |
| + } |
| + ids, problems := o.controllerHosts(l, false, "controller terminate", "terminating") |
| + for _, id := range ids { |
| + if err := o.terminateHost(id); err != nil { |
| + problems = append(problems, err.Error()) |
| + } |
| + } |
| + if len(problems) > 0 { |
| + _ = o.jw("ABORT", "controller terminate: %s", strings.Join(problems, "; ")) |
| + return stopf("controller terminate incomplete: %s", strings.Join(problems, "; ")) |
| + } |
| + o.out("controller hosts terminated: %v", ids) |
| + return nil |
| +} |
| + |
| +// terminateHost terminates one host and waits up to hostWait for a direct |
| +// read to show it terminated (or gone). |
| +func (o *Ops) terminateHost(id string) error { |
| + if err := o.jw("TERMINATE-HOST", "%s", id); err != nil { |
| + return err |
| + } |
| + if err := o.cloud.TerminateInstance(o.ctx, id); err != nil && !errors.Is(err, ErrNotFound) { |
| + return fmt.Errorf("terminating %s failed: %v", id, err) |
| + } |
| + end := o.Clock.Now().Add(hostWait) |
| + for { |
| + st, err := o.cloud.InstanceState(o.ctx, id) |
| + if errors.Is(err, ErrNotFound) || err == nil && st == "terminated" { |
| + if err := o.jw("HOST-TERMINATED", "%s read", id); err != nil { |
| + return err |
| + } |
| + return o.jw("DELETED", "host %s terminated", id) |
| + } |
| + if !o.Clock.Now().Add(15 * time.Second).Before(end) { |
| + return fmt.Errorf("the controller host %s is not terminated (%s, %v)", id, st, err) |
| + } |
| + if err := o.Clock.Sleep(o.ctx, 15*time.Second); err != nil { |
| + return fmt.Errorf("interrupted: %v", err) |
| + } |
| + } |
| +} |
| + |
| +// cmdControllerReboot is how 6.1 applies controller/env: the unit reads it |
| +// only at start (fetch-config.sh in ExecStartPre), and POST |
| +// /v1/admin/reload re-fetches only the certificate, certification-image |
| +// and operator objects. It reboots the run's one controller host (the |
| +// unit is enabled, so it starts at boot and fetches every controller/ |
| +// object again; the TLS key stays on the host, so the pin does not |
| +// change), then reads GET /v1/status through the pin until the controller |
| +// answers with launches as --enabled says, within --max. A fenced run is |
| +// refused: its controller stays stopped. |
| +func cmdControllerReboot(o *Ops, args []string) error { |
| + fs := flag.NewFlagSet("controller reboot", flag.ContinueOnError) |
| + enabled := fs.String("enabled", "", "1 or 0: the launch switch controller/env now holds") |
| + maxD := fs.Duration("max", hostWait, "the bound for the controller to answer again") |
| + ca := controllerFlags(fs) |
| + if pos, err := parseFlags(fs, args); err != nil || len(pos) != 0 || (*enabled != "1" && *enabled != "0") { |
| + return usagef("controller reboot --enabled 1|0 [--max D] [--controller URL --pin HEX --operator-key FILE]") |
| + } |
| + if *maxD <= 0 || *maxD > 30*time.Minute { |
| + return failf("--max must be positive and at most 30m") |
| + } |
| + l, err := o.ledger() |
| + if err != nil { |
| + return err |
| + } |
| + for _, e := range l.Entries { |
| + if e.Verb == "FENCED" { |
| + return stopf("the run fenced its controller; a fenced controller is never restarted") |
| + } |
| + } |
| + ids, problems := o.controllerHosts(l, false, "controller reboot", "rebooting") |
| + if len(problems) > 0 || len(ids) != 1 { |
| + return stopf("controller reboot needs exactly one controller host, settled: %v %s", ids, strings.Join(problems, "; ")) |
| + } |
| + cl, err := o.controller(ca) |
| + if err != nil { |
| + return err |
| + } |
| + if err := o.jw("REBOOT", "%s enabled=%s", ids[0], *enabled); err != nil { |
| + return err |
| + } |
| + if err := o.cloud.RebootInstance(o.ctx, ids[0]); err != nil { |
| + return stopf("rebooting %s failed: %v", ids[0], err) |
| + } |
| + want := *enabled == "1" |
| + end := o.Clock.Now().Add(*maxD) |
| + for { |
| + st, err := cl.Status(o.ctx) |
| + if err == nil && st.Enabled == want { |
| + o.out("controller %s answers again, launches enabled %t", ids[0], st.Enabled) |
| + return o.jw("REBOOTED", "%s enabled=%t", ids[0], st.Enabled) |
| + } |
| + if !o.Clock.Now().Add(15 * time.Second).Before(end) { |
| + _ = o.jw("ABORT", "controller reboot: %s did not answer with enabled %t within %s (%v)", ids[0], want, *maxD, err) |
| + return stopf("the controller did not answer with launches enabled %t within %s after its reboot (%v)", want, *maxD, err) |
| + } |
| + if err := o.Clock.Sleep(o.ctx, 15*time.Second); err != nil { |
| + return stopf("interrupted: %v", err) |
| + } |
| + } |
| +} |
diff --git a/internal/isolatedjob/awsjob/opsaws/cloud.go b/internal/isolatedjob/awsjob/opsaws/cloud.go| index 87f4e93f..6176996c 100644 |
| --- a/internal/isolatedjob/awsjob/opsaws/cloud.go |
| +++ b/internal/isolatedjob/awsjob/opsaws/cloud.go |
| @@ -229,8 +229,23 @@ func (c *cloud) RolePolicyAttached(ctx context.Context, role, policy string) (bo |
| return false, nil |
| } |
| +func (c *cloud) DetachRolePolicy(ctx context.Context, role, policy string) error { |
| + _, err := c.cl.iam.DetachRolePolicy(ctx, &iam.DetachRolePolicyInput{RoleName: aws.String(role), PolicyArn: aws.String(policy)}) |
| + return wrap("DetachRolePolicy", err) |
| +} |
| + |
| // ---- EC2 hosts -------------------------------------------------------- |
| +func (c *cloud) TerminateInstance(ctx context.Context, id string) error { |
| + _, err := c.cl.ec2.TerminateInstances(ctx, &ec2.TerminateInstancesInput{InstanceIds: []string{id}}) |
| + return wrap("TerminateInstances", err) |
| +} |
| + |
| +func (c *cloud) RebootInstance(ctx context.Context, id string) error { |
| + _, err := c.cl.ec2.RebootInstances(ctx, &ec2.RebootInstancesInput{InstanceIds: []string{id}}) |
| + return wrap("RebootInstances", err) |
| +} |
| + |
| func (c *cloud) StopInstance(ctx context.Context, id string) error { |
| _, err := c.cl.ec2.StopInstances(ctx, &ec2.StopInstancesInput{InstanceIds: []string{id}}) |
| return wrap("StopInstances", err) |
diff --git a/internal/isolatedjob/awsjob/opsaws/t32_test.go b/internal/isolatedjob/awsjob/opsaws/t32_test.go| index b9de604d..2a964894 100644 |
| --- a/internal/isolatedjob/awsjob/opsaws/t32_test.go |
| +++ b/internal/isolatedjob/awsjob/opsaws/t32_test.go |
| @@ -2,10 +2,12 @@ package opsaws |
| import ( |
| "context" |
| + "errors" |
| "fmt" |
| "slices" |
| "testing" |
| + "amadan.net/oficina/equipo/internal/hostedops" |
| "github.com/aws/aws-sdk-go-v2/aws" |
| "github.com/aws/aws-sdk-go-v2/service/budgets" |
| "github.com/aws/aws-sdk-go-v2/service/cloudtrail" |
| @@ -73,3 +75,44 @@ func TestInventoryListsVPCsAndGateways(t *testing.T) { |
| t.Fatalf("gateways %v, want both over two pages, attached or not", inv.Gateways) |
| } |
| } |
| + |
| +// Findings 2 and 3: the detach, the controller host's termination and its |
| +// reboot, as the APIs receive them; a policy that is not attached reads |
| +// as not found. |
| +func TestDetachTerminateRebootShapes(t *testing.T) { |
| + var got []string |
| + cl, _ := openFake(t, func(c call) (any, error) { |
| + switch in := c.In.(type) { |
| + case *iam.DetachRolePolicyInput: |
| + got = append(got, "detach "+aws.ToString(in.RoleName)+" "+aws.ToString(in.PolicyArn)) |
| + if aws.ToString(in.RoleName) == "gone" { |
| + return nil, &smithy.GenericAPIError{Code: "NoSuchEntity"} |
| + } |
| + return &iam.DetachRolePolicyOutput{}, nil |
| + case *ec2.TerminateInstancesInput: |
| + got = append(got, fmt.Sprintf("terminate %v", in.InstanceIds)) |
| + return &ec2.TerminateInstancesOutput{}, nil |
| + case *ec2.RebootInstancesInput: |
| + got = append(got, fmt.Sprintf("reboot %v", in.InstanceIds)) |
| + return &ec2.RebootInstancesOutput{}, nil |
| + } |
| + return nil, fmt.Errorf("unexpected %s", c.Op) |
| + }) |
| + ctx := context.Background() |
| + if err := cl.DetachRolePolicy(ctx, "equipo-hosted-controller", "arn:deny"); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := cl.DetachRolePolicy(ctx, "gone", "arn:deny"); !errors.Is(err, hostedops.ErrNotFound) { |
| + t.Fatalf("detach from a missing role = %v, want not found", err) |
| + } |
| + if err := cl.TerminateInstance(ctx, "i-0ctl"); err != nil { |
| + t.Fatal(err) |
| + } |
| + if err := cl.RebootInstance(ctx, "i-0ctl"); err != nil { |
| + t.Fatal(err) |
| + } |
| + want := []string{"detach equipo-hosted-controller arn:deny", "detach gone arn:deny", "terminate [i-0ctl]", "reboot [i-0ctl]"} |
| + if !slices.Equal(got, want) { |
| + t.Fatalf("calls %q, want %q", got, want) |
| + } |
| +} |