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

firewall: Add empty slices for respective direction instead of nil-slices #324

Conversation

tomsiewert
Copy link
Member

@tomsiewert tomsiewert commented May 13, 2021

As reported in #320, firewall rules can not be deleted because they
would not exist even if they are shown in "firewall describe".
This behaviour was correct because reflect.DeepEqual also compares if a
slice is empty or nil.
The slices DestinationIPs and SourceIPs are empty slices in an existing
firewall rule. However, the temporary FirewallRule object had slices
that were nil.

To fix this problem, the simple solution is to create an empty IPNet slice
for the respective direction (DestinationIPs for the direction "in", and
SourceIPs for the direction "out").

Signed-off-by: Tom Siewert [email protected]

@tomsiewert tomsiewert changed the title firewall: Add empty slices for specific direction instead of nil-slices firewall: Add empty slices for respective direction instead of nil-slices May 13, 2021
…ices

As reported in hetznercloud#320, firewall rules can not be deleted because they
would not exist even if they are shown in "firewall describe".
This behaviour was correct because reflect.DeepEqual also compares if a
slice is empty or nil.
The slices DestinationIPs and SourceIPs are empty slices in an existing
firewall rule. However, the temporary FirewallRule object had slices
that were nil.

To fix this problem, the simple solution is to create an empty IPNet slice
for the respective direction (DestinationIPs for the direction "in", and
SourceIPs for the direction "out").

Signed-off-by: Tom Siewert <[email protected]>
@tomsiewert tomsiewert force-pushed the fix/firewall-delete-rule-nil-slice-comparison branch from ec09644 to 811774d Compare May 13, 2021 15:15
@LKaemmerling LKaemmerling merged commit 8d0f07e into hetznercloud:master May 17, 2021
@tomsiewert tomsiewert deleted the fix/firewall-delete-rule-nil-slice-comparison branch May 17, 2021 11:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants