mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl: add etcdctl snapshot pipe command
To improve the security of etcdctl. Added the ability to write snapshots to stdout without writing data to disk. Signed-off-by: Ais8Ooz8 <47941654+Ais8Ooz8@users.noreply.github.com>
This commit is contained in:
parent
23f758fb59
commit
d2ffdeda9c
@ -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)
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user