hecate: make etcd-restore dry-run non-fatal
This commit is contained in:
parent
522df2f6e8
commit
773e0234b8
@ -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 = "<latest-snapshot-on-" + controlPlane + ">"
|
||||
}
|
||||
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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user