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 30, 2024
1 parent 23f758f commit d2ffded
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/v3/snapshot/v3_snapshot.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ func SaveWithVersion(ctx context.Context, lg *zap.Logger, cfg clientv3.Config, d
defer os.RemoveAll(partPath)
defer f.Close()

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

0 comments on commit d2ffded

Please sign in to comment.