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: error when updating IPv6 Primary IP #215

Merged
merged 1 commit into from Nov 10, 2022

Conversation

apricote
Copy link
Member

@apricote apricote commented Nov 10, 2022

The API returns a CIDR range in the ip field for ipv6 primary IPs. This caused the PrimaryIPClient.Update call to fail, because the response was parsed as a net.IP, but should have been parsed using net.ParseNetwork.

The required logic was already implemented in the PrimaryIPFromSchema function, but not used for the update call.

With this commit, the struct hcloud.PrimaryIPUpdateResult is removed, because using it to parse the response causes the error and it was never returned from any of our methods, so consumers should not be using it.

This error was originally found in hcloud-cli, and caused following error message:

➜  ~ hcloud primary-ip update --auto-delete=false test-ip
hcloud: updating Primary IP test-ip failed: invalid IP address: 2001:db8::/64

@apricote apricote added the Bug label Nov 10, 2022
@apricote apricote self-assigned this Nov 10, 2022
The API returns a CIDR range in the `ip` field for ipv6 primary IPs. This
caused the `PrimaryIPClient.Update` call to fail, because the response
was parsed as a `net.IP`, but should have been parsed using `net.ParseNetwork`.

The required logic was already implemented in the `PrimaryIPFromSchema`
function, but not used for the update call.

With this commit, the struct `hcloud.PrimaryIPUpdateResult` is removed,
because using it to parse the response causes the error and it was never
returned from any of our methods, so consumers should not be using it.

This error was originally found in hcloud-cli, and caused following error
message:

    ➜  ~ hcloud primary-ip update --auto-delete=false test-ip
    hcloud: updating Primary IP test-ip failed: invalid IP address: 2001:db8::/64
@LKaemmerling LKaemmerling merged commit b17da22 into main Nov 10, 2022
@LKaemmerling LKaemmerling deleted the fix-primary-ip-v6-update branch November 10, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants