-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Enwei Jiao <[email protected]>
- Loading branch information
1 parent
83f9854
commit 6aa3d0f
Showing
6 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package remove | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
"github.com/milvus-io/birdwatcher/states/etcd/common" | ||
"github.com/spf13/cobra" | ||
|
||
clientv3 "go.etcd.io/etcd/client/v3" | ||
) | ||
|
||
// EtcdConfigCommand returns set etcd-config command. | ||
func EtcdConfigCommand(cli clientv3.KV, basePath string) *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "config-etcd", | ||
Short: "remove configuations", | ||
Run: func(cmd *cobra.Command, args []string) { | ||
key, err := cmd.Flags().GetString("key") | ||
if err != nil { | ||
fmt.Println(err.Error()) | ||
return | ||
} | ||
if key == "" { | ||
fmt.Println("key & value cannot be empty") | ||
return | ||
} | ||
|
||
ctx, cancel := context.WithCancel(context.Background()) | ||
defer cancel() | ||
|
||
err = common.RemoveEtcdConfig(ctx, cli, basePath, key) | ||
if err != nil { | ||
fmt.Println("failed to remove etcd config item,", err.Error()) | ||
return | ||
} | ||
|
||
fmt.Println("etcd config remove.") | ||
}, | ||
} | ||
|
||
cmd.Flags().String("key", "", "etcd config key") | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters