diff options
author | huangtianhua <huangtianhua@huawei.com> | 2017-02-09 16:22:19 +0800 |
---|---|---|
committer | huangtianhua <huangtianhua@huawei.com> | 2017-05-27 01:43:05 +0000 |
commit | 088156e49b0d3dfa09ee4004233009fe698ceced (patch) | |
tree | fc98485c1a83cd474d5e4a07c8d377deda05a06f | |
parent | 4bc9acca7fc9a33843524324e21dcbb3b1218961 (diff) | |
download | heat-088156e49b0d3dfa09ee4004233009fe698ceced.tar.gz |
Remove deprecated functions
Change-Id: Ic41eb9782a3bb4bd716f6f06dccc3428c4a94306
-rw-r--r-- | heat/engine/parameters.py | 30 | ||||
-rw-r--r-- | heat/engine/resources/stack_resource.py | 7 | ||||
-rw-r--r-- | heat/engine/template.py | 73 | ||||
-rw-r--r-- | heat/tests/test_template.py | 3 |
4 files changed, 8 insertions, 105 deletions
diff --git a/heat/engine/parameters.py b/heat/engine/parameters.py index 04c6f852b..61b4f3034 100644 --- a/heat/engine/parameters.py +++ b/heat/engine/parameters.py @@ -14,7 +14,6 @@ import abc import collections import itertools -import warnings from oslo_serialization import jsonutils from oslo_utils import encodeutils @@ -565,34 +564,9 @@ class Parameters(collections.Mapping): if param not in schemata: raise exception.UnknownUserParameter(key=param) + @abc.abstractmethod def _pseudo_parameters(self, stack_identifier): - warnings.warn("Parameters._pseudo_parameters() is deprecated and " - "will become an abstract method in future. Subclasses " - "should override it to provide their own pseudo " - "parameters.", DeprecationWarning) - stack_id = (stack_identifier.arn() - if stack_identifier is not None else 'None') - stack_name = stack_identifier and stack_identifier.stack_name - - yield Parameter('AWS::StackId', - Schema(Schema.STRING, _('Stack ID'), - default=str(stack_id))) - if stack_name: - yield Parameter('AWS::StackName', - Schema(Schema.STRING, _('Stack Name'), - default=stack_name)) - yield Parameter('AWS::Region', - Schema(Schema.STRING, - default='ap-southeast-1', - constraints=[ - constr.AllowedValues(['us-east-1', - 'us-west-1', - 'us-west-2', - 'sa-east-1', - 'eu-west-1', - 'ap-southeast-1', - 'ap-northeast-1'] - )])) + pass def immutable_params_modified(self, new_parameters, input_params): # A parameter must have been present in the old stack for its diff --git a/heat/engine/resources/stack_resource.py b/heat/engine/resources/stack_resource.py index b5a542399..c1f4ccf86 100644 --- a/heat/engine/resources/stack_resource.py +++ b/heat/engine/resources/stack_resource.py @@ -12,7 +12,6 @@ # under the License. import json -import warnings import weakref from oslo_config import cfg @@ -336,12 +335,6 @@ class StackResource(resource.Resource): 'files': parsed_template.files, } - def raise_local_exception(self, ex): - warnings.warn('raise_local_exception() is deprecated. Use the ' - 'translate_remote_exceptions context manager instead.', - DeprecationWarning) - return self.translate_remote_exceptions(ex) - @excutils.exception_filter def translate_remote_exceptions(self, ex): if (isinstance(ex, exception.ActionInProgress) and diff --git a/heat/engine/template.py b/heat/engine/template.py index dbc8a47be..5aa6c51f6 100644 --- a/heat/engine/template.py +++ b/heat/engine/template.py @@ -16,7 +16,6 @@ import collections import copy import functools import hashlib -import warnings import six from stevedore import extension @@ -26,7 +25,6 @@ from heat.common.i18n import _ from heat.engine import conditions from heat.engine import environment from heat.engine import function -from heat.engine import output from heat.engine import template_files from heat.objects import raw_template as template_object @@ -207,40 +205,6 @@ class Template(collections.Mapping): """Return a parameters.Parameters object for the stack.""" pass - @classmethod - def validate_resource_key_type(cls, key, valid_types, typename, - allowed_keys, rsrc_name, rsrc_data): - """Validate the type of the value provided for a specific resource key. - - This method is deprecated. This is a utility function previously used - by the HOT and CFN template implementations. Its API makes no sense - since it attempts to check both properties of user-provided keys - (i.e. whether they're valid keys) and properties that must necessarily - be associated with a pre-defined whitelist of keys (i.e. knowing what - types the values should be associated with). This method will be - removed in a future version of Heat. - """ - warnings.warn("The validate_resource_key_type() method doesn't make " - "any sense and will be removed in a future version of " - "Heat. Template subclasses should define any " - "validation utility functions they need themselves.", - DeprecationWarning) - - if key not in allowed_keys: - raise ValueError(_('"%s" is not a valid ' - 'keyword inside a resource ' - 'definition') % key) - if key in rsrc_data: - if not isinstance(rsrc_data.get(key), valid_types): - args = {'name': rsrc_name, 'key': key, - 'typename': typename} - message = _('Resource %(name)s %(key)s type ' - 'must be %(typename)s') % args - raise TypeError(message) - return True - else: - return False - def validate_resource_definitions(self, stack): """Check validity of resource definitions. @@ -256,41 +220,10 @@ class Template(collections.Mapping): """Return a dictionary of resolved conditions.""" return conditions.Conditions({}) + @abc.abstractmethod def outputs(self, stack): - warnings.warn("The default implementation of the outputs() method " - "is deprecated, and this method could become an " - "abstractmethod as early as the Pike release. " - "Template subclasses should override this method with " - "a custom implementation for their particular template " - "format.", - DeprecationWarning) - - outputs = self.parse(stack, self[self.OUTPUTS], path=self.OUTPUTS) - - def get_outputs(): - for key, val in outputs.items(): - if not isinstance(val, collections.Mapping): - message = _('Outputs must contain Output. ' - 'Found a [%s] instead') % type(val) - raise exception.StackValidationFailed( - error='Output validation error', - path=[self.OUTPUTS, key], - message=message) - - if self.OUTPUT_VALUE not in val: - message = _('Each output must contain ' - 'a %s key.') % self.OUTPUT_VALUE - raise exception.StackValidationFailed( - error='Output validation error', - path=[self.OUTPUTS, key], - message=message) - - value_def = val[self.OUTPUT_VALUE] - description = val.get(self.OUTPUT_DESCRIPTION) - - yield key, output.OutputDefinition(key, value_def, description) - - return dict(get_outputs()) + """Return a dictionary of OutputDefinition objects.""" + pass @abc.abstractmethod def resource_definitions(self, stack): diff --git a/heat/tests/test_template.py b/heat/tests/test_template.py index 3bb84ce03..e51cc2203 100644 --- a/heat/tests/test_template.py +++ b/heat/tests/test_template.py @@ -142,6 +142,9 @@ class TestTemplatePluginManager(common.HeatTestCase): def add_resource(self, definition, name=None): pass + def outputs(self, stack): + pass + def __getitem__(self, section): return {} |