NSX|P: Fix Octavia pool create with no listener

Change-Id: I1235272bae70f027ef1782786964bb35a4a67930
This commit is contained in:
asarfaty 2021-03-08 12:43:29 +02:00 committed by Adit Sarfaty
parent 4b8432677d
commit b412b366fd
1 changed files with 3 additions and 2 deletions

View File

@ -114,7 +114,7 @@ class EdgePoolManagerFromDict(base_mgr.NsxpLoadbalancerBaseManager):
# NOTE(salv-orlando): Guard against accidental compat breakages # NOTE(salv-orlando): Guard against accidental compat breakages
try: try:
listener = pool['listener'] or pool['listeners'][0] listener = pool.get('listener') or pool.get('listeners', [])[0]
except IndexError: except IndexError:
# If listeners is an empty list we hit this exception # If listeners is an empty list we hit this exception
listener = None listener = None
@ -166,7 +166,8 @@ class EdgePoolManagerFromDict(base_mgr.NsxpLoadbalancerBaseManager):
description = new_pool['description'] description = new_pool['description']
# NOTE(salv-orlando): Guard against accidental compat breakages # NOTE(salv-orlando): Guard against accidental compat breakages
try: try:
listener = new_pool['listener'] or new_pool['listeners'][0] listener = (new_pool.get('listener') or
new_pool.get('listeners', [])[0])
except IndexError: except IndexError:
# If listeners is an empty list we hit this exception # If listeners is an empty list we hit this exception
listener = None listener = None