Skip to content
Permalink
Browse files

fix: remove early return in deletion check

  • Loading branch information...
rudoi committed Aug 21, 2019
1 parent 801b1c1 commit 40032fb4118e07da2cb564e49d632c9b4b73aa68
Showing with 4 additions and 7 deletions.
  1. +4 −7 controllers/machine_controller.go
@@ -250,17 +250,14 @@ func (r *MachineReconciler) getMachinesInCluster(ctx context.Context, namespace,
// isDeleteReady returns an error if any of Boostrap.ConfigRef or InfrastructureRef referenced objects still exist.
func (r *MachineReconciler) isDeleteReady(ctx context.Context, m *clusterv1.Machine) error {
if m.Spec.Bootstrap.ConfigRef != nil {
_, err := external.Get(r.Client, m.Spec.Bootstrap.ConfigRef, m.Namespace)
if apierrors.IsNotFound(err) {
return nil
}
if err != nil {
if _, err := external.Get(r.Client, m.Spec.Bootstrap.ConfigRef, m.Namespace); err != nil && !apierrors.IsNotFound(err) {
return errors.Wrapf(err, "failed to get %s %q for Machine %q in namespace %q",
path.Join(m.Spec.Bootstrap.ConfigRef.APIVersion, m.Spec.Bootstrap.ConfigRef.Kind),
m.Spec.Bootstrap.ConfigRef.Name, m.Name, m.Namespace)
} else if err == nil {
return errors.Wrapf(&capierrors.RequeueAfterError{RequeueAfter: 10 * time.Second},
"delete is not ready, Bootstrap configuration still exists")
}
return errors.Wrapf(&capierrors.RequeueAfterError{RequeueAfter: 10 * time.Second},
"delete is not ready, Bootstrap configuration still exists")
}

if _, err := external.Get(r.Client, &m.Spec.InfrastructureRef, m.Namespace); err != nil && !apierrors.IsNotFound(err) {

0 comments on commit 40032fb

Please sign in to comment.
You can’t perform that action at this time.