]> review.fuel-infra Code Review - openstack-build/heat-build.git/commitdiff
Move template-format parsing code into common
authorZane Bitter <zbitter@redhat.com>
Fri, 30 Nov 2012 13:12:38 +0000 (14:12 +0100)
committerZane Bitter <zbitter@redhat.com>
Fri, 30 Nov 2012 16:05:13 +0000 (17:05 +0100)
This is used mostly by the API (but also the engine for composed
templates), so it doesn't belong in the engine package.

Change-Id: I79cf8cc619a6988013a58eb4d46c014c3dcac4a3
Signed-off-by: Zane Bitter <zbitter@redhat.com>
24 files changed:
heat/api/cfn/v1/stacks.py
heat/api/openstack/v1/stacks.py
heat/common/template_format.py [moved from heat/engine/format.py with 98% similarity]
heat/engine/parser.py
heat/engine/resources/dbinstance.py
heat/engine/resources/loadbalancer.py
heat/engine/resources/stack.py
heat/tests/functional/test_CFN_API_Actions.py
heat/tests/functional/util.py
heat/tests/test_autoscaling.py
heat/tests/test_dbinstance.py
heat/tests/test_eip.py
heat/tests/test_engine_service.py
heat/tests/test_instance.py
heat/tests/test_loadbalancer.py
heat/tests/test_parser.py
heat/tests/test_quantum.py
heat/tests/test_s3.py
heat/tests/test_template_format.py [moved from heat/tests/test_format.py with 89% similarity]
heat/tests/test_user.py
heat/tests/test_validate.py
heat/tests/test_volume.py
heat/tests/test_waitcondition.py
tools/cfn-json2yaml

index b7b0b5bc4f429e2a568ab019a06bf81407730772..99f1a7222d3252226477ef2ac91ad65055722026 100644 (file)
@@ -26,7 +26,7 @@ from heat.api.aws import exception
 from heat.api.aws import utils as api_utils
 from heat.common import wsgi
 from heat.engine import rpcapi as engine_rpcapi
-from heat.engine import format
+from heat.common import template_format
 import heat.engine.api as engine_api
 from heat.common import identifier
 
@@ -316,7 +316,7 @@ class StackController(object):
             return exception.HeatMissingParameterError(detail=msg)
 
         try:
-            stack = format.parse_to_template(templ)
+            stack = template_format.parse(templ)
         except ValueError:
             msg = _("The Template must be a JSON document.")
             return exception.HeatInvalidParameterValueError(detail=msg)
index 64a78fec037976994ff9136b9eaa132d656b48c2..e76f02e882c90800b14b1b536ed9e5e6176e9629 100644 (file)
@@ -26,7 +26,7 @@ from webob import exc
 
 from heat.api.openstack.v1 import util
 from heat.common import wsgi
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import api as engine_api
 from heat.engine import rpcapi as engine_rpcapi
 
