mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
etcdctl: enhance the make-mirror command to return error asap with wrong command line parameters
This commit is contained in:
parent
7572a61a39
commit
8b3405bdb8
@ -130,6 +130,11 @@ func makeMirrorCommandFunc(cmd *cobra.Command, args []string) {
|
||||
func makeMirror(ctx context.Context, c *clientv3.Client, dc *clientv3.Client) error {
|
||||
total := int64(0)
|
||||
|
||||
// if destination prefix is specified and remove destination prefix is true return error
|
||||
if mmnodestprefix && len(mmdestprefix) > 0 {
|
||||
cobrautl.ExitWithError(cobrautl.ExitBadArgs, errors.New("`--dest-prefix` and `--no-dest-prefix` cannot be set at the same time, choose one"))
|
||||
}
|
||||
|
||||
go func() {
|
||||
for {
|
||||
time.Sleep(30 * time.Second)
|
||||
@ -141,11 +146,6 @@ func makeMirror(ctx context.Context, c *clientv3.Client, dc *clientv3.Client) er
|
||||
|
||||
rc, errc := s.SyncBase(ctx)
|
||||
|
||||
// if destination prefix is specified and remove destination prefix is true return error
|
||||
if mmnodestprefix && len(mmdestprefix) > 0 {
|
||||
cobrautl.ExitWithError(cobrautl.ExitBadArgs, fmt.Errorf("`--dest-prefix` and `--no-dest-prefix` cannot be set at the same time, choose one"))
|
||||
}
|
||||
|
||||
// if remove destination prefix is false and destination prefix is empty set the value of destination prefix same as prefix
|
||||
if !mmnodestprefix && len(mmdestprefix) == 0 {
|
||||
mmdestprefix = mmprefix
|
||||
|
Loading…
x
Reference in New Issue
Block a user