summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-02-26 02:33:40 +0000
committerGerrit Code Review <review@openstack.org>2016-02-26 02:33:41 +0000
commit6e0b68b606ee90b961d402f34ff14d739298a334 (patch)
tree70ea7c0c7f86259d22486bbaf7196afc8df66e7f /contrib
parentfb3ad4983f205e19b73ce7f87f2d3e0d52c5652b (diff)
parentc202c4447bbd02dbcdb5dac258ac8ff90414a203 (diff)
downloadheat-6e0b68b606ee90b961d402f34ff14d739298a334.tar.gz
Merge "Make AutoScale sub-template a string instead of map"
Diffstat (limited to 'contrib')
-rw-r--r--contrib/rackspace/rackspace/resources/auto_scale.py6
-rw-r--r--contrib/rackspace/rackspace/tests/test_auto_scale.py142
2 files changed, 75 insertions, 73 deletions
diff --git a/contrib/rackspace/rackspace/resources/auto_scale.py b/contrib/rackspace/rackspace/resources/auto_scale.py
index 86cafed14..339a79b95 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 f86cc28c4..8a709cb73 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'},