Skip to content

Commit cda54f7

Browse files
author
Jeff McCormick
committed
for issue 64 - a better response when no clusters are found when applying a policy
1 parent cf06b80 commit cda54f7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pgo/cmd/policy.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,12 @@ func applyPolicy(args []string) {
123123
}
124124

125125
if response.Status.Code == msgs.Ok {
126-
for _, v := range response.Name {
127-
fmt.Println("applied policy on " + v)
126+
if len(response.Name) == 0 {
127+
fmt.Println("no clusters found")
128+
} else {
129+
for _, v := range response.Name {
130+
fmt.Println("applied policy on " + v)
131+
}
128132
}
129133
} else {
130134
fmt.Println(RED(response.Status.Msg))

0 commit comments

Comments
 (0)