Ignore exceptions getting FloatingIP dependencies

When calculating the dependencies for a FloatingIP resource, we make
REST calls to Neutron. If this call fails then we will stop looking for
implicit dependencies for that resource. (Prior to the fix for bug
1554625, it would have broken the stack altogether.)

This change ignores any errors that occur while making the client call,
so that any other implicit dependencies can potentially still be
discovered.

Change-Id: Ic9220041e7bf85b4388ad283082833cfbdb6c76a
Story: #1442121
Task: 16622
This commit is contained in:
Zane Bitter 2017-07-31 12:30:15 -04:00
parent 7bb3587be1
commit 507bceabb1
1 changed files with 12 additions and 2 deletions

View File

@ -12,6 +12,8 @@
# under the License.
import six
from oslo_log import log as logging
from heat.common import exception
from heat.common.i18n import _
from heat.engine import attributes
@ -23,6 +25,8 @@ from heat.engine.resources.openstack.neutron import router
from heat.engine import support
from heat.engine import translation
LOG = logging.getLogger(__name__)
class FloatingIP(neutron.NeutronResource):
"""A resource for managing Neutron floating ips.
@ -217,8 +221,14 @@ class FloatingIP(neutron.NeutronResource):
p_net = (resource.properties.get(port.Port.NETWORK) or
resource.properties.get(port.Port.NETWORK_ID))
if p_net:
network = self.client().show_network(p_net)['network']
return subnet in network['subnets']
try:
network = self.client().show_network(p_net)['network']
return subnet in network['subnets']
except Exception as exc:
LOG.info("Ignoring Neutron error while "
"getting FloatingIP dependencies: %s",
six.text_type(exc))
return False
else:
for fixed_ip in resource.properties.get(
port.Port.FIXED_IPS):