Skip to content

Commit 362de71

Browse files
committed
Remove dependence on annotation to allow Server deletion
If a failure happened while handling the Machine creation, the Machine can end up without an openstack-resourceId annotation. This makes the deletion of the Machine to fail as no Server ID was specified in the annotation. This commit fixes the issue by making the deletion rely on the Server ID retrieved prior to delete instead of using the annotation. Co-authored-by: Matthew Booth [email protected]
1 parent 84171b7 commit 362de71

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pkg/cloud/openstack/machine/actuator.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,7 @@ func (oc *OpenstackClient) Delete(ctx context.Context, machine *machinev1.Machin
303303
return nil
304304
}
305305

306-
id := machine.ObjectMeta.Annotations[OpenstackIdAnnotationKey]
307-
err = machineService.InstanceDelete(id)
306+
err = machineService.InstanceDelete(instance.ID)
308307
if err != nil {
309308
return oc.handleMachineError(machine, apierrors.DeleteMachine(
310309
"error deleting Openstack instance: %v", err), deleteEventAction)

0 commit comments

Comments
 (0)