@@ -249,20 +249,18 @@ func (r *CloudStackMachineReconciliationRunner) GetOrCreateMachineStateChecker()
249
249
}
250
250
251
251
func (r * CloudStackMachineReconciliationRunner ) ReconcileDelete () (retRes ctrl.Result , reterr error ) {
252
- if r .ReconciliationSubject .Spec .InstanceID == nil {
253
- r .Log .Info ("VM Instance ID is nil" )
254
- return ctrl.Result {}, nil
255
- }
256
- r .Log .Info ("Deleting instance" , "instance-id" , r .ReconciliationSubject .Spec .InstanceID )
257
- // Use CSClient instead of CSUser here to expunge as admin.
258
- // The CloudStack-Go API does not return an error, but the VM won't delete with Expunge set if requested by
259
- // non-domain admin user.
260
- if err := r .CSClient .DestroyVMInstance (r .ReconciliationSubject ); err != nil {
261
- if err .Error () == "VM deletion in progress" {
262
- r .Log .Info (err .Error ())
263
- return ctrl.Result {RequeueAfter : utils .DestoryVMRequeueInterval }, nil
252
+ if r .ReconciliationSubject .Spec .InstanceID != nil {
253
+ r .Log .Info ("Deleting instance" , "instance-id" , r .ReconciliationSubject .Spec .InstanceID )
254
+ // Use CSClient instead of CSUser here to expunge as admin.
255
+ // The CloudStack-Go API does not return an error, but the VM won't delete with Expunge set if requested by
256
+ // non-domain admin user.
257
+ if err := r .CSClient .DestroyVMInstance (r .ReconciliationSubject ); err != nil {
258
+ if err .Error () == "VM deletion in progress" {
259
+ r .Log .Info (err .Error ())
260
+ return ctrl.Result {RequeueAfter : utils .DestoryVMRequeueInterval }, nil
261
+ }
262
+ return ctrl.Result {}, err
264
263
}
265
- return ctrl.Result {}, err
266
264
}
267
265
r .Log .Info ("VM Deleted" )
268
266
controllerutil .RemoveFinalizer (r .ReconciliationSubject , infrav1 .MachineFinalizer )
0 commit comments