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