mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 13:20:23 -07:00
Fixed issue in gce_net with firewall rules that have protocols that d… (#20528)
* Fixed issue in gce_net with firewall rules that have protocols that do not have ports. * Fixed elif in gce_net to include check of the ports variable.
This commit is contained in:
parent
c2edc8a264
commit
0e7dd18650
1 changed files with 2 additions and 2 deletions
|
@ -208,7 +208,7 @@ def format_allowed_section(allowed):
|
||||||
return []
|
return []
|
||||||
if ports.count(","):
|
if ports.count(","):
|
||||||
ports = ports.split(",")
|
ports = ports.split(",")
|
||||||
else:
|
elif ports:
|
||||||
ports = [ports]
|
ports = [ports]
|
||||||
return_val = {"IPProtocol": protocol}
|
return_val = {"IPProtocol": protocol}
|
||||||
if ports:
|
if ports:
|
||||||
|
@ -231,7 +231,7 @@ def sorted_allowed_list(allowed_list):
|
||||||
# sort by protocol
|
# sort by protocol
|
||||||
allowed_by_protocol = sorted(allowed_list,key=lambda x: x['IPProtocol'])
|
allowed_by_protocol = sorted(allowed_list,key=lambda x: x['IPProtocol'])
|
||||||
# sort the ports list
|
# sort the ports list
|
||||||
return sorted(allowed_by_protocol, key=lambda y: y['ports'].sort())
|
return sorted(allowed_by_protocol, key=lambda y: y.get('ports', []).sort())
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue