Skip to content

Commit

Permalink
Fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattes83 committed Sep 5, 2023
1 parent d8d96af commit 7d98a9d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/controller/ionoscloudcluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func (r *IONOSCloudClusterReconciler) reconcileDataCenter(ctx *context.ClusterCo
}

if resp.StatusCode == 404 || *datacenter.Metadata.State == STATE_BUSY {
return &reconcile.Result{RequeueAfter: defaultRetryIntervalOnBusy}, errors.Wrap(err, "datacenter not available (yet)")
return &reconcile.Result{RequeueAfter: defaultRetryIntervalOnBusy}, errors.New("datacenter not available (yet)")
}

conditions.MarkTrue(ctx.IONOSCloudCluster, v1alpha1.DataCenterCreatedCondition)
Expand All @@ -230,7 +230,7 @@ func (r *IONOSCloudClusterReconciler) reconcilePrivateLan(ctx *context.ClusterCo
}

if resp.StatusCode == 404 || *lan.Metadata.State == STATE_BUSY {
return &reconcile.Result{RequeueAfter: defaultRetryIntervalOnBusy}, errors.Wrap(err, "private Lan not available (yet)")
return &reconcile.Result{RequeueAfter: defaultRetryIntervalOnBusy}, errors.New("private Lan not available (yet)")
}

conditions.MarkTrue(ctx.IONOSCloudCluster, v1alpha1.PrivateLanCreatedCondition)
Expand All @@ -257,7 +257,7 @@ func (r *IONOSCloudClusterReconciler) reconcilePublicLan(ctx *context.ClusterCon
}

if resp.StatusCode == 404 || *lan.Metadata.State == STATE_BUSY {
return &reconcile.Result{RequeueAfter: defaultRetryIntervalOnBusy}, errors.Wrap(err, "public Lan not available (yet)")
return &reconcile.Result{RequeueAfter: defaultRetryIntervalOnBusy}, errors.New("public Lan not available (yet)")
}

conditions.MarkTrue(ctx.IONOSCloudCluster, v1alpha1.PublicLanCreatedCondition)
Expand All @@ -279,11 +279,11 @@ func (r *IONOSCloudClusterReconciler) reconcileInternet(ctx *context.ClusterCont
lan, resp, err := ctx.IONOSClient.GetLan(ctx, ctx.IONOSCloudCluster.Spec.DataCenterID, lanId)

if err != nil && resp.StatusCode != 404 {
return &reconcile.Result{}, errors.Wrap(err, "error getting internet Lan")
return &reconcile.Result{}, errors.New("error getting internet Lan")
}

if resp.StatusCode == 404 || *lan.Metadata.State == STATE_BUSY {
return &reconcile.Result{RequeueAfter: defaultRetryIntervalOnBusy}, errors.Wrap(err, "internet Lan not available (yet)")
return &reconcile.Result{RequeueAfter: defaultRetryIntervalOnBusy}, errors.New("internet Lan not available (yet)")
}

conditions.MarkTrue(ctx.IONOSCloudCluster, v1alpha1.InternetLanCreatedCondition)
Expand Down

0 comments on commit 7d98a9d

Please sign in to comment.