summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRabi Mishra <ramishra@redhat.com>2016-01-21 13:32:21 +0530
committerRabi Mishra <ramishra@redhat.com>2016-01-26 10:04:13 +0530
commit793809b960fbe285dbbf26b723b2a52f5b9b3cff (patch)
tree29e20f7211f79d8e560ade54527c83ccd3957b5a
parentf32bddcd12cd0c9e56f1daeb4519f610f729d2f7 (diff)
downloadheat-793809b960fbe285dbbf26b723b2a52f5b9b3cff.tar.gz
Ignore ValueError when adding dependencies
When adding dependencies, we can ignore ValueError. Change-Id: Iaca3d364d0f68f50eb3ce5243b5aa33cc54072e6 Closes-Bug: #1536515 (cherry picked from commit 0c0c497a330ebbfd5703b1677ca07141da199adb)
-rwxr-xr-xheat/engine/stack.py5
-rw-r--r--heat/tests/test_resource.py16
2 files changed, 20 insertions, 1 deletions
diff --git a/heat/engine/stack.py b/heat/engine/stack.py
index 225dbbdee..98d449851 100755
--- a/heat/engine/stack.py
+++ b/heat/engine/stack.py
@@ -329,7 +329,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
diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py
index ab4052caf..8ed38ed20 100644
--- a/heat/tests/test_resource.py
+++ b/heat/tests/test_resource.py
@@ -1282,6 +1282,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',