firewall: Add empty slices for respective direction instead of nil-slices #324
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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]