Merge "AdminUtils: Fix crash in nsx-v router-recreate"

This commit is contained in:
Jenkins 2017-05-14 15:11:41 +00:00 committed by Gerrit Code Review
commit f453e5c5f5

View File

@ -59,10 +59,10 @@ def delete_old_edge(context, old_edge_id):
def _get_router_az_from_plugin_router(router): def _get_router_az_from_plugin_router(router):
# If the router edge was already deployed the availability_zones will # If the router edge was already deployed the availability_zones will
# return the az # return the az
az_name = router['availability_zones'][0] az_name = router.get('availability_zones', [''])[0]
if not az_name: if not az_name:
# If it was not deployed - it may be in the creation hints # If it was not deployed - it may be in the creation hints
az_name = router['availability_zones_hints'][0] az_name = router.get('availability_zones_hints', [''])[0]
if not az_name: if not az_name:
# If not - the default az was used. # If not - the default az was used.
az_name = nsx_az.DEFAULT_NAME az_name = nsx_az.DEFAULT_NAME