GitHub user paulmibus opened a pull request:
https://github.com/apache/libcloud/pull/1245
Bug fixes for GCENodeDriver.ex_create_firewall()
Remove incorrect firewall direction check for allow/deny rules.
Only default source_ranges to 0.0.0.0/0 if direction is INGRESS.
## Changes Title (replace this with a logical title for your changes)
### Description
Fixed two small bugs in GCENodeDriver.ex_create_firewall().
The first issue was that a direction check was being applied to determine
whether allowed or denied would be passed to the GCE API call. Both ingress and
egress rules can have allowed or denied blocks so this shouldn't be conditional
on the direction.
The second issue was that source_ranges was automatically set to
[0.0.0.0/0] if no other source filters were applied. Since source filters are
invalid for egress rules, I added a check for the INGRESS direction prior to
setting a default source range.
### Status
done, ready for review
### Checklist (tick everything that applies)
- [ ] [Code
linting](http://libcloud.readthedocs.org/en/latest/development.html#code-style-guide)
(required, can be done after the PR checks)
- [ ] Documentation
- [ ] [Tests](http://libcloud.readthedocs.org/en/latest/testing.html)
- [ ]
[ICLA](http://libcloud.readthedocs.org/en/latest/development.html#contributing-bigger-changes)
(required for bigger changes)
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/paulmibus/libcloud gce_firewall_fix
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/libcloud/pull/1245.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1245
----
commit e976e75bcae1f1bb9f6e09b74957c43d5763cc01
Author: Paul Mibus <paulmibus@...>
Date: 2018-10-12T20:09:12Z
Remove incorrect firewall direction check for allow/deny rules.
Only default source_ranges to 0.0.0.0/0 if direction is INGRESS.
----
---