Merge "Ignore ValueError when adding dependencies"

This commit is contained in:
Jenkins 2016-01-21 13:22:35 +00:00 committed by Gerrit Code Review
commit bfe4ce7d92
2 changed files with 20 additions and 1 deletions

View File

@ -386,7 +386,10 @@ class Stack(collections.Mapping):
"""Return the dependency graph for a list of resources."""
deps = dependencies.Dependencies()
for res in resources:
res.add_dependencies(deps)
try:
res.add_dependencies(deps)
except ValueError:
pass
return deps

View File

@ -2343,6 +2343,22 @@ class ResourceDependenciesTest(common.HeatTestCase):
self.assertIn(res, graph)
def test_hot_add_dep_error(self):
tmpl = template.Template({
'heat_template_version': '2013-05-23',
'resources': {
'foo': {'type': 'GenericResourceType'},
'bar': {'type': 'ResourceWithPropsType'}
}
})
stack = parser.Stack(utils.dummy_context(), 'test', tmpl)
res = stack['bar']
self.patchobject(res, 'add_dependencies',
side_effect=ValueError)
graph = stack.dependencies.graph()
self.assertNotIn(res, graph)
self.assertIn(stack['foo'], graph)
def test_ref(self):
tmpl = template.Template({
'HeatTemplateFormatVersion': '2012-12-12',