Merge "Remove the Resource.parsed_template() method"
This commit is contained in:
commit
27cdf37578
@ -14,7 +14,6 @@
|
|||||||
import base64
|
import base64
|
||||||
import contextlib
|
import contextlib
|
||||||
import datetime as dt
|
import datetime as dt
|
||||||
import warnings
|
|
||||||
import weakref
|
import weakref
|
||||||
|
|
||||||
from oslo_config import cfg
|
from oslo_config import cfg
|
||||||
@ -515,23 +514,6 @@ class Resource(object):
|
|||||||
return identifier.ResourceIdentifier(resource_name=self.name,
|
return identifier.ResourceIdentifier(resource_name=self.name,
|
||||||
**self.stack.identifier())
|
**self.stack.identifier())
|
||||||
|
|
||||||
def parsed_template(self, section=None, default=None):
|
|
||||||
"""Return the parsed template data for the resource.
|
|
||||||
|
|
||||||
May be limited to only one section of the data, in which case a default
|
|
||||||
value may also be supplied.
|
|
||||||
"""
|
|
||||||
warnings.warn('Resource.parsed_template() is deprecated and will be '
|
|
||||||
'removed in the Ocata release. Use the '
|
|
||||||
'ResourceDefinition API instead.',
|
|
||||||
DeprecationWarning)
|
|
||||||
|
|
||||||
frozen = self.t.freeze()
|
|
||||||
if section is None:
|
|
||||||
return frozen
|
|
||||||
|
|
||||||
return frozen.get(section, default or {})
|
|
||||||
|
|
||||||
def frozen_definition(self):
|
def frozen_definition(self):
|
||||||
if self._stored_properties_data is not None:
|
if self._stored_properties_data is not None:
|
||||||
args = {'properties': self._stored_properties_data}
|
args = {'properties': self._stored_properties_data}
|
||||||
|
@ -589,29 +589,6 @@ class ResourceTest(common.HeatTestCase):
|
|||||||
self.assertIsNone(new_res.physical_resource_id)
|
self.assertIsNone(new_res.physical_resource_id)
|
||||||
self.assertEqual(new_tmpl_id, new_res.current_template_id)
|
self.assertEqual(new_tmpl_id, new_res.current_template_id)
|
||||||
|
|
||||||
def test_parsed_template(self):
|
|
||||||
join_func = cfn_funcs.Join(None,
|
|
||||||
'Fn::Join', [' ', ['bar', 'baz', 'quux']])
|
|
||||||
tmpl = rsrc_defn.ResourceDefinition('test_resource', 'Foo',
|
|
||||||
metadata={'foo': join_func})
|
|
||||||
res = generic_rsrc.GenericResource('test_resource', tmpl, self.stack)
|
|
||||||
|
|
||||||
parsed_tmpl = res.parsed_template()
|
|
||||||
self.assertEqual('Foo', parsed_tmpl['Type'])
|
|
||||||
self.assertEqual('bar baz quux', parsed_tmpl['Metadata']['foo'])
|
|
||||||
|
|
||||||
self.assertEqual({'foo': 'bar baz quux'},
|
|
||||||
res.parsed_template('Metadata'))
|
|
||||||
self.assertEqual({'foo': 'bar baz quux'},
|
|
||||||
res.parsed_template('Metadata', {'foo': 'bar'}))
|
|
||||||
|
|
||||||
def test_parsed_template_default(self):
|
|
||||||
tmpl = rsrc_defn.ResourceDefinition('test_resource', 'Foo')
|
|
||||||
res = generic_rsrc.GenericResource('test_resource', tmpl, self.stack)
|
|
||||||
self.assertEqual({}, res.parsed_template('Metadata'))
|
|
||||||
self.assertEqual({'foo': 'bar'},
|
|
||||||
res.parsed_template('Metadata', {'foo': 'bar'}))
|
|
||||||
|
|
||||||
def test_metadata_default(self):
|
def test_metadata_default(self):
|
||||||
tmpl = rsrc_defn.ResourceDefinition('test_resource', 'Foo')
|
tmpl = rsrc_defn.ResourceDefinition('test_resource', 'Foo')
|
||||||
res = generic_rsrc.GenericResource('test_resource', tmpl, self.stack)
|
res = generic_rsrc.GenericResource('test_resource', tmpl, self.stack)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user