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 []
|
||||
if ports.count(","):
|
||||
ports = ports.split(",")
|
||||
else:
|
||||
elif ports:
|
||||
ports = [ports]
|
||||
return_val = {"IPProtocol": protocol}
|
||||
if ports:
|
||||
|
@ -231,7 +231,7 @@ def sorted_allowed_list(allowed_list):
|
|||
# sort by protocol
|
||||
allowed_by_protocol = sorted(allowed_list,key=lambda x: x['IPProtocol'])
|
||||
# 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():
|
||||
|
|
Loading…
Reference in a new issue