Skip to content

Commit

Permalink
etcdctl: add etcdctl snapshot pipe command
Browse files Browse the repository at this point in the history
To improve the security of etcdctl. Added the ability to write snapshots to stdout without writing data to disk.

Signed-off-by: Ais8Ooz8 <[email protected]>
  • Loading branch information
Ais8Ooz8 authored Mar 29, 2024
1 parent a5389fc commit 23f758f
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions client/v3/snapshot/v3_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,12 @@ func SaveWithVersion(ctx context.Context, lg *zap.Logger, cfg clientv3.Config, d
defer os.RemoveAll(partPath)
defer f.Close()

var version string
version, err = WriteSnapshotWithVersion(ctx, lg, cfg, f)
version, _ := WriteSnapshotWithVersion(ctx, lg, cfg, f)
if err = os.Rename(partPath, dbPath); err != nil {
return version, fmt.Errorf("could not rename %s to %s (%v)", partPath, dbPath, err)
}
lg.Info("saved", zap.String("path", dbPath))
return version, err
return version, nil
}

func PipeWithVersion(ctx context.Context, lg *zap.Logger, cfg clientv3.Config) (string, error) {
Expand Down

0 comments on commit 23f758f

Please sign in to comment.