Ignore ValueError when adding dependencies
When adding dependencies, we can ignore ValueError. Change-Id: Iaca3d364d0f68f50eb3ce5243b5aa33cc54072e6 Closes-Bug: #1536515
This commit is contained in:
parent
4c2f9ac308
commit
0c0c497a33
@ -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
|
||||
|
||||
|
@ -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',
|
||||
|
Loading…
Reference in New Issue
Block a user