Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jdewinne committed Jan 22, 2025
1 parent 0c97137 commit 967fd55
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 30 deletions.
12 changes: 6 additions & 6 deletions cli/cmd/cluster_addon.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ func waitForAddon(kotsRestClient *kotsclient.VendorV3Client, clusterID, id strin

if addon.Status == types.ClusterAddonStatusRunning {
return addon, nil
} else if addon.Status == types.ClusterAddonStatusError {
}
if addon.Status == types.ClusterAddonStatusError {
return nil, errors.New("cluster addon failed to provision")
} else {
if time.Now().After(start.Add(duration)) {
// In case of timeout, return the cluster and a WaitDurationExceeded error
return addon, ErrWaitDurationExceeded
}
}
if time.Now().After(start.Add(duration)) {
// In case of timeout, return the cluster and a WaitDurationExceeded error
return addon, ErrWaitDurationExceeded
}

time.Sleep(time.Second * 5)
Expand Down
4 changes: 1 addition & 3 deletions cli/cmd/cluster_addon_create_objectstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@ func (r *runners) clusterAddonCreateObjectStoreCreateRun() error {
addon, err := r.createAndWaitForClusterAddonCreateObjectStore(opts, r.args.clusterAddonCreateObjectStoreDuration)
if err != nil {
if errors.Cause(err) == ErrWaitDurationExceeded {
defer func() {
os.Exit(124)
}()
defer os.Exit(124)
} else {
return err
}
Expand Down
16 changes: 7 additions & 9 deletions cli/cmd/cluster_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,7 @@ func (r *runners) createCluster(cmd *cobra.Command, args []string) error {
cl, err := r.createAndWaitForCluster(opts)
if err != nil {
if errors.Cause(err) == ErrWaitDurationExceeded {
defer func() {
os.Exit(124)
}()
defer os.Exit(124)
} else {
return err
}
Expand Down Expand Up @@ -247,13 +245,13 @@ func waitForCluster(kotsRestClient *kotsclient.VendorV3Client, id string, durati

if cluster.Status == types.ClusterStatusRunning {
return cluster, nil
} else if cluster.Status == types.ClusterStatusError || cluster.Status == types.ClusterStatusUpgradeError {
}
if cluster.Status == types.ClusterStatusError || cluster.Status == types.ClusterStatusUpgradeError {
return nil, errors.New("cluster failed to provision")
} else {
if time.Now().After(start.Add(duration)) {
// In case of timeout, return the cluster and a WaitDurationExceeded error
return cluster, ErrWaitDurationExceeded
}
}
if time.Now().After(start.Add(duration)) {
// In case of timeout, return the cluster and a WaitDurationExceeded error
return cluster, ErrWaitDurationExceeded
}

time.Sleep(time.Second * 5)
Expand Down
16 changes: 7 additions & 9 deletions cli/cmd/network_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ func (r *runners) createNetwork(_ *cobra.Command, args []string) error {
network, err := r.createAndWaitForNetwork(opts)
if err != nil {
if errors.Cause(err) == ErrVMWaitDurationExceeded {
defer func() {
os.Exit(124)
}()
defer os.Exit(124)
} else {
return err
}
Expand Down Expand Up @@ -100,13 +98,13 @@ func waitForNetwork(kotsRestClient *kotsclient.VendorV3Client, network *types.Ne

if network.Status == types.NetworkStatusRunning {
return network, nil
} else if network.Status == types.NetworkStatusError {
}
if network.Status == types.NetworkStatusError {
return nil, errors.New("network failed to provision")
} else {
if time.Now().After(start.Add(duration)) {
// In case of timeout, return the network and a WaitDurationExceeded error
return network, ErrWaitDurationExceeded
}
}
if time.Now().After(start.Add(duration)) {
// In case of timeout, return the network and a WaitDurationExceeded error
return network, ErrWaitDurationExceeded
}

time.Sleep(time.Second * 5)
Expand Down
4 changes: 1 addition & 3 deletions cli/cmd/vm_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,7 @@ func (r *runners) createVM(_ *cobra.Command, args []string) error {
vms, err := r.createAndWaitForVM(opts)
if err != nil {
if errors.Cause(err) == ErrVMWaitDurationExceeded {
defer func() {
os.Exit(124)
}()
defer os.Exit(124)
} else {
return err
}
Expand Down

0 comments on commit 967fd55

Please sign in to comment.