Merge "Get rid of the Resource.resource_class() method"
This commit is contained in:
commit
84a7bfa3bf
|
@ -391,19 +391,6 @@ class Resource(object):
|
|||
# common resources have not nested, StackResource overrides it
|
||||
return False
|
||||
|
||||
def resource_class(self):
|
||||
"""Return the resource class.
|
||||
|
||||
This is used to compare old and new resources when updating, to ensure
|
||||
that in-place updates are possible. This method shold return the
|
||||
highest common class in the hierarchy whose subclasses are all capable
|
||||
of converting to each other's types via handle_update().
|
||||
|
||||
This mechanism may disappear again in future, so third-party resource
|
||||
types should not rely on it.
|
||||
"""
|
||||
return type(self)
|
||||
|
||||
def has_hook(self, hook):
|
||||
# Clear the cache to make sure the data is up to date:
|
||||
self._data = None
|
||||
|
|
|
@ -65,11 +65,6 @@ class TemplateResource(stack_resource.StackResource):
|
|||
if self.validation_exception is None:
|
||||
self._generate_schema(self.t)
|
||||
|
||||
def resource_class(self):
|
||||
# All TemplateResource subclasses can be converted to each other with
|
||||
# a stack update, so allow them to cross-update in place.
|
||||
return TemplateResource
|
||||
|
||||
def _get_resource_info(self, rsrc_defn):
|
||||
try:
|
||||
tri = self.stack.env.get_resource_info(
|
||||
|
|
|
@ -135,10 +135,9 @@ class StackUpdate(object):
|
|||
@scheduler.wrappertask
|
||||
def _process_new_resource_update(self, new_res):
|
||||
res_name = new_res.name
|
||||
res_class = new_res.resource_class()
|
||||
|
||||
if (res_name in self.existing_stack and
|
||||
self.existing_stack[res_name].resource_class() is res_class):
|
||||
type(self.existing_stack[res_name]) is type(new_res)):
|
||||
existing_res = self.existing_stack[res_name]
|
||||
try:
|
||||
yield self._update_in_place(existing_res,
|
||||
|
|
Loading…
Reference in New Issue