Skip to content

Commit

Permalink
fix(k8s): return cluster on wait flags (#776)
Browse files Browse the repository at this point in the history
Signed-off-by: Patrik Cyvoct <[email protected]>
  • Loading branch information
Sh4d1 authored Mar 16, 2020
1 parent 93ce9df commit 868c8df
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions internal/namespaces/k8s/v1beta4/custom_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ func clusterUpdateBuilder(c *core.Command) *core.Command {

func waitForClusterFunc(action int) core.WaitFunc {
return func(ctx context.Context, _, respI interface{}) (interface{}, error) {
_, err := k8s.NewAPI(core.ExtractClient(ctx)).WaitForCluster(&k8s.WaitForClusterRequest{
cluster, err := k8s.NewAPI(core.ExtractClient(ctx)).WaitForCluster(&k8s.WaitForClusterRequest{
Region: respI.(*k8s.Cluster).Region,
ClusterID: respI.(*k8s.Cluster).ID,
Timeout: scw.DurationPtr(clusterActionTimeout),
})
switch action {
case clusterActionCreate:
return fmt.Sprintf("Cluster %s successfully created.", respI.(*k8s.Cluster).ID), nil
return cluster, err
case clusterActionUpdate:
return fmt.Sprintf("Cluster %s successfully updated.", respI.(*k8s.Cluster).ID), nil
return cluster, err
case clusterActionUpgrade:
return fmt.Sprintf("Cluster %s successfully upgraded.", respI.(*k8s.Cluster).ID), nil
return cluster, err
case clusterActionDelete:
if err != nil {
// if we get a 404 here, it means the resource was successfully deleted
Expand Down

0 comments on commit 868c8df

Please sign in to comment.