Skip to content

Commit

Permalink
fix: fix --cluster when addon enable (#5343)
Browse files Browse the repository at this point in the history
Signed-off-by: zhaowei.wang <zhaowei.wang@metabit-trading.com>
(cherry picked from commit 021ca69)

Co-authored-by: zhaowei.wang <zhaowei.wang@metabit-trading.com>
  • Loading branch information
github-actions[bot] and zhaowei.wang committed Jan 13, 2023
1 parent 657e3b1 commit 8ef2513
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions references/cli/addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -1159,12 +1159,12 @@ func hasAddon(addons []*pkgaddon.UIData, name string) bool {
return false
}

func transClusters(cstr string) []string {
func transClusters(cstr string) []interface{} {
if len(cstr) == 0 {
return nil
}
cstr = strings.TrimPrefix(strings.TrimSuffix(cstr, "}"), "{")
var clusterL []string
var clusterL []interface{}
clusterList := strings.Split(cstr, ",")
for _, v := range clusterList {
clusterL = append(clusterL, strings.TrimSpace(v))
Expand Down
8 changes: 4 additions & 4 deletions references/cli/addon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,19 +191,19 @@ func TestAddonUpgradeCmdWithErrLocalPath(t *testing.T) {
func TestTransCluster(t *testing.T) {
testcase := []struct {
str string
res []string
res []interface{}
}{
{
str: "{cluster1, cluster2}",
res: []string{"cluster1", "cluster2"},
res: []interface{}{"cluster1", "cluster2"},
},
{
str: "{cluster1,cluster2}",
res: []string{"cluster1", "cluster2"},
res: []interface{}{"cluster1", "cluster2"},
},
{
str: "{cluster1, cluster2 }",
res: []string{"cluster1", "cluster2"},
res: []interface{}{"cluster1", "cluster2"},
},
}
for _, s := range testcase {
Expand Down

0 comments on commit 8ef2513

Please sign in to comment.