diff --git a/contrib/cinder_volume_type/cinder_volume_type/tests/test_cinder_volume_type.py b/contrib/cinder_volume_type/cinder_volume_type/tests/test_cinder_volume_type.py index e018f607c..45a296b5c 100644 --- a/contrib/cinder_volume_type/cinder_volume_type/tests/test_cinder_volume_type.py +++ b/contrib/cinder_volume_type/cinder_volume_type/tests/test_cinder_volume_type.py @@ -13,8 +13,8 @@ import mock -from heat.engine import parser from heat.engine import resource +from heat.engine import stack from heat.engine import template from heat.tests import common from heat.tests import utils @@ -46,7 +46,7 @@ class CinderVolumeTypeTest(common.HeatTestCase): # explicitly. resource._register_class('OS::Cinder::VolumeType', CinderVolumeType) - self.stack = parser.Stack( + self.stack = stack.Stack( self.ctx, 'cinder_volume_type_test_stack', template.Template(volume_type_template) ) diff --git a/contrib/heat_keystone/heat_keystone/tests/test_project.py b/contrib/heat_keystone/heat_keystone/tests/test_project.py index 75a8be876..990947f40 100644 --- a/contrib/heat_keystone/heat_keystone/tests/test_project.py +++ b/contrib/heat_keystone/heat_keystone/tests/test_project.py @@ -14,9 +14,9 @@ import mock from heat.engine import constraints -from heat.engine import parser from heat.engine import properties from heat.engine import resource +from heat.engine import stack from heat.engine import template from heat.tests import common from heat.tests import utils @@ -51,7 +51,7 @@ class KeystoneProjectTest(common.HeatTestCase): # For unit testing purpose. Register resource provider explicitly. resource._register_class(RESOURCE_TYPE, KeystoneProject) - self.stack = parser.Stack( + self.stack = stack.Stack( self.ctx, 'test_stack_keystone', template.Template(keystone_project_template) ) diff --git a/contrib/heat_keystone/heat_keystone/tests/test_role.py b/contrib/heat_keystone/heat_keystone/tests/test_role.py index 7c2c19bbd..c40653196 100644 --- a/contrib/heat_keystone/heat_keystone/tests/test_role.py +++ b/contrib/heat_keystone/heat_keystone/tests/test_role.py @@ -13,8 +13,8 @@ import mock -from heat.engine import parser from heat.engine import resource +from heat.engine import stack from heat.engine import template from heat.tests import common from heat.tests import utils @@ -46,7 +46,7 @@ class KeystoneRoleTest(common.HeatTestCase): # For unit testing purpose. Register resource provider explicitly. resource._register_class(RESOURCE_TYPE, KeystoneRole) - self.stack = parser.Stack( + self.stack = stack.Stack( self.ctx, 'test_stack_keystone', template.Template(keystone_role_template) ) diff --git a/contrib/heat_zaqar/heat_zaqar/tests/test_queue.py b/contrib/heat_zaqar/heat_zaqar/tests/test_queue.py index 24d56453f..7875df09b 100644 --- a/contrib/heat_zaqar/heat_zaqar/tests/test_queue.py +++ b/contrib/heat_zaqar/heat_zaqar/tests/test_queue.py @@ -16,10 +16,10 @@ import six from heat.common import exception from heat.common import template_format -from heat.engine import parser from heat.engine import resource from heat.engine import rsrc_defn from heat.engine import scheduler +from heat.engine import stack from heat.engine import template from heat.tests import common from heat.tests import utils @@ -88,7 +88,7 @@ class ZaqarMessageQueueTest(common.HeatTestCase): def parse_stack(self, t): stack_name = 'test_stack' tmpl = template.Template(t) - self.stack = parser.Stack(self.ctx, stack_name, tmpl) + self.stack = stack.Stack(self.ctx, stack_name, tmpl) self.stack.validate() self.stack.store() diff --git a/contrib/nova_flavor/nova_flavor/tests/test_nova_flavor.py b/contrib/nova_flavor/nova_flavor/tests/test_nova_flavor.py index 43555bbf9..b6f67a16f 100644 --- a/contrib/nova_flavor/nova_flavor/tests/test_nova_flavor.py +++ b/contrib/nova_flavor/nova_flavor/tests/test_nova_flavor.py @@ -13,8 +13,8 @@ import mock -from heat.engine import parser from heat.engine import resource +from heat.engine import stack from heat.engine import template from heat.tests import common from heat.tests.nova import fakes @@ -51,7 +51,7 @@ class NovaFlavorTest(common.HeatTestCase): # explicitly. resource._register_class("OS::Nova::Flavor", nova_flavor.NovaFlavor) - self.stack = parser.Stack( + self.stack = stack.Stack( self.ctx, 'nova_flavor_test_stack', template.Template(flavor_template) ) diff --git a/contrib/rackspace/rackspace/tests/test_rackspace_cloud_server.py b/contrib/rackspace/rackspace/tests/test_rackspace_cloud_server.py index f1f1f4640..b9f1ee903 100644 --- a/contrib/rackspace/rackspace/tests/test_rackspace_cloud_server.py +++ b/contrib/rackspace/rackspace/tests/test_rackspace_cloud_server.py @@ -20,9 +20,9 @@ import six from heat.common import exception from heat.common import template_format from heat.engine import environment -from heat.engine import parser from heat.engine import resource from heat.engine import scheduler +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests.nova import fakes diff --git a/contrib/rackspace/rackspace/tests/test_rackspace_dns.py b/contrib/rackspace/rackspace/tests/test_rackspace_dns.py index f6b9e4459..b4ce960e0 100644 --- a/contrib/rackspace/rackspace/tests/test_rackspace_dns.py +++ b/contrib/rackspace/rackspace/tests/test_rackspace_dns.py @@ -18,10 +18,10 @@ import mock from heat.common import exception from heat.common import template_format from heat.engine import environment -from heat.engine import parser from heat.engine import resource from heat.engine import rsrc_defn from heat.engine import scheduler +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests import utils diff --git a/heat/engine/parser.py b/heat/engine/parser.py index 21e085de7..c0490ad95 100644 --- a/heat/engine/parser.py +++ b/heat/engine/parser.py @@ -11,11 +11,15 @@ # License for the specific language governing permissions and limitations # under the License. +import warnings + from heat.engine import stack from heat.engine import template # Note: these classes are here for backwards compatibility. # New uses of the Stack class should use stack.Stack(). # +warnings.warn('Module parser.py is deprecated. Please use class Template ' + 'in heat.engine.template and class Stack in heat.engine.stack.') Template = template.Template Stack = stack.Stack diff --git a/heat/tests/aws/test_waitcondition.py b/heat/tests/aws/test_waitcondition.py index e76484bab..364097be0 100644 --- a/heat/tests/aws/test_waitcondition.py +++ b/heat/tests/aws/test_waitcondition.py @@ -24,10 +24,11 @@ from heat.common import exception from heat.common import identifier from heat.common import template_format from heat.engine import environment -from heat.engine import parser from heat.engine.resources.aws.cfn import wait_condition_handle as aws_wch from heat.engine import rsrc_defn from heat.engine import scheduler +from heat.engine import stack as parser +from heat.engine import template as tmpl from heat.objects import resource as resource_objects from heat.tests import common from heat.tests import utils @@ -86,8 +87,8 @@ class WaitConditionTest(common.HeatTestCase): stub=True, stub_status=True): params = params or {} temp = template_format.parse(template) - template = parser.Template(temp, - env=environment.Environment(params)) + template = tmpl.Template(temp, + env=environment.Environment(params)) ctx = utils.dummy_context(tenant_id='test_tenant') stack = parser.Stack(ctx, 'test_stack', template, disable_rollback=True) @@ -355,7 +356,7 @@ class WaitConditionHandleTest(common.HeatTestCase): def create_stack(self, stack_name=None, stack_id=None): temp = template_format.parse(test_template_waitcondition) - template = parser.Template(temp) + template = tmpl.Template(temp) ctx = utils.dummy_context(tenant_id='test_tenant') if stack_name is None: stack_name = utils.random_name() @@ -523,11 +524,11 @@ class WaitConditionUpdateTest(common.HeatTestCase): cfg.CONF.set_default('heat_waitcondition_server_url', 'http://server.test:8000/v1/waitcondition') - def create_stack(self, tmpl=None): - if tmpl is None: - tmpl = test_template_wc_count - temp = template_format.parse(tmpl) - template = parser.Template(temp) + def create_stack(self, temp=None): + if temp is None: + temp = test_template_wc_count + temp_fmt = template_format.parse(temp) + template = tmpl.Template(temp_fmt) ctx = utils.dummy_context(tenant_id='test_tenant') stack = parser.Stack(ctx, 'test_stack', template, disable_rollback=True) diff --git a/heat/tests/db/test_sqlalchemy_api.py b/heat/tests/db/test_sqlalchemy_api.py index afd2e9716..146bac94d 100644 --- a/heat/tests/db/test_sqlalchemy_api.py +++ b/heat/tests/db/test_sqlalchemy_api.py @@ -28,10 +28,11 @@ from heat.db.sqlalchemy import api as db_api from heat.engine.clients.os import glance from heat.engine.clients.os import nova from heat.engine import environment -from heat.engine import parser from heat.engine import resource as rsrc from heat.engine.resources.aws.ec2 import instance as instances from heat.engine import scheduler +from heat.engine import stack as parser +from heat.engine import template as tmpl from heat.tests import common from heat.tests.nova import fakes as fakes_nova from heat.tests import utils @@ -101,7 +102,7 @@ class SqlAlchemyTest(common.HeatTestCase): def _setup_test_stack(self, stack_name, stack_id=None, owner_id=None, stack_user_project_id=None, backup=False): t = template_format.parse(wp_template) - template = parser.Template( + template = tmpl.Template( t, env=environment.Environment({'KeyName': 'test'})) stack_id = stack_id or str(uuid.uuid4()) stack = parser.Stack(self.ctx, stack_name, template, @@ -283,8 +284,8 @@ class SqlAlchemyTest(common.HeatTestCase): def test_encryption(self): stack_name = 'test_encryption' - (tmpl, stack) = self._setup_test_stack(stack_name) - resource_defns = tmpl.resource_definitions(stack) + (template, stack) = self._setup_test_stack(stack_name) + resource_defns = template.resource_definitions(stack) cs = MyResource('cs_encryption', resource_defns['WebServer'], stack) diff --git a/heat/tests/neutron/test_neutron_security_group.py b/heat/tests/neutron/test_neutron_security_group.py index 479f01f6c..90e526c1b 100644 --- a/heat/tests/neutron/test_neutron_security_group.py +++ b/heat/tests/neutron/test_neutron_security_group.py @@ -18,8 +18,8 @@ from novaclient.v2 import security_groups as nova_sg from heat.common import exception from heat.common import template_format -from heat.engine import parser from heat.engine import scheduler +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests.nova import fakes as fakes_nova diff --git a/heat/tests/openstack/test_waitcondition.py b/heat/tests/openstack/test_waitcondition.py index d0eb35dcd..e54f20c59 100644 --- a/heat/tests/openstack/test_waitcondition.py +++ b/heat/tests/openstack/test_waitcondition.py @@ -21,9 +21,10 @@ from heat.common import identifier from heat.common import template_format from heat.engine.clients.os import heat_plugin from heat.engine import environment -from heat.engine import parser from heat.engine import resource from heat.engine.resources.openstack.heat import wait_condition_handle as h_wch +from heat.engine import stack as parser +from heat.engine import template as tmpl from heat.objects import resource as resource_objects from heat.tests import common from heat.tests import utils @@ -79,8 +80,8 @@ class HeatWaitConditionTest(common.HeatTestCase): params={}, stub=True, stub_status=True): temp = template_format.parse(template) - template = parser.Template(temp, - env=environment.Environment(params)) + template = tmpl.Template(temp, + env=environment.Environment(params)) ctx = utils.dummy_context(tenant_id=self.tenant_id) stack = parser.Stack(ctx, 'test_stack', template, disable_rollback=True) diff --git a/heat/tests/test_ceilometer_alarm.py b/heat/tests/test_ceilometer_alarm.py index fa1c4fba0..5a60d7dc7 100644 --- a/heat/tests/test_ceilometer_alarm.py +++ b/heat/tests/test_ceilometer_alarm.py @@ -23,12 +23,13 @@ import six from heat.common import exception from heat.common import template_format from heat.engine.clients.os import ceilometer -from heat.engine import parser from heat.engine import properties as props from heat.engine import resource from heat.engine.resources.openstack.ceilometer import alarm from heat.engine import rsrc_defn from heat.engine import scheduler +from heat.engine import stack as parser +from heat.engine import template as tmpl from heat.tests import common from heat.tests import generic_resource from heat.tests import utils @@ -127,7 +128,7 @@ class CeilometerAlarmTest(common.HeatTestCase): if template is None: template = alarm_template temp = template_format.parse(template) - template = parser.Template(temp) + template = tmpl.Template(temp) ctx = utils.dummy_context() ctx.tenant_id = 'test_tenant' stack = parser.Stack(ctx, utils.random_name(), template, diff --git a/heat/tests/test_cloud_config.py b/heat/tests/test_cloud_config.py index 4872820ba..d7dbc71e3 100644 --- a/heat/tests/test_cloud_config.py +++ b/heat/tests/test_cloud_config.py @@ -15,8 +15,8 @@ import uuid import mock -from heat.engine import parser from heat.engine.resources.openstack.heat import cloud_config +from heat.engine import stack from heat.engine import template from heat.tests import common from heat.tests import utils @@ -30,7 +30,7 @@ class CloudConfigTest(common.HeatTestCase): self.properties = { 'cloud_config': {'foo': 'bar'} } - self.stack = parser.Stack( + self.stack = stack.Stack( self.ctx, 'software_config_test_stack', template.Template({ 'HeatTemplateFormatVersion': '2012-12-12', diff --git a/heat/tests/test_dbinstance.py b/heat/tests/test_dbinstance.py index ed90696a9..0e59f3837 100644 --- a/heat/tests/test_dbinstance.py +++ b/heat/tests/test_dbinstance.py @@ -14,9 +14,9 @@ from heat.common import template_format from heat.engine import attributes from heat.engine import constraints -from heat.engine import parser from heat.engine import properties from heat.engine import resource +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests import utils diff --git a/heat/tests/test_eip.py b/heat/tests/test_eip.py index 4956cb044..1525466e5 100644 --- a/heat/tests/test_eip.py +++ b/heat/tests/test_eip.py @@ -21,10 +21,11 @@ import six from heat.common import exception from heat.common import template_format from heat.engine.clients.os import nova -from heat.engine import parser from heat.engine.resources.aws.ec2 import eip from heat.engine import rsrc_defn from heat.engine import scheduler +from heat.engine import stack as parser +from heat.engine import template as tmpl from heat.tests import common from heat.tests.nova import fakes as fakes_nova from heat.tests import utils @@ -394,7 +395,7 @@ class AllocTest(common.HeatTestCase): def _setup_test_stack(self, stack_name): t = template_format.parse(ipassoc_template_validate) - template = parser.Template(t) + template = tmpl.Template(t) stack = parser.Stack(utils.dummy_context(), stack_name, template, stack_id='12233', stack_user_project_id='8888') diff --git a/heat/tests/test_empty_stack.py b/heat/tests/test_empty_stack.py index f84940ea9..5d03f7aae 100644 --- a/heat/tests/test_empty_stack.py +++ b/heat/tests/test_empty_stack.py @@ -12,7 +12,7 @@ # under the License. from heat.common import template_format -from heat.engine import parser +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests import utils diff --git a/heat/tests/test_engine_api_utils.py b/heat/tests/test_engine_api_utils.py index de10f0696..55681c150 100644 --- a/heat/tests/test_engine_api_utils.py +++ b/heat/tests/test_engine_api_utils.py @@ -24,8 +24,9 @@ from heat.common import template_format from heat.engine import api from heat.engine import event from heat.engine import parameters -from heat.engine import parser from heat.engine import resource +from heat.engine import stack as parser +from heat.engine import template from heat.rpc import api as rpc_api from heat.tests import common from heat.tests import generic_resource as generic_rsrc @@ -38,7 +39,7 @@ class FormatTest(common.HeatTestCase): def setUp(self): super(FormatTest, self).setUp() - template = parser.Template({ + tmpl = template.Template({ 'HeatTemplateFormatVersion': '2012-12-12', 'Resources': { 'generic1': {'Type': 'GenericResourceType'}, @@ -52,7 +53,7 @@ class FormatTest(common.HeatTestCase): resource._register_class('ResWithComplexPropsAndAttrs', generic_rsrc.ResWithComplexPropsAndAttrs) self.stack = parser.Stack(utils.dummy_context(), 'test_stack', - template, stack_id=str(uuid.uuid4())) + tmpl, stack_id=str(uuid.uuid4())) def _dummy_event(self, event_id): resource = self.stack['generic1'] @@ -145,7 +146,7 @@ class FormatTest(common.HeatTestCase): self.assertIn('a2', formatted_attributes) def _get_formatted_resource_properties(self, res_name): - tmpl = parser.Template(template_format.parse(''' + tmpl = template.Template(template_format.parse(''' heat_template_version: 2013-05-23 resources: resource1: @@ -341,7 +342,7 @@ class FormatTest(common.HeatTestCase): self.assertEqual('foobar', info[rpc_api.STACK_OUTPUTS]) def test_format_stack_outputs(self): - template = parser.Template({ + tmpl = template.Template({ 'HeatTemplateFormatVersion': '2012-12-12', 'Resources': { 'generic': {'Type': 'GenericResourceType'} @@ -357,7 +358,7 @@ class FormatTest(common.HeatTestCase): } }) stack = parser.Stack(utils.dummy_context(), 'test_stack', - template, stack_id=str(uuid.uuid4())) + tmpl, stack_id=str(uuid.uuid4())) stack.action = 'CREATE' stack.status = 'COMPLETE' stack['generic'].action = 'CREATE' @@ -908,7 +909,7 @@ class FormatValidateParameterTest(common.HeatTestCase): """ t = template_format.parse(self.template % self.param) - tmpl = parser.Template(t) + tmpl = template.Template(t) tmpl_params = parameters.Parameters(None, tmpl) tmpl_params.validate(validate_value=False) diff --git a/heat/tests/test_event.py b/heat/tests/test_event.py index 4fb1320bb..2c67f9597 100644 --- a/heat/tests/test_event.py +++ b/heat/tests/test_event.py @@ -14,9 +14,9 @@ from oslo_config import cfg from heat.engine import event -from heat.engine import parser from heat.engine import resource from heat.engine import rsrc_defn +from heat.engine import stack from heat.engine import template from heat.objects import event as event_object from heat.objects import stack as stack_object @@ -51,8 +51,8 @@ class EventTest(common.HeatTestCase): resource._register_class('ResourceWithRequiredProps', generic_rsrc.ResourceWithRequiredProps) - self.stack = parser.Stack(self.ctx, 'event_load_test_stack', - template.Template(tmpl)) + self.stack = stack.Stack(self.ctx, 'event_load_test_stack', + template.Template(tmpl)) self.stack.store() self.resource = self.stack['EventTestResource'] diff --git a/heat/tests/test_function.py b/heat/tests/test_function.py index 342a4d2ae..f8885699c 100644 --- a/heat/tests/test_function.py +++ b/heat/tests/test_function.py @@ -21,9 +21,10 @@ from heat.common.i18n import _ from heat.engine.cfn import functions from heat.engine import environment from heat.engine import function -from heat.engine import parser from heat.engine import resource from heat.engine import rsrc_defn +from heat.engine import stack +from heat.engine import template from heat.tests import common from heat.tests import generic_resource as generic_rsrc from heat.tests import utils @@ -175,10 +176,10 @@ class ValidateGetAttTest(common.HeatTestCase): env.load({u'resource_registry': {u'OS::Test::FakeResource': u'OverwrittenFnGetAttType'}}) - self.stack = parser.Stack( + self.stack = stack.Stack( utils.dummy_context(), 'test_stack', - parser.Template({"HeatTemplateFormatVersion": "2012-12-12"}, - env=env), + template.Template({"HeatTemplateFormatVersion": "2012-12-12"}, + env=env), stack_id=str(uuid.uuid4())) res_defn = rsrc_defn.ResourceDefinition('test_rsrc', 'OS::Test::GenericResource') diff --git a/heat/tests/test_glance_image.py b/heat/tests/test_glance_image.py index 05bf09a1a..75b7f82d9 100644 --- a/heat/tests/test_glance_image.py +++ b/heat/tests/test_glance_image.py @@ -17,9 +17,10 @@ import six from heat.common import exception from heat.common import template_format -from heat.engine import parser from heat.engine import resource from heat.engine.resources.openstack.glance import glance_image as gi +from heat.engine import stack as parser +from heat.engine import template from heat.tests import common from heat.tests import utils @@ -68,7 +69,7 @@ class GlanceImageTest(common.HeatTestCase): tpl = template_format.parse(image_template) self.stack = parser.Stack( self.ctx, 'glance_image_test_stack', - parser.Template(tpl) + template.Template(tpl) ) self.my_image = self.stack['my_image'] @@ -94,7 +95,7 @@ class GlanceImageTest(common.HeatTestCase): tpl = template_format.parse(image_template_validate) stack = parser.Stack( self.ctx, 'glance_image_stack_validate', - parser.Template(tpl) + template.Template(tpl) ) image = stack['image'] image.t['Properties']['min_disk'] = -1 @@ -106,7 +107,7 @@ class GlanceImageTest(common.HeatTestCase): tpl = template_format.parse(image_template_validate) stack = parser.Stack( self.ctx, 'glance_image_stack_validate', - parser.Template(tpl) + template.Template(tpl) ) image = stack['image'] image.t['Properties']['min_ram'] = -1 @@ -118,7 +119,7 @@ class GlanceImageTest(common.HeatTestCase): tpl = template_format.parse(image_template_validate) stack = parser.Stack( self.ctx, 'glance_image_stack_validate', - parser.Template(tpl) + template.Template(tpl) ) image = stack['image'] image.t['Properties'].pop('disk_format') @@ -130,7 +131,7 @@ class GlanceImageTest(common.HeatTestCase): tpl = template_format.parse(image_template_validate) stack = parser.Stack( self.ctx, 'glance_image_stack_validate', - parser.Template(tpl) + template.Template(tpl) ) image = stack['image'] image.t['Properties']['disk_format'] = 'incorrect_format' @@ -143,7 +144,7 @@ class GlanceImageTest(common.HeatTestCase): tpl = template_format.parse(image_template_validate) stack = parser.Stack( self.ctx, 'glance_image_stack_validate', - parser.Template(tpl) + template.Template(tpl) ) image = stack['image'] image.t['Properties'].pop('container_format') @@ -155,7 +156,7 @@ class GlanceImageTest(common.HeatTestCase): tpl = template_format.parse(image_template_validate) stack = parser.Stack( self.ctx, 'glance_image_stack_validate', - parser.Template(tpl) + template.Template(tpl) ) image = stack['image'] image.t['Properties']['container_format'] = 'incorrect_format' @@ -168,7 +169,7 @@ class GlanceImageTest(common.HeatTestCase): tpl = template_format.parse(image_template_validate) stack = parser.Stack( self.ctx, 'glance_image_stack_validate', - parser.Template(tpl) + template.Template(tpl) ) image = stack['image'] image.t['Properties'].pop('location') diff --git a/heat/tests/test_hot.py b/heat/tests/test_hot.py index e80823cc8..2e96186bd 100644 --- a/heat/tests/test_hot.py +++ b/heat/tests/test_hot.py @@ -24,10 +24,10 @@ from heat.engine.hot import functions as hot_functions from heat.engine.hot import parameters as hot_param from heat.engine.hot import template as hot_template from heat.engine import parameters -from heat.engine import parser from heat.engine import resource from heat.engine import resources from heat.engine import rsrc_defn +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests import generic_resource as generic_rsrc @@ -104,7 +104,7 @@ class HOTemplateTest(common.HeatTestCase): def test_defaults(self): """Test default content behavior of HOT template.""" - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) # check if we get the right class self.assertIsInstance(tmpl, hot_template.HOTemplate20130523) # test getting an invalid section @@ -118,7 +118,7 @@ class HOTemplateTest(common.HeatTestCase): def test_defaults_for_empty_sections(self): """Test default secntion's content behavior of HOT template.""" - tmpl = parser.Template(hot_tpl_empty_sections) + tmpl = template.Template(hot_tpl_empty_sections) # check if we get the right class self.assertIsInstance(tmpl, hot_template.HOTemplate20130523) # test getting an invalid section @@ -160,7 +160,7 @@ class HOTemplateTest(common.HeatTestCase): 'DeletionPolicy': 'dummy', 'UpdatePolicy': {'foo': 'bar'}}} - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) self.assertEqual(expected, tmpl[tmpl.RESOURCES]) def test_translate_resources_bad_no_data(self): @@ -172,7 +172,7 @@ class HOTemplateTest(common.HeatTestCase): resource1: """) - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) error = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.RESOURCES) self.assertEqual('Each resource must contain a type key.', @@ -196,7 +196,7 @@ class HOTemplateTest(common.HeatTestCase): foo: bar ''') - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) err = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.RESOURCES) self.assertEqual('u\'"Type" is not a valid keyword ' @@ -221,7 +221,7 @@ class HOTemplateTest(common.HeatTestCase): foo: bar ''') - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) err = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.RESOURCES) self.assertEqual('u\'"Properties" is not a valid keyword ' @@ -240,7 +240,7 @@ class HOTemplateTest(common.HeatTestCase): depends_on: dummy deletion_policy: dummy ''') - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) error = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.RESOURCES) self.assertEqual('"resources" must contain a map of resource maps. ' @@ -265,7 +265,7 @@ class HOTemplateTest(common.HeatTestCase): foo: bar ''') - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) err = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.RESOURCES) self.assertEqual('u\'"Metadata" is not a valid keyword ' @@ -290,7 +290,7 @@ class HOTemplateTest(common.HeatTestCase): foo: bar ''') - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) err = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.RESOURCES) self.assertEqual('u\'"DependsOn" is not a valid keyword ' @@ -315,7 +315,7 @@ class HOTemplateTest(common.HeatTestCase): foo: bar ''') - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) err = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.RESOURCES) self.assertEqual('u\'"DeletionPolicy" is not a valid keyword ' @@ -340,7 +340,7 @@ class HOTemplateTest(common.HeatTestCase): foo: bar ''') - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) err = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.RESOURCES) self.assertEqual('u\'"UpdatePolicy" is not a valid keyword ' @@ -360,7 +360,7 @@ class HOTemplateTest(common.HeatTestCase): expected = {'output1': {'Description': 'output1', 'Value': 'value1'}} - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) self.assertEqual(expected, tmpl[tmpl.OUTPUTS]) def test_translate_outputs_bad_no_data(self): @@ -372,7 +372,7 @@ class HOTemplateTest(common.HeatTestCase): output1: """) - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) error = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.OUTPUTS) self.assertEqual('Each output must contain a value key.', @@ -388,7 +388,7 @@ class HOTemplateTest(common.HeatTestCase): value: value1 """) - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) error = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.OUTPUTS) self.assertEqual('"outputs" must contain a map of output maps. ' @@ -406,7 +406,7 @@ class HOTemplateTest(common.HeatTestCase): value: value1 ''') - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) err = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.OUTPUTS) self.assertIn('Description', six.text_type(err)) @@ -422,7 +422,7 @@ class HOTemplateTest(common.HeatTestCase): Value: value1 ''') - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) err = self.assertRaises(exception.StackValidationFailed, tmpl.__getitem__, tmpl.OUTPUTS) self.assertIn('Value', six.text_type(err)) @@ -443,7 +443,7 @@ class HOTemplateTest(common.HeatTestCase): resource_def: type: OS::Nova::Server ''') - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) stack = parser.Stack(utils.dummy_context(), 'test_stack', tmpl) snippet = {'list_join': ["\n", {'get_attr': ['rg', 'name']}]} self.assertEqual('', self.resolve(snippet, tmpl, stack)) @@ -455,7 +455,7 @@ class HOTemplateTest(common.HeatTestCase): 'params': {'var1': 'foo', 'var2': 'bar'}}} snippet_resolved = 'Template foo string bar' - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) self.assertEqual(snippet_resolved, self.resolve(snippet, tmpl)) @@ -466,7 +466,7 @@ class HOTemplateTest(common.HeatTestCase): 'params': {'number': 1}}} snippet_resolved = 'Template 1 string bar' - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) self.assertEqual(snippet_resolved, self.resolve(snippet, tmpl)) @@ -477,7 +477,7 @@ class HOTemplateTest(common.HeatTestCase): 'Template $var1 string $var2']} snippet_resolved = 'Template foo string bar' - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) self.assertEqual(snippet_resolved, self.resolve(snippet, tmpl)) @@ -492,7 +492,7 @@ class HOTemplateTest(common.HeatTestCase): snippet = {'str_replace': [{'template': 'Template var1 string var2'}, {'params': {'var1': 'foo', 'var2': 'bar'}}]} - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) self.assertRaises(TypeError, self.resolve, snippet, tmpl) @@ -507,7 +507,7 @@ class HOTemplateTest(common.HeatTestCase): snippet = {'str_replace': {'tmpl': 'Template var1 string var2', 'params': {'var1': 'foo', 'var2': 'bar'}}} - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) self.assertRaises(KeyError, self.resolve, snippet, tmpl) @@ -527,7 +527,7 @@ class HOTemplateTest(common.HeatTestCase): snippet = {'str_replace': {'template': 12345, 'params': {'var1': 'foo', 'var2': 'bar'}}} - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) self.assertRaises(TypeError, self.resolve, snippet, tmpl) @@ -542,7 +542,7 @@ class HOTemplateTest(common.HeatTestCase): snippet = {'get_file': 'file:///tmp/foo.yaml'} snippet_resolved = 'foo contents' - tmpl = parser.Template(hot_tpl_empty, files={ + tmpl = template.Template(hot_tpl_empty, files={ 'file:///tmp/foo.yaml': 'foo contents' }) stack = parser.Stack(utils.dummy_context(), 'param_id_test', tmpl) @@ -553,7 +553,7 @@ class HOTemplateTest(common.HeatTestCase): """Test get_file function with non-string argument.""" snippet = {'get_file': ['file:///tmp/foo.yaml']} - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) stack = parser.Stack(utils.dummy_context(), 'param_id_test', tmpl) notStrErr = self.assertRaises(TypeError, self.resolve, snippet, tmpl, stack) @@ -566,7 +566,7 @@ class HOTemplateTest(common.HeatTestCase): snippet = {'get_file': 'file:///tmp/foo.yaml'} - tmpl = parser.Template(hot_tpl_empty, files={ + tmpl = template.Template(hot_tpl_empty, files={ 'file:///tmp/bar.yaml': 'bar contents' }) stack = parser.Stack(utils.dummy_context(), 'param_id_test', tmpl) @@ -583,7 +583,7 @@ class HOTemplateTest(common.HeatTestCase): snippet = {'get_file': 'file:///tmp/foo.yaml'} snippet_resolved = '{get_file: file:///tmp/bar.yaml}' - tmpl = parser.Template(hot_tpl_empty, files={ + tmpl = template.Template(hot_tpl_empty, files={ 'file:///tmp/foo.yaml': snippet_resolved, 'file:///tmp/bar.yaml': 'bar content', }) @@ -597,7 +597,7 @@ class HOTemplateTest(common.HeatTestCase): 'for_each': {'%var%': ['a', 'b', 'c']}}} snippet_resolved = ['this is a', 'this is b', 'this is c'] - tmpl = parser.Template(hot_kilo_tpl_empty) + tmpl = template.Template(hot_kilo_tpl_empty) self.assertEqual(snippet_resolved, self.resolve(snippet, tmpl)) @@ -609,7 +609,7 @@ class HOTemplateTest(common.HeatTestCase): {'key-b': 'this is b'}, {'key-c': 'this is c'}] - tmpl = parser.Template(hot_kilo_tpl_empty) + tmpl = template.Template(hot_kilo_tpl_empty) self.assertEqual(snippet_resolved, self.resolve(snippet, tmpl)) @@ -621,7 +621,7 @@ class HOTemplateTest(common.HeatTestCase): ['this is b', 'static'], ['this is c', 'static']] - tmpl = parser.Template(hot_kilo_tpl_empty) + tmpl = template.Template(hot_kilo_tpl_empty) self.assertEqual(snippet_resolved, self.resolve(snippet, tmpl)) @@ -633,7 +633,7 @@ class HOTemplateTest(common.HeatTestCase): snippet_resolved = ['this is a-1', 'this is b-1', 'this is c-1', 'this is a-2', 'this is b-2', 'this is c-2'] - tmpl = parser.Template(hot_kilo_tpl_empty) + tmpl = template.Template(hot_kilo_tpl_empty) result = self.resolve(snippet, tmpl) self.assertEqual(len(result), len(snippet_resolved)) @@ -645,7 +645,7 @@ class HOTemplateTest(common.HeatTestCase): Test that the repeat function reports a proper error when missing or invalid arguments. """ - tmpl = parser.Template(hot_kilo_tpl_empty) + tmpl = template.Template(hot_kilo_tpl_empty) # missing for_each snippet = {'repeat': {'template': 'this is %var%'}} @@ -675,11 +675,11 @@ class HOTemplateTest(common.HeatTestCase): snippet = {'digest': ['md5', 'foobar']} snippet_resolved = '3858f62230ac3c915f300c664312c63f' - tmpl = parser.Template(hot_kilo_tpl_empty) + tmpl = template.Template(hot_kilo_tpl_empty) self.assertEqual(snippet_resolved, self.resolve(snippet, tmpl)) def test_digest_invalid_types(self): - tmpl = parser.Template(hot_kilo_tpl_empty) + tmpl = template.Template(hot_kilo_tpl_empty) invalid_snippets = [ {'digest': 'invalid'}, @@ -691,7 +691,7 @@ class HOTemplateTest(common.HeatTestCase): self.assertIn('must be a list of strings', six.text_type(exc)) def test_digest_incorrect_number_arguments(self): - tmpl = parser.Template(hot_kilo_tpl_empty) + tmpl = template.Template(hot_kilo_tpl_empty) invalid_snippets = [ {'digest': []}, @@ -705,7 +705,7 @@ class HOTemplateTest(common.HeatTestCase): six.text_type(exc)) def test_digest_invalid_algorithm(self): - tmpl = parser.Template(hot_kilo_tpl_empty) + tmpl = template.Template(hot_kilo_tpl_empty) snippet = {'digest': ['invalid_algorithm', 'foobar']} exc = self.assertRaises(ValueError, self.resolve, snippet, tmpl) @@ -725,7 +725,7 @@ class HOTemplateTest(common.HeatTestCase): type: string '''.format(expected_description)) - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) self.assertEqual(expected_description, tmpl['description']) err_str = "can not be accessed directly" @@ -744,10 +744,11 @@ class HOTemplateTest(common.HeatTestCase): used as an iterable. """ expected_description = "This can be accessed" - tmpl = parser.Template({'heat_template_version': '2013-05-23', - 'description': expected_description, - 'parameters': - {'foo': {'Type': 'String', 'Required': True}}}) + tmpl = template.Template({'heat_template_version': '2013-05-23', + 'description': expected_description, + 'parameters': + {'foo': {'Type': 'String', + 'Required': True}}}) self.assertEqual(expected_description, tmpl['description']) self.assertNotIn('parameters', tmpl.keys()) @@ -792,9 +793,9 @@ class HOTemplateTest(common.HeatTestCase): update_policy={"blarg": "wibble"}) parent_resource.stack = parser.Stack(utils.dummy_context(), 'toplevel_stack', - parser.Template(hot_tpl_empty)) + template.Template(hot_tpl_empty)) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(hot_tpl_empty), + template.Template(hot_tpl_empty), parent_resource='parent') stack._parent_resource = parent_resource self.assertEqual({"foo": "bar"}, @@ -809,7 +810,7 @@ class HOTemplateTest(common.HeatTestCase): parent_resource = DummyClass() parent_resource.metadata_set({"foo": "bar"}) - tmpl = parser.Template(hot_juno_tpl_empty) + tmpl = template.Template(hot_juno_tpl_empty) parent_resource.stack = parser.Stack(utils.dummy_context(), 'toplevel_stack', tmpl) @@ -820,7 +821,7 @@ class HOTemplateTest(common.HeatTestCase): deletion_policy=del_policy) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(hot_tpl_empty), + template.Template(hot_tpl_empty), parent_resource='parent') stack._parent_resource = parent_resource self.assertEqual('Retain', @@ -829,7 +830,7 @@ class HOTemplateTest(common.HeatTestCase): def test_resource_facade_invalid_arg(self): snippet = {'resource_facade': 'wibble'} stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(hot_tpl_empty)) + template.Template(hot_tpl_empty)) error = self.assertRaises(ValueError, self.resolve, snippet, @@ -844,9 +845,9 @@ class HOTemplateTest(common.HeatTestCase): parent_resource.t = rsrc_defn.ResourceDefinition('parent', 'SomeType') parent_resource.stack = parser.Stack(utils.dummy_context(), 'toplevel_stack', - parser.Template(hot_tpl_empty)) + template.Template(hot_tpl_empty)) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(hot_tpl_empty), + template.Template(hot_tpl_empty), parent_resource='parent') stack._parent_resource = parent_resource self.assertEqual('Delete', self.resolve(snippet, stack.t, stack)) @@ -854,7 +855,7 @@ class HOTemplateTest(common.HeatTestCase): def test_removed_function(self): snippet = {'Fn::GetAZs': ''} stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(hot_juno_tpl_empty)) + template.Template(hot_juno_tpl_empty)) error = self.assertRaises(exception.InvalidTemplateVersion, function.validate, stack.t.parse(stack, snippet)) @@ -876,8 +877,8 @@ class HOTemplateTest(common.HeatTestCase): update_policy: foo: bar ''') - source = parser.Template(hot_tpl) - empty = parser.Template(copy.deepcopy(hot_tpl_empty)) + source = template.Template(hot_tpl) + empty = template.Template(copy.deepcopy(hot_tpl_empty)) stack = parser.Stack(utils.dummy_context(), 'test_stack', source) for defn in source.resource_definitions(stack).values(): @@ -977,7 +978,7 @@ class HotStackTest(common.HeatTestCase): self.assertEqual({'value': 'resource1'}, self.resolve(snippet)) def test_set_param_id(self): - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) self.stack = parser.Stack(self.ctx, 'param_id_test', tmpl) self.assertEqual('None', self.stack.parameters['OS::stack_id']) self.stack.store() @@ -988,7 +989,7 @@ class HotStackTest(common.HeatTestCase): self.m.VerifyAll() def test_set_wrong_param(self): - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) stack_id = identifier.HeatIdentifier('', "stack_testit", None) params = tmpl.parameters(None, {}) self.assertFalse(params.set_stack_id(None)) @@ -1024,7 +1025,7 @@ class HotStackTest(common.HeatTestCase): self.stack['AResource'].metadata_get()['Bar']) def test_load_param_id(self): - tmpl = parser.Template(hot_tpl_empty) + tmpl = template.Template(hot_tpl_empty) self.stack = parser.Stack(self.ctx, 'param_load_id_test', tmpl) self.stack.store() stack_identifier = self.stack.identifier() @@ -1310,7 +1311,7 @@ class StackParametersTest(common.HeatTestCase): def test_param_refs(self): """Test if parameter references work.""" env = environment.Environment(self.params) - tmpl = parser.Template(self.props_template, env=env) + tmpl = template.Template(self.props_template, env=env) stack = parser.Stack(utils.dummy_context(), 'test', tmpl, stack_id='1ba8c334-2297-4312-8c7c-43763a988ced', tenant_id='9913ef0a-b8be-4b33-b574-9061441bd373') @@ -1388,7 +1389,7 @@ class HOTParamValidatorTest(common.HeatTestCase): - allowed_pattern: "[a-z]+[a-zA-Z]*" description: %s ''' % (len_desc, pattern_desc1, pattern_desc2)) - tmpl = parser.Template(hot_tpl) + tmpl = template.Template(hot_tpl) def run_parameters(value): tmpl.parameters( @@ -1535,7 +1536,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual("Invalid key 'foo' for parameter (param1)", six.text_type(error)) @@ -1548,7 +1549,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual("Missing parameter type for parameter: param1", six.text_type(error)) @@ -1561,7 +1562,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual( "Invalid type (Unicode)", six.text_type(error)) @@ -1577,7 +1578,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual( "Invalid key 'allowed_valus' for parameter constraints", six.text_type(error)) @@ -1593,7 +1594,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual( "Invalid parameter constraints for parameter param1, " "expected a list", six.text_type(error)) @@ -1609,7 +1610,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual( "Invalid parameter constraints, expected a mapping", six.text_type(error)) @@ -1626,7 +1627,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual("No constraint expressed", six.text_type(error)) def test_validate_schema_constraints_range_wrong_format(self): @@ -1641,7 +1642,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual( "Invalid range constraint, expected a mapping", six.text_type(error)) @@ -1658,7 +1659,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual( "Invalid key 'foo' for range constraint", six.text_type(error)) @@ -1674,7 +1675,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual( "Invalid length constraint, expected a mapping", six.text_type(error)) @@ -1691,7 +1692,7 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual( "Invalid key 'foo' for length constraint", six.text_type(error)) @@ -1707,6 +1708,6 @@ class HOTParamValidatorTest(common.HeatTestCase): ''') error = self.assertRaises( exception.InvalidSchemaError, parameters.Parameters, - "stack_testit", parser.Template(hot_tpl)) + "stack_testit", template.Template(hot_tpl)) self.assertEqual( "AllowedPattern must be a string", six.text_type(error)) diff --git a/heat/tests/test_instance.py b/heat/tests/test_instance.py index 2617a5e5f..6ceaaa1e9 100644 --- a/heat/tests/test_instance.py +++ b/heat/tests/test_instance.py @@ -27,10 +27,11 @@ from heat.engine.clients.os import glance from heat.engine.clients.os import neutron from heat.engine.clients.os import nova from heat.engine import environment -from heat.engine import parser from heat.engine import resource from heat.engine.resources.aws.ec2 import instance as instances from heat.engine import scheduler +from heat.engine import stack as parser +from heat.engine import template from heat.tests import common from heat.tests.nova import fakes as fakes_nova from heat.tests import utils @@ -79,11 +80,11 @@ class InstancesTest(common.HeatTestCase): def _setup_test_stack(self, stack_name): t = template_format.parse(wp_template) - template = parser.Template( + tmpl = template.Template( t, env=environment.Environment({'KeyName': 'test'})) - stack = parser.Stack(utils.dummy_context(), stack_name, template, + stack = parser.Stack(utils.dummy_context(), stack_name, tmpl, stack_id=str(uuid.uuid4())) - return (template, stack) + return (tmpl, stack) def _mock_get_image_id_success(self, imageId_input, imageId): self.m.StubOutWithMock(glance.GlanceClientPlugin, 'get_image_id') diff --git a/heat/tests/test_instance_network.py b/heat/tests/test_instance_network.py index 12fdefb66..6329201ac 100644 --- a/heat/tests/test_instance_network.py +++ b/heat/tests/test_instance_network.py @@ -19,10 +19,11 @@ from heat.engine.clients.os import glance from heat.engine.clients.os import neutron from heat.engine.clients.os import nova from heat.engine import environment -from heat.engine import parser from heat.engine.resources.aws.ec2 import instance as instances from heat.engine.resources.aws.ec2 import network_interface as net_interfaces from heat.engine import scheduler +from heat.engine import stack as parser +from heat.engine import template from heat.tests import common from heat.tests.nova import fakes as fakes_nova from heat.tests import utils @@ -201,9 +202,9 @@ class instancesTest(common.HeatTestCase): kwargs = {'KeyName': 'test', 'InstanceType': 'm1.large', 'SubnetId': '4156c7a5-e8c4-4aff-a6e1-8f3c7bc83861'} - template = parser.Template(t, - env=environment.Environment(kwargs)) - stack = parser.Stack(utils.dummy_context(), stack_name, template, + tmpl = template.Template(t, + env=environment.Environment(kwargs)) + stack = parser.Stack(utils.dummy_context(), stack_name, tmpl, stack_id=str(uuid.uuid4())) image_id = 'CentOS 5.2' t['Resources']['WebServer']['Properties']['ImageId'] = image_id @@ -256,9 +257,9 @@ class instancesTest(common.HeatTestCase): kwargs = {'KeyName': 'test', 'InstanceType': 'm1.large', 'SubnetId': '4156c7a5-e8c4-4aff-a6e1-8f3c7bc83861'} - template = parser.Template(t, - env=environment.Environment(kwargs)) - stack = parser.Stack(utils.dummy_context(), stack_name, template, + tmpl = template.Template(t, + env=environment.Environment(kwargs)) + stack = parser.Stack(utils.dummy_context(), stack_name, tmpl, stack_id=str(uuid.uuid4())) image_id = 'CentOS 5.2' t['Resources']['WebServer']['Properties']['ImageId'] = image_id diff --git a/heat/tests/test_metadata_refresh.py b/heat/tests/test_metadata_refresh.py index 38b929785..208077170 100644 --- a/heat/tests/test_metadata_refresh.py +++ b/heat/tests/test_metadata_refresh.py @@ -18,12 +18,13 @@ from oslo_config import cfg from heat.common import identifier from heat.common import template_format from heat.engine import environment -from heat.engine import parser from heat.engine.resources.aws.cfn import wait_condition_handle as aws_wch from heat.engine.resources.aws.ec2 import instance from heat.engine.resources.openstack.nova import server from heat.engine import scheduler from heat.engine import service +from heat.engine import stack as parser +from heat.engine import template as tmpl from heat.tests import common from heat.tests import utils @@ -153,8 +154,8 @@ class MetadataRefreshTest(common.HeatTestCase): def create_stack(self, stack_name='test_stack', params=None): params = params or {} temp = template_format.parse(test_template_metadata) - template = parser.Template(temp, - env=environment.Environment(params)) + template = tmpl.Template(temp, + env=environment.Environment(params)) ctx = utils.dummy_context() stack = parser.Stack(ctx, stack_name, template, disable_rollback=True) @@ -219,7 +220,7 @@ class WaitCondMetadataUpdateTest(common.HeatTestCase): def create_stack(self, stack_name='test_stack'): temp = template_format.parse(test_template_waitcondition) - template = parser.Template(temp) + template = tmpl.Template(temp) ctx = utils.dummy_context() stack = parser.Stack(ctx, stack_name, template, disable_rollback=True) @@ -311,8 +312,8 @@ class MetadataRefreshTestServer(common.HeatTestCase): def create_stack(self, stack_name='test_stack_native', params=None): params = params or {} temp = template_format.parse(test_template_server) - template = parser.Template(temp, - env=environment.Environment(params)) + template = tmpl.Template(temp, + env=environment.Environment(params)) ctx = utils.dummy_context() stack = parser.Stack(ctx, stack_name, template, disable_rollback=True) diff --git a/heat/tests/test_multi_part.py b/heat/tests/test_multi_part.py index 3d3d78679..c00eb266e 100644 --- a/heat/tests/test_multi_part.py +++ b/heat/tests/test_multi_part.py @@ -17,8 +17,8 @@ import uuid import mock from heat.common import exception as exc -from heat.engine import parser from heat.engine.resources.openstack.heat import multi_part as mp +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests import utils diff --git a/heat/tests/test_nested_stack.py b/heat/tests/test_nested_stack.py index b20a7e904..b0c08aed0 100644 --- a/heat/tests/test_nested_stack.py +++ b/heat/tests/test_nested_stack.py @@ -22,10 +22,11 @@ from heat.common import exception from heat.common import identifier from heat.common import template_format from heat.common import urlfetch -from heat.engine import parser from heat.engine import resource from heat.engine.resources.aws.cfn import stack as stack_res from heat.engine import rsrc_defn +from heat.engine import stack as parser +from heat.engine import template from heat.objects import resource_data as resource_data_object from heat.tests import common from heat.tests import generic_resource as generic_rsrc @@ -78,7 +79,7 @@ Outputs: def parse_stack(self, t, data=None): ctx = utils.dummy_context('test_username', 'aaaa', 'password') stack_name = 'test_stack' - tmpl = parser.Template(t) + tmpl = template.Template(t) stack = parser.Stack(ctx, stack_name, tmpl, adopt_stack_data=data) stack.store() return stack @@ -122,7 +123,7 @@ Resources: urlfetch.get.assert_has_calls(calls) def test_nested_stack_six_deep(self): - template = ''' + tmpl = ''' HeatTemplateFormatVersion: 2012-12-12 Resources: Nested: @@ -130,12 +131,12 @@ Resources: Properties: TemplateURL: 'https://server.test/depth%i.template' ''' - root_template = template % 1 - depth1_template = template % 2 - depth2_template = template % 3 - depth3_template = template % 4 - depth4_template = template % 5 - depth5_template = template % 6 + root_template = tmpl % 1 + depth1_template = tmpl % 2 + depth2_template = tmpl % 3 + depth3_template = tmpl % 4 + depth4_template = tmpl % 5 + depth5_template = tmpl % 6 depth5_template += ''' Parameters: KeyName: foo @@ -202,7 +203,7 @@ Resources: urlfetch.get.assert_has_calls(calls, any_order=True) def test_nested_stack_infinite_recursion(self): - template = ''' + tmpl = ''' HeatTemplateFormatVersion: 2012-12-12 Resources: Nested: @@ -210,8 +211,8 @@ Resources: Properties: TemplateURL: 'https://server.test/the.template' ''' - urlfetch.get.return_value = template - t = template_format.parse(template) + urlfetch.get.return_value = tmpl + t = template_format.parse(tmpl) stack = self.parse_stack(t) res = self.assertRaises(exception.StackValidationFailed, stack.validate) @@ -260,7 +261,7 @@ class ResDataResource(generic_rsrc.GenericResource): class ResDataStackTest(common.HeatTestCase): - template = ''' + tmpl = ''' HeatTemplateFormatVersion: "2012-12-12" Parameters: KeyName: @@ -285,7 +286,7 @@ Outputs: return stack def test_res_data_delete(self): - stack = self.create_stack(self.template) + stack = self.create_stack(self.tmpl) res = stack['res'] stack.delete() self.assertEqual((stack.DELETE, stack.COMPLETE), stack.state) @@ -310,7 +311,8 @@ Outputs: self.ctx = utils.dummy_context('test_username', 'aaaa', 'password') empty_template = {"HeatTemplateFormatVersion": "2012-12-12"} - stack = parser.Stack(self.ctx, 'test', parser.Template(empty_template)) + stack = parser.Stack(self.ctx, 'test', + template.Template(empty_template)) stack.store() self.patchobject(urlfetch, 'get', return_value=self.nested_template) diff --git a/heat/tests/test_os_database.py b/heat/tests/test_os_database.py index 31e2df6de..d0b19fb2a 100644 --- a/heat/tests/test_os_database.py +++ b/heat/tests/test_os_database.py @@ -22,11 +22,12 @@ from heat.common import template_format from heat.engine.clients.os import neutron from heat.engine.clients.os import nova from heat.engine.clients.os import trove -from heat.engine import parser from heat.engine import resource from heat.engine.resources.openstack.trove import os_database from heat.engine import rsrc_defn from heat.engine import scheduler +from heat.engine import stack as parser +from heat.engine import template as tmpl from heat.tests import common from heat.tests import utils @@ -105,7 +106,7 @@ class OSDBInstanceTest(common.HeatTestCase): def _setup_test_clouddbinstance(self, name, t): stack_name = '%s_stack' % name - template = parser.Template(t) + template = tmpl.Template(t) stack = parser.Stack(utils.dummy_context(), stack_name, template, diff --git a/heat/tests/test_provider_template.py b/heat/tests/test_provider_template.py index f6a97c342..62d8b6ec2 100644 --- a/heat/tests/test_provider_template.py +++ b/heat/tests/test_provider_template.py @@ -25,13 +25,14 @@ from heat.common import template_format from heat.common import urlfetch from heat.engine import attributes from heat.engine import environment -from heat.engine import parser from heat.engine import properties from heat.engine import resource from heat.engine import resources from heat.engine.resources import template_resource from heat.engine import rsrc_defn +from heat.engine import stack as parser from heat.engine import support +from heat.engine import template from heat.tests import common from heat.tests import generic_resource as generic_rsrc from heat.tests import utils @@ -128,7 +129,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, files=files, + template.Template(empty_template, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -209,7 +210,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, files=files, + template.Template(empty_template, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -238,7 +239,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, files=files, + template.Template(empty_template, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -271,7 +272,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, files=files, + template.Template(empty_template, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -303,7 +304,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, files=files, + template.Template(empty_template, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -333,7 +334,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, files=files, + template.Template(empty_template, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -365,7 +366,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template( + template.Template( {'HeatTemplateFormatVersion': '2012-12-12'}, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -401,7 +402,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template( + template.Template( {'HeatTemplateFormatVersion': '2012-12-12'}, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -433,7 +434,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template( + template.Template( {'HeatTemplateFormatVersion': '2012-12-12'}, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -467,7 +468,7 @@ class ProviderTemplateTest(common.HeatTestCase): {'DummyResource': 'test_resource.template', 'resources': {'foo': 'foo.template'}}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template( + template.Template( {'HeatTemplateFormatVersion': '2012-12-12'}, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -502,7 +503,7 @@ class ProviderTemplateTest(common.HeatTestCase): {'DummyResource': 'test_resource.template', 'resources': {'foo': {'DummyResource': 'foo.template'}}}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template( + template.Template( {'HeatTemplateFormatVersion': '2012-12-12'}, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -546,7 +547,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template( + template.Template( {'HeatTemplateFormatVersion': '2012-12-12'}, files=files, env=env), stack_id=str(uuid.uuid4())) @@ -608,7 +609,7 @@ class ProviderTemplateTest(common.HeatTestCase): self.m.ReplayAll() stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template), + template.Template(empty_template), stack_id=str(uuid.uuid4())) properties = { @@ -659,7 +660,7 @@ class ProviderTemplateTest(common.HeatTestCase): g_env.load({'resource_registry': {'Test::Frodo': test_templ_name}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template), + template.Template(empty_template), stack_id=str(uuid.uuid4())) minimal_temp = json.dumps({'HeatTemplateFormatVersion': '2012-12-12', @@ -687,7 +688,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'Test::Flippy': test_templ_name}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, env=env), + template.Template(empty_template, env=env), stack_id=str(uuid.uuid4())) definition = rsrc_defn.ResourceDefinition('test_t_res', @@ -709,7 +710,7 @@ class ProviderTemplateTest(common.HeatTestCase): g_env.load({'resource_registry': {'Test::Frodo': test_templ_name}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template), + template.Template(empty_template), stack_id=str(uuid.uuid4())) self.m.StubOutWithMock(urlfetch, "get") @@ -739,7 +740,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'Test::Flippy': test_templ_name}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, env=env), + template.Template(empty_template, env=env), stack_id=str(uuid.uuid4())) self.m.StubOutWithMock(urlfetch, "get") @@ -768,7 +769,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'Test::Flippy': test_templ_name}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, env=env), + template.Template(empty_template, env=env), stack_id=str(uuid.uuid4())) self.m.ReplayAll() @@ -791,7 +792,7 @@ class ProviderTemplateTest(common.HeatTestCase): env.load({'resource_registry': {'Test::Tmpl': test_templ_name}}) stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, env=env), + template.Template(empty_template, env=env), stack_id=str(uuid.uuid4())) self.m.StubOutWithMock(urlfetch, "get") @@ -838,8 +839,8 @@ class TemplateResourceCrudTest(common.HeatTestCase): env.load({'resource_registry': {'DummyResource': 'test_resource.template'}}) stack = parser.Stack(self.ctx, 'test_stack', - parser.Template(empty_template, files=files, - env=env), + template.Template(empty_template, files=files, + env=env), stack_id=str(uuid.uuid4())) self.defn = rsrc_defn.ResourceDefinition('test_t_res', diff --git a/heat/tests/test_random_string.py b/heat/tests/test_random_string.py index 436ea0521..6453d4b2b 100644 --- a/heat/tests/test_random_string.py +++ b/heat/tests/test_random_string.py @@ -18,8 +18,8 @@ from testtools import matchers from heat.common import exception from heat.common import template_format -from heat.engine import parser from heat.engine.resources.openstack.heat import random_string as rs +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests import utils diff --git a/heat/tests/test_remote_stack.py b/heat/tests/test_remote_stack.py index 8bb0ea1c1..f0168ad53 100644 --- a/heat/tests/test_remote_stack.py +++ b/heat/tests/test_remote_stack.py @@ -23,11 +23,12 @@ from heat.common import exception from heat.common.i18n import _ from heat.common import template_format from heat.engine import environment -from heat.engine import parser from heat.engine import resource from heat.engine.resources.openstack.heat import remote_stack from heat.engine import rsrc_defn from heat.engine import scheduler +from heat.engine import stack +from heat.engine import template from heat.tests import common as tests_common from heat.tests import utils @@ -168,8 +169,8 @@ class RemoteStackTest(tests_common.HeatTestCase): self.this_context = utils.dummy_context( region_name=self.this_region) - tmpl = parser.Template(snippet, files=self.files) - parent = parser.Stack(self.this_context, 'parent_stack', tmpl) + tmpl = template.Template(snippet, files=self.files) + parent = stack.Stack(self.this_context, 'parent_stack', tmpl) # parent context checking ctx = parent.context.to_dict() diff --git a/heat/tests/test_resource.py b/heat/tests/test_resource.py index 5a4e51a76..9c6b4b588 100644 --- a/heat/tests/test_resource.py +++ b/heat/tests/test_resource.py @@ -30,12 +30,12 @@ from heat.engine.cfn import functions as cfn_funcs from heat.engine import constraints from heat.engine import dependencies from heat.engine import environment -from heat.engine import parser from heat.engine import properties from heat.engine import resource from heat.engine import resources from heat.engine import rsrc_defn from heat.engine import scheduler +from heat.engine import stack as parser from heat.engine import template from heat.objects import resource as resource_objects from heat.objects import resource_data as resource_data_object @@ -65,8 +65,8 @@ class ResourceTest(common.HeatTestCase): u'ResourceWithCustomConstraint'}}) self.stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, - env=self.env), + template.Template(empty_template, + env=self.env), stack_id=str(uuid.uuid4())) self.patch('heat.engine.resource.warnings') @@ -400,7 +400,7 @@ class ResourceTest(common.HeatTestCase): tmpl2 = rsrc_defn.ResourceDefinition('test_resource', 'Foo') tmpl3 = rsrc_defn.ResourceDefinition('test_resource2', 'Bar') stack2 = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template), stack_id=-1) + template.Template(empty_template), stack_id=-1) res1 = generic_rsrc.GenericResource('test_resource', tmpl1, self.stack) res2 = generic_rsrc.GenericResource('test_resource', tmpl2, stack2) res3 = generic_rsrc.GenericResource('test_resource2', tmpl3, stack2) @@ -1797,7 +1797,7 @@ class MetadataTest(common.HeatTestCase): super(MetadataTest, self).setUp() self.stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template)) + template.Template(empty_template)) self.stack.store() metadata = {'Test': 'Initial metadata'} @@ -1910,8 +1910,8 @@ class ResourceHookTest(common.HeatTestCase): u'ResourceWithCustomConstraint'}}) self.stack = parser.Stack(utils.dummy_context(), 'test_stack', - parser.Template(empty_template, - env=self.env), + template.Template(empty_template, + env=self.env), stack_id=str(uuid.uuid4())) def test_hook(self): diff --git a/heat/tests/test_security_group.py b/heat/tests/test_security_group.py index 62723a487..e0c6fc0b3 100644 --- a/heat/tests/test_security_group.py +++ b/heat/tests/test_security_group.py @@ -23,9 +23,9 @@ from novaclient.v2 import security_groups as nova_sg from heat.common import exception from heat.common import template_format from heat.engine.clients.os import nova -from heat.engine import parser from heat.engine import rsrc_defn from heat.engine import scheduler +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests.nova import fakes as fakes_nova diff --git a/heat/tests/test_server.py b/heat/tests/test_server.py index 5dc4df865..d30bcaf15 100644 --- a/heat/tests/test_server.py +++ b/heat/tests/test_server.py @@ -28,10 +28,10 @@ from heat.engine.clients.os import neutron from heat.engine.clients.os import nova from heat.engine.clients.os import swift from heat.engine import environment -from heat.engine import parser from heat.engine import resource from heat.engine.resources.openstack.nova import server as servers from heat.engine import scheduler +from heat.engine import stack as parser from heat.engine import template from heat.objects import resource_data as resource_data_object from heat.tests import common @@ -3066,8 +3066,8 @@ class ServersTest(common.HeatTestCase): def test_server_restore(self): t = template_format.parse(wp_template) - template = parser.Template(t) - stack = parser.Stack(utils.dummy_context(), "server_restore", template) + tmpl = template.Template(t) + stack = parser.Stack(utils.dummy_context(), "server_restore", tmpl) stack.store() self.m.StubOutWithMock(nova.NovaClientPlugin, '_create') diff --git a/heat/tests/test_server_tags.py b/heat/tests/test_server_tags.py index 02bf8bd7b..67630c9a6 100644 --- a/heat/tests/test_server_tags.py +++ b/heat/tests/test_server_tags.py @@ -18,9 +18,10 @@ from heat.common import template_format from heat.engine.clients.os import glance from heat.engine.clients.os import nova from heat.engine import environment -from heat.engine import parser from heat.engine.resources.aws.ec2 import instance as instances from heat.engine import scheduler +from heat.engine import stack as parser +from heat.engine import template as tmpl from heat.tests import common from heat.tests.nova import fakes as fakes_nova from heat.tests import utils @@ -65,9 +66,9 @@ class ServerTagsTest(common.HeatTestCase): def _setup_test_instance(self, intags=None, nova_tags=None): stack_name = 'tag_test' t = template_format.parse(instance_template) - template = parser.Template(t, - env=environment.Environment( - {'KeyName': 'test'})) + template = tmpl.Template(t, + env=environment.Environment( + {'KeyName': 'test'})) stack = parser.Stack(utils.dummy_context(), stack_name, template, stack_id=str(uuid.uuid4())) diff --git a/heat/tests/test_signal.py b/heat/tests/test_signal.py index 1d42d17a3..d91ff9696 100644 --- a/heat/tests/test_signal.py +++ b/heat/tests/test_signal.py @@ -18,10 +18,10 @@ from oslo_config import cfg from heat.common import exception from heat.common import template_format -from heat.engine import parser from heat.engine import resource from heat.engine.resources import stack_user from heat.engine import scheduler +from heat.engine import stack as parser from heat.engine import template from heat.objects import resource_data as resource_data_object from heat.tests import common diff --git a/heat/tests/test_software_config.py b/heat/tests/test_software_config.py index 01cbd1331..3c78de46d 100644 --- a/heat/tests/test_software_config.py +++ b/heat/tests/test_software_config.py @@ -14,8 +14,8 @@ import mock from heat.common import exception as exc -from heat.engine import parser from heat.engine.resources.openstack.heat import software_config as sc +from heat.engine import stack from heat.engine import template from heat.tests import common from heat.tests import utils @@ -33,7 +33,7 @@ class SoftwareConfigTest(common.HeatTestCase): 'options': {}, 'config': '#!/bin/bash' } - self.stack = parser.Stack( + self.stack = stack.Stack( self.ctx, 'software_config_test_stack', template.Template({ 'HeatTemplateFormatVersion': '2012-12-12', diff --git a/heat/tests/test_software_deployment.py b/heat/tests/test_software_deployment.py index e8fbf7685..c7334bf21 100644 --- a/heat/tests/test_software_deployment.py +++ b/heat/tests/test_software_deployment.py @@ -22,9 +22,9 @@ from heat.common import exception as exc from heat.common.i18n import _ from heat.engine.clients.os import nova from heat.engine.clients.os import swift -from heat.engine import parser from heat.engine.resources.openstack.heat import software_deployment as sd from heat.engine import rsrc_defn +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests import utils diff --git a/heat/tests/test_stack_collect_attributes.py b/heat/tests/test_stack_collect_attributes.py index 56faf19d0..567be6a07 100644 --- a/heat/tests/test_stack_collect_attributes.py +++ b/heat/tests/test_stack_collect_attributes.py @@ -12,8 +12,8 @@ # under the License. from heat.common import template_format -from heat.engine import parser from heat.engine import resource +from heat.engine import stack from heat.engine import template from heat.tests import common from heat.tests import generic_resource as generic_rsrc @@ -171,8 +171,8 @@ class DepAttrsTest(common.HeatTestCase): def test_dep_attrs(self): parsed_tmpl = template_format.parse(self.tmpl) - self.stack = parser.Stack(self.ctx, 'test_stack', - template.Template(parsed_tmpl)) + self.stack = stack.Stack(self.ctx, 'test_stack', + template.Template(parsed_tmpl)) resources = self.stack.resources.values() outputs = self.stack.outputs diff --git a/heat/tests/test_structured_config.py b/heat/tests/test_structured_config.py index cbf92320b..3b37c2dd1 100644 --- a/heat/tests/test_structured_config.py +++ b/heat/tests/test_structured_config.py @@ -14,8 +14,8 @@ import mock from heat.common import exception -from heat.engine import parser from heat.engine.resources.openstack.heat import structured_config as sc +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests import utils diff --git a/heat/tests/test_validate.py b/heat/tests/test_validate.py index 20a21b136..de7ca3b7b 100644 --- a/heat/tests/test_validate.py +++ b/heat/tests/test_validate.py @@ -20,10 +20,11 @@ from heat.common import template_format from heat.engine.clients.os import glance from heat.engine.clients.os import nova from heat.engine import environment -from heat.engine.hot import template as tmpl -from heat.engine import parser +from heat.engine.hot import template as hot_tmpl from heat.engine import resources from heat.engine import service +from heat.engine import stack as parser +from heat.engine import template as tmpl from heat.tests import common from heat.tests.nova import fakes as fakes_nova from heat.tests import utils @@ -832,14 +833,14 @@ class validateTest(common.HeatTestCase): def test_validate_volumeattach_valid(self): t = template_format.parse(test_template_volumeattach % 'vdq') - stack = parser.Stack(self.ctx, 'test_stack', parser.Template(t)) + stack = parser.Stack(self.ctx, 'test_stack', tmpl.Template(t)) volumeattach = stack['MountPoint'] self.assertIsNone(volumeattach.validate()) def test_validate_volumeattach_invalid(self): t = template_format.parse(test_template_volumeattach % 'sda') - stack = parser.Stack(self.ctx, 'test_stack', parser.Template(t)) + stack = parser.Stack(self.ctx, 'test_stack', tmpl.Template(t)) volumeattach = stack['MountPoint'] self.assertRaises(exception.StackValidationFailed, @@ -1246,7 +1247,7 @@ class validateTest(common.HeatTestCase): def test_unregistered_key(self): t = template_format.parse(test_unregistered_key) params = {'KeyName': 'not_registered'} - template = parser.Template(t, env=environment.Environment(params)) + template = tmpl.Template(t, env=environment.Environment(params)) stack = parser.Stack(self.ctx, 'test_stack', template) self._mock_get_image_id_success('image_name', 'image_id') @@ -1258,9 +1259,9 @@ class validateTest(common.HeatTestCase): def test_unregistered_image(self): t = template_format.parse(test_template_image) - template = parser.Template(t, - env=environment.Environment( - {'KeyName': 'test'})) + template = tmpl.Template(t, + env=environment.Environment( + {'KeyName': 'test'})) stack = parser.Stack(self.ctx, 'test_stack', template) @@ -1276,9 +1277,9 @@ class validateTest(common.HeatTestCase): def test_duplicated_image(self): t = template_format.parse(test_template_image) - template = parser.Template(t, - env=environment.Environment( - {'KeyName': 'test'})) + template = tmpl.Template(t, + env=environment.Environment( + {'KeyName': 'test'})) stack = parser.Stack(self.ctx, 'test_stack', template) @@ -1296,9 +1297,9 @@ class validateTest(common.HeatTestCase): def test_invalid_security_groups_with_nics(self): t = template_format.parse(test_template_invalid_secgroups) - template = parser.Template(t, - env=environment.Environment( - {'KeyName': 'test'})) + template = tmpl.Template(t, + env=environment.Environment( + {'KeyName': 'test'})) stack = parser.Stack(self.ctx, 'test_stack', template) self._mock_get_image_id_success('image_name', 'image_id') @@ -1314,7 +1315,7 @@ class validateTest(common.HeatTestCase): def test_invalid_security_group_ids_with_nics(self): t = template_format.parse(test_template_invalid_secgroupids) - template = parser.Template( + template = tmpl.Template( t, env=environment.Environment({'KeyName': 'test'})) stack = parser.Stack(self.ctx, 'test_stack', template) @@ -1331,7 +1332,7 @@ class validateTest(common.HeatTestCase): def test_client_exception_from_glance_client(self): t = template_format.parse(test_template_glance_client_exception) - template = parser.Template(t) + template = tmpl.Template(t) stack = parser.Stack(self.ctx, 'test_stack', template) self.m.StubOutWithMock(self.gc.images, 'list') @@ -1346,7 +1347,7 @@ class validateTest(common.HeatTestCase): def test_validate_unique_logical_name(self): t = template_format.parse(test_template_unique_logical_name) - template = parser.Template( + template = tmpl.Template( t, env=environment.Environment( {'AName': 'test', 'KeyName': 'test'})) stack = parser.Stack(self.ctx, 'test_stack', template) @@ -1355,7 +1356,7 @@ class validateTest(common.HeatTestCase): def test_validate_duplicate_parameters_in_group(self): t = template_format.parse(test_template_duplicate_parameters) - template = tmpl.HOTemplate20130523( + template = hot_tmpl.HOTemplate20130523( t, env=environment.Environment({ 'KeyName': 'test', 'ImageId': 'sometestid', @@ -1370,11 +1371,11 @@ class validateTest(common.HeatTestCase): def test_validate_invalid_parameter_in_group(self): t = template_format.parse(test_template_invalid_parameter_name) - template = tmpl.HOTemplate20130523(t, - env=environment.Environment({ - 'KeyName': 'test', - 'ImageId': 'sometestid', - 'db_password': 'Pass123'})) + template = hot_tmpl.HOTemplate20130523(t, + env=environment.Environment({ + 'KeyName': 'test', + 'ImageId': 'sometestid', + 'db_password': 'Pass123'})) stack = parser.Stack(self.ctx, 'test_stack', template) exc = self.assertRaises(exception.StackValidationFailed, @@ -1386,7 +1387,7 @@ class validateTest(common.HeatTestCase): def test_validate_no_parameters_in_group(self): t = template_format.parse(test_template_no_parameters) - template = tmpl.HOTemplate20130523(t) + template = hot_tmpl.HOTemplate20130523(t) stack = parser.Stack(self.ctx, 'test_stack', template) exc = self.assertRaises(exception.StackValidationFailed, stack.validate) @@ -1396,8 +1397,8 @@ class validateTest(common.HeatTestCase): def test_validate_allowed_values_integer(self): t = template_format.parse(test_template_allowed_integers) - template = parser.Template(t, - env=environment.Environment({'size': '4'})) + template = tmpl.Template(t, + env=environment.Environment({'size': '4'})) # test with size parameter provided as string stack = parser.Stack(self.ctx, 'test_stack', template) @@ -1410,8 +1411,8 @@ class validateTest(common.HeatTestCase): def test_validate_allowed_values_integer_str(self): t = template_format.parse(test_template_allowed_integers_str) - template = parser.Template(t, - env=environment.Environment({'size': '4'})) + template = tmpl.Template(t, + env=environment.Environment({'size': '4'})) # test with size parameter provided as string stack = parser.Stack(self.ctx, 'test_stack', template) @@ -1423,8 +1424,8 @@ class validateTest(common.HeatTestCase): def test_validate_not_allowed_values_integer(self): t = template_format.parse(test_template_allowed_integers) - template = parser.Template(t, - env=environment.Environment({'size': '3'})) + template = tmpl.Template(t, + env=environment.Environment({'size': '3'})) # test with size parameter provided as string stack = parser.Stack(self.ctx, 'test_stack', template) @@ -1443,8 +1444,8 @@ class validateTest(common.HeatTestCase): def test_validate_not_allowed_values_integer_str(self): t = template_format.parse(test_template_allowed_integers_str) - template = parser.Template(t, - env=environment.Environment({'size': '3'})) + template = tmpl.Template(t, + env=environment.Environment({'size': '3'})) # test with size parameter provided as string stack = parser.Stack(self.ctx, 'test_stack', template) @@ -1463,7 +1464,7 @@ class validateTest(common.HeatTestCase): def test_validate_invalid_outputs(self): t = template_format.parse(test_template_invalid_outputs) - template = parser.Template(t) + template = tmpl.Template(t) err = self.assertRaises(exception.StackValidationFailed, parser.Stack, self.ctx, 'test_stack', template) error_message = ('Arguments to "get_attr" must be of the form ' @@ -1477,7 +1478,7 @@ class validateTest(common.HeatTestCase): resource: type: 123 """) - template = parser.Template(t) + template = tmpl.Template(t) stack = parser.Stack(self.ctx, 'test_stack', template) ex = self.assertRaises(exception.StackValidationFailed, stack.validate) self.assertEqual('Resource resource type type must be string', @@ -1490,7 +1491,7 @@ class validateTest(common.HeatTestCase): Resource: Type: [Wrong, Type] """) - stack = parser.Stack(self.ctx, 'test_stack', parser.Template(t)) + stack = parser.Stack(self.ctx, 'test_stack', tmpl.Template(t)) ex = self.assertRaises(exception.StackValidationFailed, stack.validate) self.assertEqual('Resource Resource Type type must be string', six.text_type(ex)) diff --git a/heat/tests/test_vpc.py b/heat/tests/test_vpc.py index f946e6815..08034f2fc 100644 --- a/heat/tests/test_vpc.py +++ b/heat/tests/test_vpc.py @@ -15,9 +15,9 @@ import uuid from heat.common import exception from heat.common import template_format -from heat.engine import parser from heat.engine.resources.aws.ec2 import subnet as sn from heat.engine import scheduler +from heat.engine import stack as parser from heat.engine import template from heat.tests import common from heat.tests import utils @@ -454,7 +454,7 @@ Resources: self.m.ReplayAll() t = template_format.parse(self.test_template) - tmpl = parser.Template(t) + tmpl = template.Template(t) stack = parser.Stack(utils.dummy_context(), 'test_subnet_', tmpl, stack_id=str(uuid.uuid4())) tmpl.t['Resources']['the_subnet']['Properties']['VpcId'] = 'aaaa' diff --git a/heat/tests/test_watch.py b/heat/tests/test_watch.py index d13e78b1a..57ee8121c 100644 --- a/heat/tests/test_watch.py +++ b/heat/tests/test_watch.py @@ -18,7 +18,7 @@ import mox from oslo_utils import timeutils from heat.common import exception -from heat.engine import parser +from heat.engine import stack from heat.engine import template from heat.engine import watchrule from heat.objects import watch_rule @@ -50,7 +50,7 @@ class WatchRuleTest(common.HeatTestCase): empty_tmpl = {'HeatTemplateFormatVersion': '2012-12-12'} tmpl = template.Template(empty_tmpl) stack_name = 'dummystack' - dummy_stack = parser.Stack(ctx, stack_name, tmpl) + dummy_stack = stack.Stack(ctx, stack_name, tmpl) dummy_stack.state_set(dummy_stack.CREATE, dummy_stack.COMPLETE, 'Testing') dummy_stack.store() @@ -74,8 +74,8 @@ class WatchRuleTest(common.HeatTestCase): if action_expected: dummy_action = DummyAction() - self.m.StubOutWithMock(parser.Stack, 'resource_by_refid') - parser.Stack.resource_by_refid( + self.m.StubOutWithMock(stack.Stack, 'resource_by_refid') + stack.Stack.resource_by_refid( mox.IgnoreArg()).MultipleTimes().AndReturn(dummy_action) self.m.ReplayAll()