diff --git a/contrib/rackspace/rackspace/resources/auto_scale.py b/contrib/rackspace/rackspace/resources/auto_scale.py index 86cafed14a..339a79b95a 100644 --- a/contrib/rackspace/rackspace/resources/auto_scale.py +++ b/contrib/rackspace/rackspace/resources/auto_scale.py @@ -18,6 +18,7 @@ import six from heat.common import exception from heat.common.i18n import _ +from heat.common import template_format from heat.engine import attributes from heat.engine import constraints from heat.engine import properties @@ -243,7 +244,7 @@ class Group(resource.Resource): 'directly passed to Heat when creating a stack.'), schema={ LAUNCH_CONFIG_ARGS_STACK_TEMPLATE: properties.Schema( - properties.Schema.MAP, + properties.Schema.STRING, _('The template that describes the stack. Either the ' 'template or template_url property must be specified.'), ), @@ -533,7 +534,8 @@ class Group(resource.Resource): if st_tmpl: st_files = st_args.get(self.LAUNCH_CONFIG_ARGS_STACK_FILES) try: - templatem.Template(st_tmpl, files=st_files, env=st_env) + tmpl = template_format.simple_parse(st_tmpl) + templatem.Template(tmpl, files=st_files, env=st_env) except Exception as exc: msg = (_('Encountered error while loading template: %s') % six.text_type(exc)) diff --git a/contrib/rackspace/rackspace/tests/test_auto_scale.py b/contrib/rackspace/rackspace/tests/test_auto_scale.py index f86cc28c42..8a709cb73e 100644 --- a/contrib/rackspace/rackspace/tests/test_auto_scale.py +++ b/contrib/rackspace/rackspace/tests/test_auto_scale.py @@ -232,7 +232,7 @@ class ScalingGroupTest(common.HeatTestCase): type: launch_stack args: stack: - template: + template: | heat_template_version: 2015-10-15 description: This is a Heat template parameters: @@ -336,20 +336,20 @@ class ScalingGroupTest(common.HeatTestCase): 'group_metadata': {'group': 'metadata'}, 'name': 'My Group', 'launch_config_type': u'launch_stack', - 'template': { - 'heat_template_version': '2015-10-15', - 'description': 'This is a Heat template', - 'parameters': { - 'flavor': { - 'default': 'm1.tiny', - 'type': 'string'}, - 'image': { - 'default': 'cirros-0.3.4-x86_64-uec', - 'type': 'string'}}, - 'resources': { - 'rand': {'type': u'OS::Heat::RandomString'} - } - }, + 'template': ( + '''heat_template_version: 2015-10-15 +description: This is a Heat template +parameters: + image: + default: cirros-0.3.4-x86_64-uec + type: string + flavor: + default: m1.tiny + type: string +resources: + rand: + type: OS::Heat::RandomString +'''), 'template_url': None, 'disable_rollback': False, 'environment': { @@ -931,20 +931,20 @@ class AutoScaleGroupValidationTests(common.HeatTestCase): "type": "launch_stack", "args": { "stack": { - 'template': { - 'heat_template_version': '2015-10-15', - 'description': 'This is a Heat template', - 'parameters': { - 'flavor': { - 'default': 'm1.tiny', - 'type': 'string'}, - 'image': { - 'default': 'cirros-0.3.4-x86_64-uec', - 'type': 'string'}}, - 'resources': { - 'rand': {'type': u'OS::Heat::RandomString'} - } - }, + 'template': ( + '''heat_template_version: 2015-10-15 +description: This is a Heat template +parameters: + image: + default: cirros-0.3.4-x86_64-uec + type: string + flavor: + default: m1.tiny + type: string +resources: + rand: + type: OS::Heat::RandomString +'''), 'template_url': None, 'disable_rollback': False, 'environment': { @@ -995,20 +995,20 @@ class AutoScaleGroupValidationTests(common.HeatTestCase): "imageRef": "image-ref", }, "stack": { - 'template': { - 'heat_template_version': '2015-10-15', - 'description': 'This is a Heat template', - 'parameters': { - 'flavor': { - 'default': 'm1.tiny', - 'type': 'string'}, - 'image': { - 'default': 'cirros-0.3.4-x86_64-uec', - 'type': 'string'}}, - 'resources': { - 'rand': {'type': u'OS::Heat::RandomString'} - } - }, + 'template': ( + '''heat_template_version: 2015-10-15 +description: This is a Heat template +parameters: + image: + default: cirros-0.3.4-x86_64-uec + type: string + flavor: + default: m1.tiny + type: string +resources: + rand: + type: OS::Heat::RandomString +'''), 'template_url': None, 'disable_rollback': False, 'environment': { @@ -1086,20 +1086,20 @@ class AutoScaleGroupValidationTests(common.HeatTestCase): "type": "launch_server", "args": { "stack": { - 'template': { - 'heat_template_version': '2015-10-15', - 'description': 'This is a Heat template', - 'parameters': { - 'flavor': { - 'default': 'm1.tiny', - 'type': 'string'}, - 'image': { - 'default': 'cirros-0.3.4-x86_64-uec', - 'type': 'string'}}, - 'resources': { - 'rand': {'type': 'OS::Heat::RandomString'} - } - }, + 'template': ( + '''heat_template_version: 2015-10-15 +description: This is a Heat template +parameters: + image: + default: cirros-0.3.4-x86_64-uec + type: string + flavor: + default: m1.tiny + type: string +resources: + rand: + type: OS::Heat::RandomString +'''), 'template_url': 'https://myhost.com/template.yaml', } } @@ -1179,20 +1179,20 @@ class AutoScaleGroupValidationTests(common.HeatTestCase): "type": "launch_stack", "args": { "stack": { - 'template': { - 'SJDADKJAJKLSheat_template_version': '2015-10-15', - 'description': 'This is a Heat template', - 'parameters': { - 'flavor': { - 'default': 'm1.tiny', - 'type': 'string'}, - 'image': { - 'default': 'cirros-0.3.4-x86_64-uec', - 'type': 'string'}}, - 'resources': { - 'rand': {'type': u'OS::Heat::RandomString'} - } - }, + 'template': ( + '''SJDADKJAJKLSheat_template_version: 2015-10-15 +description: This is a Heat template +parameters: + image: + default: cirros-0.3.4-x86_64-uec + type: string + flavor: + default: m1.tiny + type: string +resources: + rand: + type: OS::Heat::RandomString +'''), 'template_url': None, 'disable_rollback': False, 'environment': {'Foo': 'Bar'},