@@ -65,7 +65,7 @@ class InstantiationData(object):
         """
 
         try:
-            return format.parse_to_template(data)
+            return template_format.parse(data)
         except ValueError:
             err_reason = "%s not in valid format" % data_type
             raise exc.HTTPBadRequest(explanation=err_reason)
similarity index 98%
rename from heat/engine/format.py
rename to heat/common/template_format.py
index 8647d677c1320f4183597fece70712dd0eada67b..7e120ded4c52b2c1856c9d5e1a92c30121dacc69 100644 (file)
@@ -29,7 +29,7 @@ yaml.Loader.add_constructor(u'tag:yaml.org,2002:str', _construct_yaml_str)
 yaml.SafeLoader.add_constructor(u'tag:yaml.org,2002:str', _construct_yaml_str)
 
 
-def parse_to_template(tmpl_str):
+def parse(tmpl_str):
     '''
     Takes a string and returns a dict containing the parsed structure.
     This includes determination of whether the string is using the
index 2244ece564d7be3e06bc9e764e6680bde511fd86..10d1dc93fd739442fe7f0aa1bb04969c78b41e5b 100644 (file)
@@ -430,7 +430,7 @@ def resolve_static_data(template, parameters, snippet):
 
     Example:
 
-    >>> template = Template(format.parse_to_template(template_path))
+    >>> template = Template(template_format.parse(template_path))
     >>> parameters = Parameters('stack', template, {'KeyName': 'my_key'})
     >>> resolve_static_data(template, parameters, {'Ref': 'KeyName'})
     'my_key'
index f8acebc58e61b040627e8f2d0d193e9cfd3899fc..bb5c2b2277c4070dc112c69a317c228361ca8bad 100644 (file)
@@ -15,7 +15,7 @@
 
 from heat.common import exception
 from heat.engine.resources import stack
-from heat.engine import format
+from heat.common import template_format
 from heat.openstack.common import log as logging
 
 logger = logging.getLogger(__file__)
@@ -219,7 +219,7 @@ class DBInstance(stack.Stack):
         return p
 
     def handle_create(self):
-        templ = format.parse_to_template(mysql_template)
+        templ = template_format.parse(mysql_template)
         self.create_with_template(templ)
 
     def FnGetAtt(self, key):
index dd8950b20bb065ff65d77706f75b0793a4381360..9dd8c145c4cb59c89691c11ea31cad0d073479de 100644 (file)
@@ -14,7 +14,7 @@
 #    under the License.
 
 from heat.common import exception
-from heat.engine import format
+from heat.common import template_format
 from heat.engine.resources import stack
 from novaclient.exceptions import NotFound
 
@@ -283,7 +283,7 @@ class LoadBalancer(stack.Stack):
         return '%s%s%s%s\n' % (gl, frontend, backend, '\n'.join(servers))
 
     def handle_create(self):
-        templ = format.parse_to_template(lb_template)
+        templ = template_format.parse(lb_template)
 
         if self.properties['Instances']:
             md = templ['Resources']['LB_instance']['Metadata']
@@ -313,7 +313,7 @@ class LoadBalancer(stack.Stack):
         save it to the db.
         rely on the cfn-hup to reconfigure HAProxy
         '''
-        templ = format.parse_to_template(lb_template)
+        templ = template_format.parse(lb_template)
         cfg = self._haproxy_config(templ, inst_list)
 
         md = self.nested()['LB_instance'].metadata
index 87ebf72c42b246758a25956d9d608a7a58c4024a..cb1e4c26e26b258161422f4b79d997a5dedfe8bd 100644 (file)
@@ -17,7 +17,7 @@ import urllib2
 import json
 
 from heat.common import exception
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import resource
 from heat.engine import parser
 
@@ -76,7 +76,7 @@ class Stack(resource.Resource):
 
     def handle_create(self):
         response = urllib2.urlopen(self.properties[PROP_TEMPLATE_URL])
-        template = format.parse_to_template(response)
+        template = template_format.parse(response)
 
         self.create_with_template(template)
 
index e2593348e64b06f9549b18c97f91d69f29309ddc..a8441bce585f963964d43e33739cd622e1056924 100644 (file)
@@ -21,7 +21,7 @@ from nose.plugins.attrib import attr
 import unittest
 import json
 
-from heat.engine import format
+from heat.common import template_format
 
 
 @attr(speed='slow')
@@ -282,7 +282,7 @@ class CfnApiFunctionalTest(unittest.TestCase):
         # Extract the JSON TemplateBody and prove it parses
         template = self.stack.response_xml_item(response, prefix,
                                                 "TemplateBody")
-        json_load = format.parse_to_template(template)
+        json_load = template_format.parse(template)
         self.assertTrue(json_load != None)
 
         # Then sanity check content - I guess we could diff
index 8d16220c828d2c1e9cd54549baec26c84ea832fb..3a12d0513f9135f8570fc2a894d6623b8ba6a594 100644 (file)
@@ -41,7 +41,7 @@ except ImportError:
 from novaclient.v1_1 import client as nova_client
 import heat
 from heat import utils
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import parser
 from heat import client as heat_client
 from heat import boto_client as heat_client_boto
@@ -249,7 +249,7 @@ class Instance(object):
 #        time.sleep(1)  # necessary for sendall to complete
 
         f = open(basepath + '/templates/' + template_file)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
 
         template = parser.Template(t)
index fe9df09cd694ca515bc55935b0d11c65f95a26cd..a8c5c9fecdbd68f3000eefaa4136cf93a2666aa4 100644 (file)
@@ -24,7 +24,7 @@ import json
 from nose.plugins.attrib import attr
 
 from heat.common import context
-from heat.engine import format
+from heat.common import template_format
 from heat.engine.resources import autoscaling as asc
 from heat.engine.resources import loadbalancer
 from heat.engine import parser
@@ -45,7 +45,7 @@ class AutoScalingTest(unittest.TestCase):
         self.path = os.path.dirname(os.path.realpath(__file__)).\
             replace('heat/tests', 'templates')
         f = open("%s/AutoScalingMultiAZSample.template" % self.path)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
         return t
 
index f717194be73cf165be33730ebc240f330f0091ed..cdffbdabfab731e836c57c4cb838f93498d9038f 100644 (file)
@@ -25,7 +25,7 @@ from nose.plugins.attrib import attr
 
 from heat.common import context
 from heat.common import exception
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import parser
 from heat.engine.resources import stack
 from heat.engine.resources import dbinstance as dbi
@@ -47,7 +47,7 @@ class DBInstanceTest(unittest.TestCase):
         self.path = os.path.dirname(os.path.realpath(__file__)).\
             replace('heat/tests', 'templates')
         f = open("%s/WordPress_With_RDS.template" % self.path)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
         return t
 
index 41c64fc6933ab706cb95368a579f5c98e710a463..be64db16d7418dfe2df50def12a01e3b5b7c23f5 100644 (file)
@@ -24,7 +24,7 @@ import json
 from nose.plugins.attrib import attr
 
 from heat.common import context
-from heat.engine import format
+from heat.common import template_format
 from heat.engine.resources import eip
 from heat.engine import parser
 from heat.tests.v1_1 import fakes
@@ -48,7 +48,7 @@ class EIPTest(unittest.TestCase):
         self.path = os.path.dirname(os.path.realpath(__file__)).\
             replace('heat/tests', 'templates')
         f = open("%s/WordPress_Single_Instance_With_EIP.template" % self.path)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
         return t
 
index 5dcf7069b8f4ed3713c26edd8304cb001f323129..d4dbbcfa3b280e56753f6b151052944afcd99e2b 100644 (file)
@@ -27,7 +27,7 @@ from heat.common import context
 from heat.tests.v1_1 import fakes
 import heat.engine.api as engine_api
 import heat.db as db_api
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import parser
 from heat.engine import service
 from heat.engine.resources import instance as instances
@@ -55,7 +55,7 @@ def get_wordpress_stack(stack_name, ctx):
     tmpl_path = os.path.join(templates_dir,
                              'WordPress_Single_Instance_gold.template')
     with open(tmpl_path) as f:
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
 
     template = parser.Template(t)
     parameters = parser.Parameters(stack_name, template,
index fe52dfb018853b0d278826b17a450e2347b7787f..f3781adf057d95086dab9497fac4ff1d57874549 100644 (file)
@@ -28,7 +28,7 @@ from nose import with_setup
 from heat.tests.v1_1 import fakes
 from heat.engine.resources import instance as instances
 import heat.db as db_api
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import parser
 
 
@@ -47,7 +47,7 @@ class instancesTest(unittest.TestCase):
 
     def test_instance_create(self):
         f = open("%s/WordPress_Single_Instance_gold.template" % self.path)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
 
         template = parser.Template(t)
@@ -89,7 +89,7 @@ class instancesTest(unittest.TestCase):
 
     def test_instance_create_delete(self):
         f = open("%s/WordPress_Single_Instance_gold.template" % self.path)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
 
         template = parser.Template(t)
index ec179df5f32fafb734c683d5e96983f84b26d219..89deb9f139c78c0192a76a3ce85e5d78e11abf78 100644 (file)
@@ -27,7 +27,7 @@ from nose.plugins.attrib import attr
 from heat.common import exception
 from heat.common import context
 from heat.common import config
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import parser
 from heat.engine.resources import instance
 from heat.engine.resources import loadbalancer as lb
@@ -66,7 +66,7 @@ class LoadBalancerTest(unittest.TestCase):
         self.path = os.path.dirname(os.path.realpath(__file__)).\
             replace('heat/tests', 'templates')
         f = open("%s/WordPress_With_LB.template" % self.path)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
         return t
 
@@ -124,7 +124,7 @@ class LoadBalancerTest(unittest.TestCase):
 
         self.assertEqual('LoadBalancer', resource.FnGetRefId())
 
-        templ = format.parse_to_template(lb.lb_template)
+        templ = template_format.parse(lb.lb_template)
         ha_cfg = resource._haproxy_config(templ,
                                           resource.properties['Instances'])
         self.assertRegexpMatches(ha_cfg, 'bind \*:80')
index a0a95fbea877a6480231bbacf33f27b83e83d424..c4d68f7573493e2f5edba37f9977b26538201b96 100644 (file)
@@ -22,7 +22,7 @@ import sys
 
 from heat.common import context
 from heat.common import exception
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import parser
 from heat.engine import parameters
 from heat.engine import template
@@ -96,7 +96,7 @@ class ParserTest(unittest.TestCase):
         self.assertEqual(join(raw), 'foo bar\nbaz')
 
 
-mapping_template = format.parse_to_template('''{
+mapping_template = template_format.parse('''{
   "Mappings" : {
     "ValidMapping" : {
       "TestKey" : { "TestValue" : "wibble" }
index 7c20fb189bbe0e3f28bbdcbda3d7191f573000fb..37160fc2b74c7d7a1cdba16dda8423b463d0091d 100644 (file)
@@ -25,7 +25,7 @@ from nose.plugins.attrib import attr
 
 from heat.common import context
 from heat.common import exception
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import properties
 from heat.engine.resources.quantum import net
 from heat.engine.resources.quantum.quantum import QuantumResource as qr
@@ -82,7 +82,7 @@ class QuantumTest(unittest.TestCase):
         self.path = os.path.dirname(os.path.realpath(__file__)).\
             replace('heat/tests', 'templates')
         f = open("%s/Quantum.template" % self.path)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
         return t
 
index c884baa60c5e9af5e7fe70b8ae8c66c67c456175..0842ba9603a90afeb90b8423d7c17fcc4d725d6b 100644 (file)
@@ -25,7 +25,7 @@ import json
 from nose.plugins.attrib import attr
 
 from heat.common import context
-from heat.engine import format
+from heat.common import template_format
 from heat.engine.resources import s3
 from heat.engine import parser
 from utils import skip_if
@@ -59,7 +59,7 @@ class s3Test(unittest.TestCase):
         self.path = os.path.dirname(os.path.realpath(__file__)).\
             replace('heat/tests', 'templates')
         f = open("%s/S3_Single_Instance.template" % self.path)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
         return t
 
similarity index 89%
rename from heat/tests/test_format.py
rename to heat/tests/test_template_format.py
index 2308e98d104409d6682ae408132564f99fd10f8e..d89d04286553734fa646531f9a23b73aba557cb9 100644 (file)
@@ -22,7 +22,7 @@ import unittest
 import yaml
 
 from heat.common import context
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import parser
 
 
@@ -53,16 +53,16 @@ class JsonToYamlTest(unittest.TestCase):
             self.expected_test_count)
 
     def compare_json_vs_yaml(self, json_str, yml_str, file_name):
-        yml = format.parse_to_template(yml_str)
+        yml = template_format.parse(yml_str)
 
         self.assertEqual(u'2012-12-12', yml[u'HeatTemplateFormatVersion'],
             file_name)
         self.assertFalse(u'AWSTemplateFormatVersion' in yml, file_name)
         del(yml[u'HeatTemplateFormatVersion'])
 
-        jsn = format.parse_to_template(json_str)
-        format.default_for_missing(jsn, 'AWSTemplateFormatVersion',
-            format.CFN_VERSIONS)
+        jsn = template_format.parse(json_str)
+        template_format.default_for_missing(jsn, 'AWSTemplateFormatVersion',
+            template_format.CFN_VERSIONS)
 
         if u'AWSTemplateFormatVersion' in jsn:
             del(jsn[u'AWSTemplateFormatVersion'])
@@ -76,7 +76,7 @@ class JsonToYamlTest(unittest.TestCase):
             f = open(os.path.join(dirpath, path), 'r')
             json_str = f.read()
 
-            yml_str = format.convert_json_to_yaml(json_str)
+            yml_str = template_format.convert_json_to_yaml(json_str)
             yield (json_str, yml_str, f.name)
 
 
@@ -91,8 +91,8 @@ Mappings: {}
 Resources: {}
 Outputs: {}
 '''
-        tpl1 = format.parse_to_template(yaml1)
-        tpl2 = format.parse_to_template(yaml2)
+        tpl1 = template_format.parse(yaml1)
+        tpl2 = template_format.parse(yaml2)
         self.assertEqual(tpl1, tpl2)
 
 
@@ -107,7 +107,7 @@ class JsonYamlResolvedCompareTest(unittest.TestCase):
         self.path = os.path.dirname(os.path.realpath(__file__)).\
             replace('heat/tests', 'templates')
         f = open("%s/%s" % (self.path, file_name))
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
         return t
 
@@ -126,8 +126,8 @@ class JsonYamlResolvedCompareTest(unittest.TestCase):
 
     def compare_stacks(self, json_file, yaml_file, parameters):
         t1 = self.load_template(json_file)
-        format.default_for_missing(t1, 'AWSTemplateFormatVersion',
-            format.CFN_VERSIONS)
+        template_format.default_for_missing(t1, 'AWSTemplateFormatVersion',
+            template_format.CFN_VERSIONS)
         del(t1[u'AWSTemplateFormatVersion'])
 
         t2 = self.load_template(yaml_file)
index e6ca085179e498e8eff23f5cd32afa70dd3a85a5..69ca793b91f7d4edcfea9b7838e4f67c2add0d16 100644 (file)
@@ -27,7 +27,7 @@ from nose.plugins.attrib import attr
 from heat.common import context
 from heat.common import exception
 from heat.common import config
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import parser
 from heat.engine.resources import user
 from heat.tests import fakes
@@ -51,7 +51,7 @@ class UserTest(unittest.TestCase):
         self.path = os.path.dirname(os.path.realpath(__file__)).\
             replace('heat/tests', 'templates')
         f = open("%s/Rails_Single_Instance.template" % self.path)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
         return t
 
index 6cde6729ecd270bc49316df4d3d20f021647060b..280d2c09f817a4c7c5f5aaa801dad526af1f0aa9 100644 (file)
@@ -20,7 +20,7 @@ import json
 from nose.plugins.attrib import attr
 
 from heat.tests.v1_1 import fakes
-from heat.engine import format
+from heat.common import template_format
 from heat.engine.resources import instance as instances
 from heat.engine import service
 import heat.db as db_api
@@ -220,7 +220,7 @@ class validateTest(unittest.TestCase):
         print "volumeTest teardown complete"
 
     def test_validate_volumeattach_valid(self):
-        t = format.parse_to_template(test_template_volumeattach % 'vdq')
+        t = template_format.parse(test_template_volumeattach % 'vdq')
         stack = parser.Stack(None, 'test_stack', parser.Template(t))
 
         self.m.StubOutWithMock(db_api, 'resource_get_by_name_and_stack')
@@ -232,7 +232,7 @@ class validateTest(unittest.TestCase):
         self.assertTrue(volumeattach.validate() is None)
 
     def test_validate_volumeattach_invalid(self):
-        t = format.parse_to_template(test_template_volumeattach % 'sda')
+        t = template_format.parse(test_template_volumeattach % 'sda')
         stack = parser.Stack(None, 'test_stack', parser.Template(t))
 
         self.m.StubOutWithMock(db_api, 'resource_get_by_name_and_stack')
@@ -244,7 +244,7 @@ class validateTest(unittest.TestCase):
         self.assertTrue(volumeattach.validate())
 
     def test_validate_ref_valid(self):
-        t = format.parse_to_template(test_template_ref % 'WikiDatabase')
+        t = template_format.parse(test_template_ref % 'WikiDatabase')
 
         self.m.StubOutWithMock(instances.Instance, 'nova')
         instances.Instance.nova().AndReturn(self.fc)
@@ -257,7 +257,7 @@ class validateTest(unittest.TestCase):
         self.assertEqual(res['Description'], 'test.')
 
     def test_validate_ref_invalid(self):
-        t = format.parse_to_template(test_template_ref % 'WikiDatabasez')
+        t = template_format.parse(test_template_ref % 'WikiDatabasez')
 
         self.m.StubOutWithMock(instances.Instance, 'nova')
         instances.Instance.nova().AndReturn(self.fc)
@@ -269,7 +269,7 @@ class validateTest(unittest.TestCase):
         self.assertNotEqual(res['Description'], 'Successfully validated')
 
     def test_validate_findinmap_valid(self):
-        t = format.parse_to_template(test_template_findinmap_valid)
+        t = template_format.parse(test_template_findinmap_valid)
 
         self.m.StubOutWithMock(instances.Instance, 'nova')
         instances.Instance.nova().AndReturn(self.fc)
@@ -281,7 +281,7 @@ class validateTest(unittest.TestCase):
         self.assertEqual(res['Description'], 'test.')
 
     def test_validate_findinmap_invalid(self):
-        t = format.parse_to_template(test_template_findinmap_invalid)
+        t = template_format.parse(test_template_findinmap_invalid)
 
         self.m.StubOutWithMock(instances.Instance, 'nova')
         instances.Instance.nova().AndReturn(self.fc)
index 1f388866e32320e5f790014b1b2261b779e0989d..75a847959cc96060630dd2f6f6cfb1a0c62abc8b 100644 (file)
@@ -25,7 +25,7 @@ import unittest
 from nose.plugins.attrib import attr
 
 from heat.common import context
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import parser
 from heat.engine.resources import volume as vol
 from heat.tests.v1_1 import fakes
@@ -54,7 +54,7 @@ class VolumeTest(unittest.TestCase):
         self.path = os.path.dirname(os.path.realpath(__file__)).\
             replace('heat/tests', 'templates')
         f = open("%s/WordPress_2_Instances_With_EBS.template" % self.path)
-        t = format.parse_to_template(f.read())
+        t = template_format.parse(f.read())
         f.close()
         return t
 
index 59699696f4065e7546c37ac9b3fae15560df29c0..df651211554dd5f285d23957bc2c49bb5bacf973 100644 (file)
@@ -27,7 +27,7 @@ from nose.plugins.attrib import attr
 from heat.tests import fakes
 
 import heat.db as db_api
-from heat.engine import format
+from heat.common import template_format
 from heat.engine import parser
 from heat.engine.resources import wait_condition as wc
 from heat.common import context
@@ -88,7 +88,7 @@ class WaitConditionTest(unittest.TestCase):
 
     def test_post_success_to_handle(self):
 
-        t = format.parse_to_template(test_template_waitcondition)
+        t = template_format.parse(test_template_waitcondition)
         stack = self.create_stack('test_stack', t, {})
 
         wc.WaitCondition._create_timeout().AndReturn(eventlet.Timeout(5))
@@ -120,7 +120,7 @@ class WaitConditionTest(unittest.TestCase):
 
     def test_timeout(self):
 
-        t = format.parse_to_template(test_template_waitcondition)
+        t = template_format.parse(test_template_waitcondition)
         stack = self.create_stack('test_stack', t, {})
 
         tmo = eventlet.Timeout(6)
@@ -166,7 +166,7 @@ class WaitConditionHandleTest(unittest.TestCase):
         self.m.UnsetStubs()
 
     def create_stack(self, stack_name='test_stack2', params={}):
-        temp = format.parse_to_template(test_template_waitcondition)
+        temp = template_format.parse(test_template_waitcondition)
         template = parser.Template(temp)
         parameters = parser.Parameters(stack_name, template, params)
         stack = parser.Stack(context.get_admin_context(), stack_name,
index d816d826fa85655e916ff42b0d1956f14a85665b..fd855956afde03684b53d96544f5cf41df224204 100755 (executable)
@@ -19,7 +19,7 @@ import os
 import yaml
 import json
 import re
-from heat.engine import format
+from heat.common import template_format
 
 def main():
     path = sys.argv[1]
@@ -32,7 +32,7 @@ def main():
 
 def convert_file(path):
     f = open(path, 'r')
-    print format.convert_json_to_yaml(f.read())
+    print template_format.convert_json_to_yaml(f.read())
 
 def convert_directory(dirpath):
     for path in os.listdir(dirpath):
@@ -42,7 +42,7 @@ def convert_directory(dirpath):
         print 'Writing to %s' % yamlpath
         f = open(os.path.join(dirpath, path), 'r')
         out = open(os.path.join(dirpath, yamlpath), 'w')
-        yml = format.convert_json_to_yaml(f.read())
+        yml = template_format.convert_json_to_yaml(f.read())
         out.write(yml)
         out.close()