[stable-2.5] sort the port list properly (.sort() returns None) (#41603)

(cherry picked from commit 63f2ad8776)

Co-authored-by: schp <schonhofen@gmail.com>
This commit is contained in:
Toshio Kuratomi 2018-07-03 11:50:36 -07:00 committed by Matt Davis
parent b9b1a65067
commit f56197df94

View file

@ -310,7 +310,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.get('ports', []).sort())
return sorted(allowed_by_protocol, key=lambda y: sorted(y.get('ports', [])))
def main():