mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
chore(cli): cli output with format
Signed-off-by: slasher <shenjie1@oppo.com>
This commit is contained in:
parent
7f406e5d0e
commit
74be4e4970
@ -51,9 +51,7 @@ func newAclAddCmd(client *master.MasterClient) *cobra.Command {
|
||||
}
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var aclInfo *proto.AclRsp
|
||||
if aclInfo, err = client.UserAPI().AclOperation(args[0], args[1], util.AclAddIP); err != nil || !aclInfo.OK {
|
||||
@ -80,9 +78,7 @@ func newAclListCmd(client *master.MasterClient) *cobra.Command {
|
||||
volumeName := args[0]
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var aclInfo *proto.AclRsp
|
||||
if aclInfo, err = client.UserAPI().AclOperation(volumeName, "", util.AclListIP); err != nil || !aclInfo.OK {
|
||||
@ -113,9 +109,7 @@ func newAclDelCmd(client *master.MasterClient) *cobra.Command {
|
||||
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var aclInfo *proto.AclRsp
|
||||
if aclInfo, err = client.UserAPI().AclOperation(args[0], args[1], util.AclDelIP); err != nil || !aclInfo.OK {
|
||||
@ -142,9 +136,7 @@ func newAclCheckCmd(client *master.MasterClient) *cobra.Command {
|
||||
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var aclInfo *proto.AclRsp
|
||||
if aclInfo, err = client.UserAPI().AclOperation(args[0], args[1], util.AclCheckIP); err != nil || !aclInfo.OK {
|
||||
|
||||
@ -69,18 +69,18 @@ func newClusterInfoCmd(client *master.MasterClient) *cobra.Command {
|
||||
var cp *proto.ClusterIP
|
||||
var clusterPara map[string]string
|
||||
if cv, err = client.AdminAPI().GetCluster(); err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
errout(err)
|
||||
}
|
||||
if cn, err = client.AdminAPI().GetClusterNodeInfo(); err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
errout(err)
|
||||
}
|
||||
if cp, err = client.AdminAPI().GetClusterIP(); err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
errout(err)
|
||||
}
|
||||
stdout("[Cluster]\n")
|
||||
stdout("%v", formatClusterView(cv, cn, cp))
|
||||
if clusterPara, err = client.AdminAPI().GetClusterParas(); err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
errout(err)
|
||||
}
|
||||
|
||||
stdout(fmt.Sprintf(" BatchCount : %v\n", clusterPara[nodeDeleteBatchCountKey]))
|
||||
@ -105,7 +105,7 @@ func newClusterStatCmd(client *master.MasterClient) *cobra.Command {
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
errout(err)
|
||||
}
|
||||
}()
|
||||
if cs, err = client.AdminAPI().GetClusterStat(); err != nil {
|
||||
@ -139,9 +139,7 @@ If 'freeze=true', CubeFS WILL NOT automatically allocate new data partitions `,
|
||||
enable bool
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if enable, err = strconv.ParseBool(args[0]); err != nil {
|
||||
err = fmt.Errorf("Parse bool fail: %v\n", err)
|
||||
@ -175,9 +173,7 @@ If the memory usage reaches this threshold, all the meta partition will be readO
|
||||
threshold float64
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if threshold, err = strconv.ParseFloat(args[0], 64); err != nil {
|
||||
err = fmt.Errorf("Parse Float fail: %v\n", err)
|
||||
@ -210,9 +206,7 @@ func newClusterSetParasCmd(client *master.MasterClient) *cobra.Command {
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
|
||||
if err = client.AdminAPI().SetClusterParas(optDelBatchCount, optMarkDeleteRate, optDelWorkerSleepMs,
|
||||
@ -254,9 +248,7 @@ If 'forbid=true', MetaPartition decommission/migrate and MetaNode decommission i
|
||||
forbid bool
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if forbid, err = strconv.ParseBool(args[0]); err != nil {
|
||||
err = fmt.Errorf("Parse bool fail: %v\n", err)
|
||||
|
||||
@ -62,9 +62,7 @@ func newMetaCompatibilityCmd() *cobra.Command {
|
||||
)
|
||||
client := api.NewMetaHttpClient(host, false)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
id, err := strconv.ParseUint(pid, 10, 64)
|
||||
if err != nil {
|
||||
|
||||
@ -16,7 +16,6 @@ package cmd
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"math"
|
||||
"os"
|
||||
@ -77,13 +76,11 @@ func newConfigSetCmd() *cobra.Command {
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
tmp, _ := strconv.Atoi(optTimeout)
|
||||
if tmp > math.MaxUint16 {
|
||||
stdout("Please reset timeout. Input less than math.MaxUint16\n")
|
||||
stdoutln("Please reset timeout. Input less than math.MaxUint16")
|
||||
return
|
||||
}
|
||||
timeOut := uint16(tmp)
|
||||
@ -117,10 +114,7 @@ func newConfigInfoCmd() *cobra.Command {
|
||||
Short: cmdConfigInfoShort,
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
config, err := LoadConfig()
|
||||
if err != nil {
|
||||
_, _ = fmt.Fprintf(os.Stderr, "Error: %v\n", err)
|
||||
OsExitWithLogFlush()
|
||||
}
|
||||
errout(err)
|
||||
printConfigInfo(config)
|
||||
},
|
||||
}
|
||||
|
||||
@ -59,9 +59,7 @@ func newDataNodeListCmd(client *master.MasterClient) *cobra.Command {
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var view *proto.ClusterView
|
||||
if view, err = client.AdminAPI().GetCluster(); err != nil {
|
||||
@ -70,8 +68,8 @@ func newDataNodeListCmd(client *master.MasterClient) *cobra.Command {
|
||||
sort.SliceStable(view.DataNodes, func(i, j int) bool {
|
||||
return view.DataNodes[i].ID < view.DataNodes[j].ID
|
||||
})
|
||||
stdout("[Data nodes]\n")
|
||||
stdout("%v\n", formatNodeViewTableHeader())
|
||||
stdoutln("[Data nodes]")
|
||||
stdoutln(formatNodeViewTableHeader())
|
||||
for _, node := range view.DataNodes {
|
||||
if optFilterStatus != "" &&
|
||||
!strings.Contains(formatNodeStatus(node.Status), optFilterStatus) {
|
||||
@ -81,7 +79,7 @@ func newDataNodeListCmd(client *master.MasterClient) *cobra.Command {
|
||||
!strings.Contains(formatYesNo(node.IsWritable), optFilterWritable) {
|
||||
continue
|
||||
}
|
||||
stdout("%v\n", formatNodeView(&node, true))
|
||||
stdoutln(formatNodeView(&node, true))
|
||||
}
|
||||
},
|
||||
}
|
||||
@ -100,16 +98,14 @@ func newDataNodeInfoCmd(client *master.MasterClient) *cobra.Command {
|
||||
var nodeAddr string
|
||||
var datanodeInfo *proto.DataNodeInfo
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
nodeAddr = args[0]
|
||||
if datanodeInfo, err = client.NodeAPI().GetDataNode(nodeAddr); err != nil {
|
||||
return
|
||||
}
|
||||
stdout("[Data node info]\n")
|
||||
stdout("%v", formatDataNodeDetail(datanodeInfo, false))
|
||||
stdoutln("[Data node info]")
|
||||
stdoutln(formatDataNodeDetail(datanodeInfo, false))
|
||||
},
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) != 0 {
|
||||
@ -134,19 +130,17 @@ func newDataNodeDecommissionCmd(client *master.MasterClient) *cobra.Command {
|
||||
var err error
|
||||
var nodeAddr string
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
nodeAddr = args[0]
|
||||
if optCount < 0 {
|
||||
stdout("Migrate dp count should >= 0\n")
|
||||
stdoutln("Migrate dp count should >= 0")
|
||||
return
|
||||
}
|
||||
if err = client.NodeAPI().DataNodeDecommission(nodeAddr, optCount, clientIDKey); err != nil {
|
||||
return
|
||||
}
|
||||
stdout("Decommission data node successfully\n")
|
||||
stdoutln("Decommission data node successfully")
|
||||
},
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) != 0 {
|
||||
@ -171,21 +165,19 @@ func newDataNodeMigrateCmd(client *master.MasterClient) *cobra.Command {
|
||||
var err error
|
||||
var src, dst string
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
src = args[0]
|
||||
dst = args[1]
|
||||
if optCount > dpMigrateMax || optCount <= 0 {
|
||||
stdout("Migrate dp count should between [1-50]\n")
|
||||
stdoutln("Migrate dp count should between [1-50]")
|
||||
return
|
||||
}
|
||||
|
||||
if err = client.NodeAPI().DataNodeMigrate(src, dst, optCount, clientIDKey); err != nil {
|
||||
return
|
||||
}
|
||||
stdout("Migrate data node successfully\n")
|
||||
stdoutln("Migrate data node successfully")
|
||||
},
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) != 0 {
|
||||
|
||||
@ -66,9 +66,7 @@ func newDataPartitionGetCmd(client *master.MasterClient) *cobra.Command {
|
||||
partition *proto.DataPartitionInfo
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if partitionID, err = strconv.ParseUint(args[0], 10, 64); err != nil {
|
||||
return
|
||||
@ -76,7 +74,7 @@ func newDataPartitionGetCmd(client *master.MasterClient) *cobra.Command {
|
||||
if partition, err = client.AdminAPI().GetDataPartition("", partitionID); err != nil {
|
||||
return
|
||||
}
|
||||
stdout("%v", formatDataPartitionInfo(partition))
|
||||
stdoutf("%v", formatDataPartitionInfo(partition))
|
||||
},
|
||||
}
|
||||
return cmd
|
||||
@ -102,15 +100,13 @@ The "reset" command will be released in next version`,
|
||||
err error
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if diagnosis, err = client.AdminAPI().DiagnoseDataPartition(ignoreDiscardDp); err != nil {
|
||||
return
|
||||
}
|
||||
stdout("[Inactive Data nodes]:\n")
|
||||
stdout("%v\n", formatDataNodeDetailTableHeader())
|
||||
stdoutln("[Inactive Data nodes]:")
|
||||
stdoutlnf("%v", formatDataNodeDetailTableHeader())
|
||||
for _, addr := range diagnosis.InactiveDataNodes {
|
||||
var node *proto.DataNodeInfo
|
||||
if node, err = client.NodeAPI().GetDataNode(addr); err != nil {
|
||||
@ -122,11 +118,11 @@ The "reset" command will be released in next version`,
|
||||
return dataNodes[i].ID < dataNodes[j].ID
|
||||
})
|
||||
for _, node := range dataNodes {
|
||||
stdout("%v\n", formatDataNodeDetail(node, true))
|
||||
stdoutln(formatDataNodeDetail(node, true))
|
||||
}
|
||||
stdout("\n")
|
||||
stdout("[Corrupt data partitions](no leader):\n")
|
||||
stdout("%v\n", partitionInfoTableHeader)
|
||||
stdoutln()
|
||||
stdoutln("[Corrupt data partitions](no leader):")
|
||||
stdoutln(partitionInfoTableHeader)
|
||||
sort.SliceStable(diagnosis.CorruptDataPartitionIDs, func(i, j int) bool {
|
||||
return diagnosis.CorruptDataPartitionIDs[i] < diagnosis.CorruptDataPartitionIDs[j]
|
||||
})
|
||||
@ -136,12 +132,12 @@ The "reset" command will be released in next version`,
|
||||
err = fmt.Errorf("Partition not found, err:[%v] ", err)
|
||||
return
|
||||
}
|
||||
stdout("%v\n", formatDataPartitionInfoRow(partition))
|
||||
stdoutln(formatDataPartitionInfoRow(partition))
|
||||
}
|
||||
|
||||
stdout("\n")
|
||||
stdout("%v\n", "[Partition lack replicas]:")
|
||||
stdout("%v\n", partitionInfoTableHeader)
|
||||
stdoutln()
|
||||
stdoutln("[Partition lack replicas]:")
|
||||
stdoutln(partitionInfoTableHeader)
|
||||
sort.SliceStable(diagnosis.LackReplicaDataPartitionIDs, func(i, j int) bool {
|
||||
return diagnosis.LackReplicaDataPartitionIDs[i] < diagnosis.LackReplicaDataPartitionIDs[j]
|
||||
})
|
||||
@ -152,27 +148,27 @@ The "reset" command will be released in next version`,
|
||||
return
|
||||
}
|
||||
if partition != nil {
|
||||
stdout("%v\n", formatDataPartitionInfoRow(partition))
|
||||
stdoutln(formatDataPartitionInfoRow(partition))
|
||||
}
|
||||
}
|
||||
|
||||
stdout("\n")
|
||||
stdout("%v\n", "[Bad data partitions(decommission not completed)]:")
|
||||
badPartitionTablePattern := "%-8v %-10v %-10v\n"
|
||||
stdout(badPartitionTablePattern, "PATH", "PARTITION ID", "REPAIR PROGRESS")
|
||||
stdoutln()
|
||||
stdoutln("[Bad data partitions(decommission not completed)]:")
|
||||
badPartitionTablePattern := "%-8v %-10v %-10v"
|
||||
stdoutlnf(badPartitionTablePattern, "PATH", "PARTITION ID", "REPAIR PROGRESS")
|
||||
for _, bdpv := range diagnosis.BadDataPartitionInfos {
|
||||
sort.SliceStable(bdpv.PartitionInfos, func(i, j int) bool {
|
||||
return bdpv.PartitionInfos[i].PartitionID < bdpv.PartitionInfos[j].PartitionID
|
||||
})
|
||||
for _, pinfo := range bdpv.PartitionInfos {
|
||||
percent := strconv.FormatFloat(pinfo.DecommissionRepairProgress*100, 'f', 2, 64) + "%"
|
||||
stdout(badPartitionTablePattern, bdpv.Path, pinfo.PartitionID, percent)
|
||||
stdoutlnf(badPartitionTablePattern, bdpv.Path, pinfo.PartitionID, percent)
|
||||
}
|
||||
}
|
||||
|
||||
stdout("\n")
|
||||
stdout("%v\n", "[Partition has unavailable replica]:")
|
||||
stdout("%v\n", badReplicaPartitionInfoTableHeader)
|
||||
stdoutln()
|
||||
stdoutln("[Partition has unavailable replica]:")
|
||||
stdoutln(badReplicaPartitionInfoTableHeader)
|
||||
sort.SliceStable(diagnosis.BadReplicaDataPartitionIDs, func(i, j int) bool {
|
||||
return diagnosis.BadReplicaDataPartitionIDs[i] < diagnosis.BadReplicaDataPartitionIDs[j]
|
||||
})
|
||||
@ -184,14 +180,14 @@ The "reset" command will be released in next version`,
|
||||
return
|
||||
}
|
||||
if partition != nil {
|
||||
stdout("%v\n", formatBadReplicaDpInfoRow(partition))
|
||||
stdoutln(formatBadReplicaDpInfoRow(partition))
|
||||
}
|
||||
}
|
||||
|
||||
if diff {
|
||||
stdout("\n")
|
||||
stdout("%v\n", "[Partition with replica file count differ significantly]:")
|
||||
stdout("%v\n", RepFileCountDifferInfoTableHeader)
|
||||
stdoutln()
|
||||
stdoutln("[Partition with replica file count differ significantly]:")
|
||||
stdoutln(RepFileCountDifferInfoTableHeader)
|
||||
sort.SliceStable(diagnosis.RepFileCountDifferDpIDs, func(i, j int) bool {
|
||||
return diagnosis.RepFileCountDifferDpIDs[i] < diagnosis.RepFileCountDifferDpIDs[j]
|
||||
})
|
||||
@ -202,13 +198,13 @@ The "reset" command will be released in next version`,
|
||||
return
|
||||
}
|
||||
if partition != nil {
|
||||
stdout("%v\n", formatReplicaFileCountDiffDpInfoRow(partition))
|
||||
stdoutln(formatReplicaFileCountDiffDpInfoRow(partition))
|
||||
}
|
||||
}
|
||||
|
||||
stdout("\n")
|
||||
stdout("%v\n", "[Partition with replica used size differ significantly]:")
|
||||
stdout("%v\n", RepUsedSizeDifferInfoTableHeader)
|
||||
stdoutln()
|
||||
stdoutln("[Partition with replica used size differ significantly]:")
|
||||
stdoutln(RepUsedSizeDifferInfoTableHeader)
|
||||
sort.SliceStable(diagnosis.RepUsedSizeDifferDpIDs, func(i, j int) bool {
|
||||
return diagnosis.RepUsedSizeDifferDpIDs[i] < diagnosis.RepUsedSizeDifferDpIDs[j]
|
||||
})
|
||||
@ -219,22 +215,22 @@ The "reset" command will be released in next version`,
|
||||
return
|
||||
}
|
||||
if partition != nil {
|
||||
stdout("%v\n", formatReplicaSizeDiffDpInfoRow(partition))
|
||||
stdoutln(formatReplicaSizeDiffDpInfoRow(partition))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
stdout("\n")
|
||||
stdout("%v %v\n", "[Number of Partition with replica file count differ significantly]:",
|
||||
stdoutln()
|
||||
stdoutlnf("%v %v", "[Number of Partition with replica file count differ significantly]:",
|
||||
len(diagnosis.RepUsedSizeDifferDpIDs))
|
||||
|
||||
stdout("\n")
|
||||
stdout("%v %v\n", "[Number of Partition with replica used size differ significantly]:",
|
||||
stdoutln()
|
||||
stdoutlnf("%v %v", "[Number of Partition with replica used size differ significantly]:",
|
||||
len(diagnosis.RepUsedSizeDifferDpIDs))
|
||||
}
|
||||
|
||||
stdout("\n")
|
||||
stdout("%v\n", "[Partition with excessive replicas]:")
|
||||
stdout("%v\n", partitionInfoTableHeader)
|
||||
stdoutln()
|
||||
stdoutln("[Partition with excessive replicas]:")
|
||||
stdoutln(partitionInfoTableHeader)
|
||||
sort.SliceStable(diagnosis.ExcessReplicaDpIDs, func(i, j int) bool {
|
||||
return diagnosis.ExcessReplicaDpIDs[i] < diagnosis.ExcessReplicaDpIDs[j]
|
||||
})
|
||||
@ -245,7 +241,7 @@ The "reset" command will be released in next version`,
|
||||
return
|
||||
}
|
||||
if partition != nil {
|
||||
stdout("%v\n", formatDataPartitionInfoRow(partition))
|
||||
stdoutln(formatDataPartitionInfoRow(partition))
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -269,9 +265,7 @@ func newDataPartitionDecommissionCmd(client *master.MasterClient) *cobra.Command
|
||||
partitionID uint64
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
address := args[0]
|
||||
partitionID, err = strconv.ParseUint(args[1], 10, 64)
|
||||
@ -281,7 +275,7 @@ func newDataPartitionDecommissionCmd(client *master.MasterClient) *cobra.Command
|
||||
if err = client.AdminAPI().DecommissionDataPartition(partitionID, address, raftForceDel, clientIDKey); err != nil {
|
||||
return
|
||||
}
|
||||
stdout("Decommission data partition successfully\n")
|
||||
stdoutln("Decommission data partition successfully")
|
||||
},
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) != 0 {
|
||||
@ -307,9 +301,7 @@ func newDataPartitionReplicateCmd(client *master.MasterClient) *cobra.Command {
|
||||
partitionID uint64
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
address := args[0]
|
||||
if partitionID, err = strconv.ParseUint(args[1], 10, 64); err != nil {
|
||||
@ -318,7 +310,7 @@ func newDataPartitionReplicateCmd(client *master.MasterClient) *cobra.Command {
|
||||
if err = client.AdminAPI().AddDataReplica(partitionID, address, clientIDKey); err != nil {
|
||||
return
|
||||
}
|
||||
stdout("Add replication successfully\n")
|
||||
stdoutln("Add replication successfully")
|
||||
},
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) != 0 {
|
||||
@ -343,9 +335,7 @@ func newDataPartitionDeleteReplicaCmd(client *master.MasterClient) *cobra.Comman
|
||||
partitionID uint64
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
address := args[0]
|
||||
if partitionID, err = strconv.ParseUint(args[1], 10, 64); err != nil {
|
||||
@ -354,7 +344,7 @@ func newDataPartitionDeleteReplicaCmd(client *master.MasterClient) *cobra.Comman
|
||||
if err = client.AdminAPI().DeleteDataReplica(partitionID, address, clientIDKey); err != nil {
|
||||
return
|
||||
}
|
||||
stdout("Delete replication successfully\n")
|
||||
stdoutln("Delete replication successfully")
|
||||
},
|
||||
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
||||
if len(args) != 0 {
|
||||
@ -378,23 +368,21 @@ func newDataPartitionGetDiscardCmd(client *master.MasterClient) *cobra.Command {
|
||||
)
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
|
||||
if infos, err = client.AdminAPI().GetDiscardDataPartition(); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
stdout("\n")
|
||||
stdout("%v\n", "[Discard Partitions]:")
|
||||
stdout("%v\n", partitionInfoTableHeader)
|
||||
stdoutln()
|
||||
stdoutln("[Discard Partitions]:")
|
||||
stdoutln(partitionInfoTableHeader)
|
||||
sort.SliceStable(infos.DiscardDps, func(i, j int) bool {
|
||||
return infos.DiscardDps[i].PartitionID < infos.DiscardDps[j].PartitionID
|
||||
})
|
||||
for _, partition := range infos.DiscardDps {
|
||||
stdout("%v\n", formatDataPartitionInfoRow(&partition))
|
||||
stdoutln(formatDataPartitionInfoRow(&partition))
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
@ -40,9 +40,7 @@ func newListBadDiskCmd(client *master.MasterClient) *cobra.Command {
|
||||
err error
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if infos, err = client.AdminAPI().QueryBadDisks(); err != nil {
|
||||
return
|
||||
|
||||
@ -25,7 +25,6 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
)
|
||||
|
||||
|
||||
@ -60,9 +60,7 @@ func newMetaNodeListCmd(client *master.MasterClient) *cobra.Command {
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var view *proto.ClusterView
|
||||
if view, err = client.AdminAPI().GetCluster(); err != nil {
|
||||
@ -101,9 +99,7 @@ func newMetaNodeInfoCmd(client *master.MasterClient) *cobra.Command {
|
||||
var nodeAddr string
|
||||
var metanodeInfo *proto.MetaNodeInfo
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
nodeAddr = args[0]
|
||||
if metanodeInfo, err = client.NodeAPI().GetMetaNode(nodeAddr); err != nil {
|
||||
@ -135,9 +131,7 @@ func newMetaNodeDecommissionCmd(client *master.MasterClient) *cobra.Command {
|
||||
var err error
|
||||
var nodeAddr string
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
nodeAddr = args[0]
|
||||
if optCount < 0 {
|
||||
@ -174,9 +168,7 @@ func newMetaNodeMigrateCmd(client *master.MasterClient) *cobra.Command {
|
||||
var err error
|
||||
var src, dst string
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
src = args[0]
|
||||
dst = args[1]
|
||||
|
||||
@ -64,9 +64,7 @@ func newMetaPartitionGetCmd(client *master.MasterClient) *cobra.Command {
|
||||
partition *proto.MetaPartitionInfo
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if partitionID, err = strconv.ParseUint(args[0], 10, 64); err != nil {
|
||||
return
|
||||
@ -97,9 +95,7 @@ the corrupt nodes, the few remaining replicas can not reach an agreement with on
|
||||
err error
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if diagnosis, err = client.AdminAPI().DiagnoseMetaPartition(); err != nil {
|
||||
return
|
||||
@ -270,9 +266,7 @@ func newMetaPartitionDecommissionCmd(client *master.MasterClient) *cobra.Command
|
||||
partitionID uint64
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
address := args[0]
|
||||
partitionID, err = strconv.ParseUint(args[1], 10, 64)
|
||||
@ -304,9 +298,7 @@ func newMetaPartitionReplicateCmd(client *master.MasterClient) *cobra.Command {
|
||||
partitionID uint64
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
address := args[0]
|
||||
partitionID, err = strconv.ParseUint(args[1], 10, 64)
|
||||
@ -338,9 +330,7 @@ func newMetaPartitionDeleteReplicaCmd(client *master.MasterClient) *cobra.Comman
|
||||
partitionID uint64
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
address := args[0]
|
||||
partitionID, err = strconv.ParseUint(args[1], 10, 64)
|
||||
|
||||
@ -54,9 +54,7 @@ func newNodeSetListCmd(client *master.MasterClient) *cobra.Command {
|
||||
var nodeSetStats []*proto.NodeSetStat
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if nodeSetStats, err = client.AdminAPI().ListNodeSets(zoneName); err != nil {
|
||||
return
|
||||
@ -83,9 +81,7 @@ func newNodeSetInfoCmd(client *master.MasterClient) *cobra.Command {
|
||||
var nodeSetStatInfo *proto.NodeSetStatInfo
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
|
||||
nodeSetId := args[0]
|
||||
@ -109,9 +105,7 @@ func newNodeSetUpdateCmd(client *master.MasterClient) *cobra.Command {
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
|
||||
nodeSetId := args[0]
|
||||
|
||||
@ -56,7 +56,7 @@ func NewRootCmd(client *master.MasterClient) *CubeFSCmd {
|
||||
suggestionsString += fmt.Sprintf("\t%v\n", s)
|
||||
}
|
||||
}
|
||||
errout("cfs-cli: unknown command %q\n%s", args[0], suggestionsString)
|
||||
errout(fmt.Errorf("cfs-cli: unknown command %q\n%s", args[0], suggestionsString))
|
||||
},
|
||||
},
|
||||
}
|
||||
@ -91,13 +91,25 @@ func stdout(format string, a ...interface{}) {
|
||||
_, _ = fmt.Fprintf(os.Stdout, format, a...)
|
||||
}
|
||||
|
||||
func errout(format string, a ...interface{}) {
|
||||
log.LogErrorf(format, a...)
|
||||
_, _ = fmt.Fprintf(os.Stderr, format, a...)
|
||||
OsExitWithLogFlush()
|
||||
func stdoutln(a ...interface{}) {
|
||||
fmt.Fprintln(os.Stdout, a...)
|
||||
}
|
||||
|
||||
func OsExitWithLogFlush() {
|
||||
func stdoutf(format string, a ...interface{}) {
|
||||
fmt.Fprintf(os.Stdout, format, a...)
|
||||
}
|
||||
|
||||
func stdoutlnf(format string, a ...interface{}) {
|
||||
stdoutf(format, a...)
|
||||
fmt.Fprint(os.Stdout)
|
||||
}
|
||||
|
||||
func errout(err error) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
fmt.Fprintln(os.Stderr, "Error:", err)
|
||||
log.LogError("Error:", err)
|
||||
log.LogFlush()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@ -54,9 +54,7 @@ func newUidAddCmd(client *master.MasterClient) *cobra.Command {
|
||||
}
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var uidInfo *proto.UidSpaceRsp
|
||||
if uidInfo, err = client.UserAPI().UidOperation(args[0], args[1], util.UidAddLimit, args[2]); err != nil || !uidInfo.OK {
|
||||
@ -91,9 +89,7 @@ func newUidListCmd(client *master.MasterClient) *cobra.Command {
|
||||
volumeName := args[0]
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var uidInfo *proto.UidSpaceRsp
|
||||
if uidInfo, err = client.UserAPI().UidOperation(volumeName, "", util.UidLimitList, ""); err != nil || !uidInfo.OK {
|
||||
@ -127,9 +123,7 @@ func newUidDelCmd(client *master.MasterClient) *cobra.Command {
|
||||
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var uidInfo *proto.UidSpaceRsp
|
||||
if uidInfo, err = client.UserAPI().UidOperation(args[0], args[1], util.UidDel, ""); err != nil || !uidInfo.OK {
|
||||
@ -156,9 +150,7 @@ func newUidCheckCmd(client *master.MasterClient) *cobra.Command {
|
||||
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var uidInfo *proto.UidSpaceRsp
|
||||
if uidInfo, err = client.UserAPI().UidOperation(args[0], args[1], util.UidGetLimit, ""); err != nil || !uidInfo.OK {
|
||||
|
||||
@ -69,9 +69,7 @@ func newUserCreateCmd(client *master.MasterClient) *cobra.Command {
|
||||
secretKey := optSecretKey
|
||||
userType := proto.UserTypeFromString(optUserType)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if !userType.Valid() {
|
||||
err = fmt.Errorf("Invalid user type. ")
|
||||
@ -158,9 +156,7 @@ func newUserUpdateCmd(client *master.MasterClient) *cobra.Command {
|
||||
secretKey := optSecretKey
|
||||
var userType proto.UserType
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if optUserType != "" {
|
||||
userType = proto.UserTypeFromString(optUserType)
|
||||
@ -240,9 +236,7 @@ func newUserDeleteCmd(client *master.MasterClient) *cobra.Command {
|
||||
var err error
|
||||
userID := args[0]
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if !optYes {
|
||||
stdout("Delete user [%v] (yes/no)[no]:", userID)
|
||||
@ -288,9 +282,7 @@ func newUserInfoCmd(client *master.MasterClient) *cobra.Command {
|
||||
userID := args[0]
|
||||
var userInfo *proto.UserInfo
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if userInfo, err = client.UserAPI().GetUserInfo(userID); err != nil {
|
||||
err = fmt.Errorf("Get user info failed: %v\n", err)
|
||||
@ -327,9 +319,7 @@ func newUserPermCmd(client *master.MasterClient) *cobra.Command {
|
||||
volume := args[1]
|
||||
var perm proto.Permission
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
|
||||
perm = proto.BuiltinPermissionPrefix
|
||||
@ -405,9 +395,7 @@ func newUserListCmd(client *master.MasterClient) *cobra.Command {
|
||||
var users []*proto.UserInfo
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if users, err = client.UserAPI().ListUsers(optKeyword); err != nil {
|
||||
return
|
||||
|
||||
@ -28,7 +28,7 @@ func validVols(client, complete interface{}) []string {
|
||||
clientSdk := client.(*sdk.MasterClient)
|
||||
completeStr := complete.(string)
|
||||
if vols, err = clientSdk.AdminAPI().ListVols(completeStr); err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
errout(err)
|
||||
}
|
||||
for _, vol := range vols {
|
||||
validVols = append(validVols, vol.Name)
|
||||
@ -44,7 +44,7 @@ func validDataNodes(client *sdk.MasterClient, toComplete string) []string {
|
||||
err error
|
||||
)
|
||||
if clusterView, err = client.AdminAPI().GetCluster(); err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
errout(err)
|
||||
}
|
||||
for _, dn := range clusterView.DataNodes {
|
||||
validDataNodes = append(validDataNodes, dn.Addr)
|
||||
@ -59,7 +59,7 @@ func validMetaNodes(client *sdk.MasterClient, toComplete string) []string {
|
||||
err error
|
||||
)
|
||||
if clusterView, err = client.AdminAPI().GetCluster(); err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
errout(err)
|
||||
}
|
||||
for _, mn := range clusterView.MetaNodes {
|
||||
validMetaNodes = append(validMetaNodes, mn.Addr)
|
||||
@ -74,7 +74,7 @@ func validUsers(client *sdk.MasterClient, toComplete string) []string {
|
||||
err error
|
||||
)
|
||||
if users, err = client.UserAPI().ListUsers(toComplete); err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
errout(err)
|
||||
}
|
||||
for _, user := range users {
|
||||
validUsers = append(validUsers, user.UserID)
|
||||
@ -89,7 +89,7 @@ func validZones(client *sdk.MasterClient, toComplete string) []string {
|
||||
err error
|
||||
)
|
||||
if zones, err = client.AdminAPI().ListZones(); err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
errout(err)
|
||||
}
|
||||
for _, zone := range zones {
|
||||
validZones = append(validZones, zone.Name)
|
||||
|
||||
@ -46,9 +46,7 @@ func newVersionCreateCmd(client *master.MasterClient) *cobra.Command {
|
||||
volumeName := args[0]
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if _, err = client.AdminAPI().CreateVersion(volumeName); err != nil {
|
||||
return
|
||||
@ -87,9 +85,7 @@ func newVersionListCmd(client *master.MasterClient) *cobra.Command {
|
||||
err error
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if verList, err = client.AdminAPI().GetVerList(volumeName); err != nil {
|
||||
return
|
||||
@ -121,9 +117,7 @@ func newVersionDelCmd(client *master.MasterClient) *cobra.Command {
|
||||
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if err = client.AdminAPI().DeleteVersion(args[0], args[1]); err != nil {
|
||||
return
|
||||
@ -148,9 +142,7 @@ func newVersionStrategyCmd(client *master.MasterClient) *cobra.Command {
|
||||
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if err = client.AdminAPI().SetStrategy(args[0], args[1], args[2], args[3], args[4]); err != nil {
|
||||
return
|
||||
|
||||
@ -67,9 +67,7 @@ func newVolListCmd(client *master.MasterClient) *cobra.Command {
|
||||
var vols []*proto.VolInfo
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if vols, err = client.AdminAPI().ListVols(optKeyword); err != nil {
|
||||
return
|
||||
@ -144,9 +142,7 @@ func newVolCreateCmd(client *master.MasterClient) *cobra.Command {
|
||||
volumeName := args[0]
|
||||
userID := args[1]
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
crossZone, _ := strconv.ParseBool(optCrossZone)
|
||||
followerRead, _ := strconv.ParseBool(optFollowerRead)
|
||||
@ -296,9 +292,7 @@ func newVolUpdateCmd(client *master.MasterClient) *cobra.Command {
|
||||
volumeName := args[0]
|
||||
isChange := false
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if vv, err = client.AdminAPI().GetVolumeSimpleInfo(volumeName); err != nil {
|
||||
return
|
||||
@ -652,9 +646,7 @@ func newVolInfoCmd(client *master.MasterClient) *cobra.Command {
|
||||
volumeName := args[0]
|
||||
var svv *proto.SimpleVolView
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if svv, err = client.AdminAPI().GetVolumeSimpleInfo(volumeName); err != nil {
|
||||
err = fmt.Errorf("Get volume info failed:\n%v\n", err)
|
||||
@ -727,9 +719,7 @@ func newVolDeleteCmd(client *master.MasterClient) *cobra.Command {
|
||||
var err error
|
||||
volumeName := args[0]
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
// ask user for confirm
|
||||
if !optYes {
|
||||
@ -786,9 +776,7 @@ func newVolTransferCmd(client *master.MasterClient) *cobra.Command {
|
||||
userID := args[1]
|
||||
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
|
||||
// ask user for confirm
|
||||
@ -849,9 +837,7 @@ func newVolAddDPCmd(client *master.MasterClient) *cobra.Command {
|
||||
number := args[1]
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
var count int64
|
||||
if count, err = strconv.ParseInt(number, 10, 64); err != nil {
|
||||
@ -903,9 +889,7 @@ func newVolSetCapacityCmd(use, short string, r clientHandler) *cobra.Command {
|
||||
capacityStr := args[1]
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
volume := r.(*volumeClient)
|
||||
if volume.capacity, err = strconv.ParseUint(capacityStr, 10, 64); err != nil {
|
||||
@ -945,9 +929,7 @@ func newVolSetForbiddenCmd(client *master.MasterClient) *cobra.Command {
|
||||
settingStr := args[1]
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
forbidden, err := strconv.ParseBool(settingStr)
|
||||
if err != nil {
|
||||
|
||||
@ -56,9 +56,7 @@ func newZoneListCmd(client *sdk.MasterClient) *cobra.Command {
|
||||
var zones []*proto.ZoneView
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
if zones, err = client.AdminAPI().ListZones(); err != nil {
|
||||
return
|
||||
@ -86,9 +84,7 @@ func newZoneInfoCmd(client *sdk.MasterClient) *cobra.Command {
|
||||
zoneView *proto.ZoneView
|
||||
)
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
zoneName = args[0]
|
||||
if topo, err = client.AdminAPI().Topo(); err != nil {
|
||||
@ -129,9 +125,7 @@ func newZoneUpdateCmd(client *sdk.MasterClient) *cobra.Command {
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
var err error
|
||||
defer func() {
|
||||
if err != nil {
|
||||
errout("Error: %v\n", err)
|
||||
}
|
||||
errout(err)
|
||||
}()
|
||||
zoneName := args[0]
|
||||
if err = client.AdminAPI().UpdateZone(zoneName, enable, dataNodesetSelector, metaNodesetSelector, dataNodeSelector, metaNodeSelector); err != nil {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user