Skip to content

Commit

Permalink
return exit code on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
robertchoi80 committed Jun 24, 2022
1 parent bd0c78b commit 3a25ef8
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/cluster_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ tks cluster create <CLUSTERNAME>`,
fmt.Println("Response:\n", r)
if err != nil {
fmt.Println("Error:", err)
os.Exit(1)
} else {
fmt.Println("Success: The request to create cluster ", args[0], " was accepted.")
}
Expand Down
1 change: 1 addition & 0 deletions cmd/cluster_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ tks cluster delete <CLUSTER_ID>`,
fmt.Println(r)
if err != nil {
fmt.Println(err)
os.Exit(1)
} else {
fmt.Println("The request to delete cluster ", args[0], " was accepted.")
}
Expand Down
1 change: 1 addition & 0 deletions cmd/cluster_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ tks cluster list (--long)`,
r, err := client.GetClusters(ctx, &data)
if err != nil {
fmt.Println(err)
os.Exit(1)
} else {
if len(r.Clusters) == 0 {
fmt.Println("No cluster exists for specified contract!")
Expand Down
1 change: 1 addition & 0 deletions cmd/cluster_show.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ tks cluster show <CLUSTER_ID>`,
r, err := client.GetCluster(ctx, &data)
if err != nil {
fmt.Println(err)
os.Exit(1)
} else {
printCluster(r)
}
Expand Down
1 change: 1 addition & 0 deletions cmd/service_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ tks service create --cluster-id <CLUSTERID> --service-name <LMA,LMA_EFK,SERVICE_
fmt.Println("Response:\n", r)
if err != nil {
fmt.Println("Error:", err)
os.Exit(1)
} else {
fmt.Println("Success: The request to create service ", AppGroupName, " was accepted.")
}
Expand Down
1 change: 1 addition & 0 deletions cmd/service_delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ tks service delete <SERVICE ID>`,
r, err := client.UninstallAppGroups(ctx, &data)
if err != nil {
fmt.Println(err)
os.Exit(1)
} else {
fmt.Println(r)
}
Expand Down
1 change: 1 addition & 0 deletions cmd/service_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ tks service list <CLUSTER ID> (--long)`,
r, err := client.GetAppGroupsByClusterID(ctx, &data)
if err != nil {
fmt.Println(err)
os.Exit(1)
} else {
long, _ := cmd.Flags().GetBool("long")
printAppGroups(r, long)
Expand Down

0 comments on commit 3a25ef8

Please sign in to comment.