self.assertIn(res, graph)
self.assertIn(stack['foo'], graph[res])
+ def test_hot_ref(self):
+ '''Test that HOT get_resource creates dependencies.'''
+ tmpl = template.Template({
+ 'heat_template_version': '2013-05-23',
+ 'resources': {
+ 'foo': {'type': 'GenericResourceType'},
+ 'bar': {
+ 'type': 'ResourceWithPropsType',
+ 'properties': {
+ 'Foo': {'get_resource': 'foo'},
+ }
+ }
+ }
+ })
+ stack = parser.Stack(None, 'test', tmpl)
+
+ res = stack['bar']
+ res.add_dependencies(self.deps)
+ graph = self.deps.graph()
+
+ self.assertIn(res, graph)
+ self.assertIn(stack['foo'], graph[res])
+
def test_ref_nested_dict(self):
tmpl = template.Template({
'Resources': {
self.assertIn(res, graph)
self.assertIn(stack['foo'], graph[res])
+ def test_hot_ref_nested_dict(self):
+ tmpl = template.Template({
+ 'heat_template_version': '2013-05-23',
+ 'resources': {
+ 'foo': {'type': 'GenericResourceType'},
+ 'bar': {
+ 'type': 'ResourceWithPropsType',
+ 'properties': {
+ 'Foo': {'Fn::Base64': {'get_resource': 'foo'}},
+ }
+ }
+ }
+ })
+ stack = parser.Stack(None, 'test', tmpl)
+
+ res = stack['bar']
+ res.add_dependencies(self.deps)
+ graph = self.deps.graph()
+
+ self.assertIn(res, graph)
+ self.assertIn(stack['foo'], graph[res])
+
def test_ref_nested_deep(self):
tmpl = template.Template({
'Resources': {
self.assertIn(res, graph)
self.assertIn(stack['foo'], graph[res])
+ def test_hot_ref_nested_deep(self):
+ tmpl = template.Template({
+ 'heat_template_version': '2013-05-23',
+ 'resources': {
+ 'foo': {'type': 'GenericResourceType'},
+ 'bar': {
+ 'type': 'ResourceWithPropsType',
+ 'properties': {
+ 'foo': {'Fn::Join': [",", ["blarg",
+ {'get_resource': 'foo'},
+ "wibble"]]},
+ }
+ }
+ }
+ })
+ stack = parser.Stack(None, 'test', tmpl)
+
+ res = stack['bar']
+ res.add_dependencies(self.deps)
+ graph = self.deps.graph()
+
+ self.assertIn(res, graph)
+ self.assertIn(stack['foo'], graph[res])
+
def test_ref_fail(self):
tmpl = template.Template({
'Resources': {
None, 'test', tmpl)
self.assertIn('"baz" (in bar.Properties.Foo)', str(ex))
+ def test_hot_ref_fail(self):
+ tmpl = template.Template({
+ 'heat_template_version': '2013-05-23',
+ 'resources': {
+ 'foo': {'type': 'GenericResourceType'},
+ 'bar': {
+ 'type': 'ResourceWithPropsType',
+ 'properties': {
+ 'Foo': {'get_resource': 'baz'},
+ }
+ }
+ }
+ })
+ ex = self.assertRaises(exception.InvalidTemplateReference,
+ parser.Stack,
+ None, 'test', tmpl)
+ self.assertIn('"baz" (in bar.Properties.Foo)', str(ex))
+
def test_getatt(self):
tmpl = template.Template({
'Resources': {
self.assertIn(res, graph)
self.assertIn(stack['foo'], graph[res])
+ def test_hot_getatt(self):
+ tmpl = template.Template({
+ 'heat_template_version': '2013-05-23',
+ 'resources': {
+ 'foo': {'type': 'GenericResourceType'},
+ 'bar': {
+ 'type': 'ResourceWithPropsType',
+ 'Properties': {
+ 'Foo': {'get_attr': ['foo', 'bar']},
+ }
+ }
+ }
+ })
+ stack = parser.Stack(None, 'test', tmpl)
+
+ res = stack['bar']
+ res.add_dependencies(self.deps)
+ graph = self.deps.graph()
+
+ self.assertIn(res, graph)
+ self.assertIn(stack['foo'], graph[res])
+
def test_getatt_nested_dict(self):
tmpl = template.Template({
'Resources': {
self.assertIn(res, graph)
self.assertIn(stack['foo'], graph[res])
+ def test_hot_getatt_nested_dict(self):
+ tmpl = template.Template({
+ 'heat_template_version': '2013-05-23',
+ 'resources': {
+ 'foo': {'type': 'GenericResourceType'},
+ 'bar': {
+ 'type': 'ResourceWithPropsType',
+ 'properties': {
+ 'Foo': {'Fn::Base64': {'get_attr': ['foo', 'bar']}},
+ }
+ }
+ }
+ })
+ stack = parser.Stack(None, 'test', tmpl)
+
+ res = stack['bar']
+ res.add_dependencies(self.deps)
+ graph = self.deps.graph()
+
+ self.assertIn(res, graph)
+ self.assertIn(stack['foo'], graph[res])
+
def test_getatt_nested_deep(self):
tmpl = template.Template({
'Resources': {
self.assertIn(res, graph)
self.assertIn(stack['foo'], graph[res])
+ def test_hot_getatt_nested_deep(self):
+ tmpl = template.Template({
+ 'heat_template_version': '2013-05-23',
+ 'resources': {
+ 'foo': {'type': 'GenericResourceType'},
+ 'bar': {
+ 'type': 'ResourceWithPropsType',
+ 'properties': {
+ 'Foo': {'Fn::Join': [",", ["blarg",
+ {'get_attr': ['foo',
+ 'bar']},
+ "wibble"]]},
+ }
+ }
+ }
+ })
+ stack = parser.Stack(None, 'test', tmpl)
+
+ res = stack['bar']
+ res.add_dependencies(self.deps)
+ graph = self.deps.graph()
+
+ self.assertIn(res, graph)
+ self.assertIn(stack['foo'], graph[res])
+
def test_getatt_fail(self):
tmpl = template.Template({
'Resources': {
None, 'test', tmpl)
self.assertIn('"baz" (in bar.Properties.Foo)', str(ex))
+ def test_hot_getatt_fail(self):
+ tmpl = template.Template({
+ 'heat_template_version': '2013-05-23',
+ 'resources': {
+ 'foo': {'type': 'GenericResourceType'},
+ 'bar': {
+ 'type': 'ResourceWithPropsType',
+ 'properties': {
+ 'Foo': {'get_attr': ['baz', 'bar']},
+ }
+ }
+ }
+ })
+ ex = self.assertRaises(exception.InvalidTemplateReference,
+ parser.Stack,
+ None, 'test', tmpl)
+ self.assertIn('"baz" (in bar.Properties.Foo)', str(ex))
+
def test_getatt_fail_nested_deep(self):
tmpl = template.Template({
'Resources': {
None, 'test', tmpl)
self.assertIn('"baz" (in bar.Properties.Foo.Fn::Join[1][3])', str(ex))
+ def test_hot_getatt_fail_nested_deep(self):
+ tmpl = template.Template({
+ 'heat_template_version': '2013-05-23',
+ 'resources': {
+ 'foo': {'type': 'GenericResourceType'},
+ 'bar': {
+ 'type': 'ResourceWithPropsType',
+ 'properties': {
+ 'Foo': {'Fn::Join': [",", ["blarg",
+ {'get_attr': ['foo',
+ 'bar']},
+ "wibble",
+ {'get_attr': ['baz',
+ 'bar']}]]},
+ }
+ }
+ }
+ })
+ ex = self.assertRaises(exception.InvalidTemplateReference,
+ parser.Stack,
+ None, 'test', tmpl)
+ self.assertIn('"baz" (in bar.Properties.Foo.Fn::Join[1][3])', str(ex))
+
def test_dependson(self):
tmpl = template.Template({
'Resources': {