From f086279a239a4f823d1f5df1bc8d4a668b1e37d9 Mon Sep 17 00:00:00 2001 From: David Shrewsbury Date: Thu, 22 Oct 2015 11:52:28 -0400 Subject: [PATCH] Fix for routers without external interfaces --- lib/ansible/modules/cloud/openstack/os_router.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/ansible/modules/cloud/openstack/os_router.py b/lib/ansible/modules/cloud/openstack/os_router.py index e5eb9bdc987..d8d547f5f1f 100644 --- a/lib/ansible/modules/cloud/openstack/os_router.py +++ b/lib/ansible/modules/cloud/openstack/os_router.py @@ -164,10 +164,13 @@ def _needs_update(cloud, module, router, network, internal_subnet_ids): """ if router['admin_state_up'] != module.params['admin_state_up']: return True - if router['external_gateway_info'].get('enable_snat', True) != module.params['enable_snat']: - return True + if router['external_gateway_info']: + if router['external_gateway_info'].get('enable_snat', True) != module.params['enable_snat']: + return True if network: - if router['external_gateway_info']['network_id'] != network['id']: + if not router['external_gateway_info']: + return True + elif router['external_gateway_info']['network_id'] != network['id']: return True # check external interfaces