Skip to content

Commit f3f2959

Browse files
committed
Fix potential panic during instance create
The `FailedCreateServer` event was mistakenly calling the `Name()` method on the createdInstance instance, that could very well be unitialized since creation failed. Instead, log the event using the named passed in the instance spec.
1 parent 3707a7c commit f3f2959

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/cloud/services/compute/instance.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ func (s *Service) createInstanceImpl(eventObject runtime.Object, openStackCluste
348348
return createdInstance.State() == infrav1.InstanceStateActive, nil
349349
})
350350
if err != nil {
351-
record.Warnf(eventObject, "FailedCreateServer", "Failed to create server %s: %v", createdInstance.Name(), err)
351+
record.Warnf(eventObject, "FailedCreateServer", "Failed to create server %s: %v", instanceSpec.Name, err)
352352
return nil, err
353353
}
354354

0 commit comments

Comments
 (0)