From 773e0234b8fb61c0e0922a451c04d69fdb821f56 Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Sat, 4 Apr 2026 20:57:54 -0300 Subject: [PATCH] hecate: make etcd-restore dry-run non-fatal --- internal/cluster/orchestrator.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/internal/cluster/orchestrator.go b/internal/cluster/orchestrator.go index 6f18e4b..f51fb8c 100644 --- a/internal/cluster/orchestrator.go +++ b/internal/cluster/orchestrator.go @@ -248,6 +248,14 @@ func (o *Orchestrator) EtcdRestore(ctx context.Context, opts EtcdRestoreOptions) if !o.sshManaged(controlPlane) { return fmt.Errorf("cannot restore etcd on %s: node not in ssh_managed_nodes", controlPlane) } + snapshotPath := strings.TrimSpace(opts.SnapshotPath) + if o.runner.DryRun { + if snapshotPath == "" { + snapshotPath = "" + } + o.log.Printf("etcd restore target=%s snapshot=%s (dry-run; datastore-mode and snapshot checks skipped)", controlPlane, snapshotPath) + return nil + } externalDatastore, err := o.controlPlaneUsesExternalDatastore(ctx, controlPlane) if err != nil { return err @@ -256,7 +264,6 @@ func (o *Orchestrator) EtcdRestore(ctx context.Context, opts EtcdRestoreOptions) return fmt.Errorf("%w: %s uses --datastore-endpoint", ErrEtcdRestoreNotApplicable, controlPlane) } - snapshotPath := strings.TrimSpace(opts.SnapshotPath) if snapshotPath == "" { resolved, err := o.latestEtcdSnapshotPath(ctx, controlPlane) if err != nil { @@ -265,9 +272,6 @@ func (o *Orchestrator) EtcdRestore(ctx context.Context, opts EtcdRestoreOptions) snapshotPath = resolved } o.log.Printf("etcd restore target=%s snapshot=%s", controlPlane, snapshotPath) - if o.runner.DryRun { - return nil - } for _, cp := range o.cfg.ControlPlanes { cp := cp