aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_volume_fix_replication.go
diff options
context:
space:
mode:
authorhilimd <68371223+hilimd@users.noreply.github.com>2020-09-22 09:33:25 +0800
committerGitHub <noreply@github.com>2020-09-22 09:33:25 +0800
commit082500151a85f4d59a9f779174bcb3043b723272 (patch)
treef423c694d8f6af15d59ab1c4401d3e80fac876c3 /weed/shell/command_volume_fix_replication.go
parentf71f7fcf99ba6d64bfa49fd7411e06bdc2b9d591 (diff)
parent9cdbfc1a4987bdb46f16ae37624ed69ef66778a9 (diff)
downloadseaweedfs-082500151a85f4d59a9f779174bcb3043b723272.tar.xz
seaweedfs-082500151a85f4d59a9f779174bcb3043b723272.zip
Merge pull request #16 from chrislusf/master
sync
Diffstat (limited to 'weed/shell/command_volume_fix_replication.go')
-rw-r--r--weed/shell/command_volume_fix_replication.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/weed/shell/command_volume_fix_replication.go b/weed/shell/command_volume_fix_replication.go
index b32ccaaab..471b24a2a 100644
--- a/weed/shell/command_volume_fix_replication.go
+++ b/weed/shell/command_volume_fix_replication.go
@@ -2,6 +2,7 @@ package shell
import (
"context"
+ "flag"
"fmt"
"github.com/chrislusf/seaweedfs/weed/storage/needle"
"io"
@@ -50,11 +51,14 @@ func (c *commandVolumeFixReplication) Do(args []string, commandEnv *CommandEnv,
return
}
- takeAction := true
- if len(args) > 0 && args[0] == "-n" {
- takeAction = false
+ volFixReplicationCommand := flag.NewFlagSet(c.Name(), flag.ContinueOnError)
+ skipChange := volFixReplicationCommand.Bool("n", false, "skip the changes")
+ if err = volFixReplicationCommand.Parse(args); err != nil {
+ return nil
}
+ takeAction := !*skipChange
+
var resp *master_pb.VolumeListResponse
err = commandEnv.MasterClient.WithClient(func(client master_pb.SeaweedClient) error {
resp, err = client.VolumeList(context.Background(), &master_pb.VolumeListRequest{})