Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle nil servers in InstanceV2 #398 #402

Merged
merged 1 commit into from
Mar 17, 2023
Merged

fix: handle nil servers in InstanceV2 #398 #402

merged 1 commit into from
Mar 17, 2023

Conversation

apricote
Copy link
Member

We did not properly handle nil pointers returned from lookupServer.

Based on the current usage in k/cloud-provider the methods are called in these contexts:

  • InstanceShutdown is only called for instances that actually do exist (as verified by a prior call to InstanceExists)
  • InstanceMetadata is called without verifying that the instance exists, one call site accepts a nil InstanceMetadata, but the other does not.
    Closes Issues if lookupServer() returns nil server #398

@apricote apricote added the bug Something isn't working label Mar 17, 2023
@apricote apricote requested a review from a team as a code owner March 17, 2023 10:31
@apricote apricote self-assigned this Mar 17, 2023
hcloud/instances.go Outdated Show resolved Hide resolved
We did not properly handle nil pointers returned from `lookupServer`.

Based on the current usage in `k/cloud-provider` the methods are called in these contexts:

- `InstanceShutdown` is only called for instances that actually do exist (as verified by a prior call to `InstanceExists`)
- `InstanceMetadata` is called without verifying that the instance exists, one call site accepts a nil InstanceMetadata, but the other does not.
@apricote apricote merged commit 784f13d into main Mar 17, 2023
@apricote apricote deleted the fix-nil-server branch March 17, 2023 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Issues if lookupServer() returns nil server
2 participants