Remove implementation_signature check

Remove the unnecessary checking of implementation signature of
current resource with the prev_resource in needs_update.
It seems prev_resource is always resource from the backup_stack
and there would be no difference.

If there is a change of implementation class, it would have been
already handled[1]

[1]
https://github.com/openstack/heat/blob/master/heat/engine/update.py#L139-L140

Change-Id: I1df84986cbc4bae7bcdbaae8b5aacbfa7adaec32
This commit is contained in:
Rabi Mishra 2016-01-25 17:11:50 +05:30 committed by Steve Baker
parent 6caa70c00b
commit b1e320ea66
4 changed files with 0 additions and 48 deletions

View File

@ -427,15 +427,6 @@ class Resource(object):
else: else:
return ri.name == resource_type return ri.name == resource_type
def implementation_signature(self):
"""Return a tuple defining the implementation.
This should be broken down into a definition and an
implementation version.
"""
return (self.__class__.__name__, self.support_status.version)
def identifier(self): def identifier(self):
"""Return an identifier for this resource.""" """Return an identifier for this resource."""
return identifier.ResourceIdentifier(resource_name=self.name, return identifier.ResourceIdentifier(resource_name=self.name,
@ -865,15 +856,6 @@ class Resource(object):
and self.status == self.COMPLETE): and self.status == self.COMPLETE):
raise exception.UpdateReplace(self) raise exception.UpdateReplace(self)
if prev_resource is not None:
cur_class_def, cur_ver = self.implementation_signature()
prev_class_def, prev_ver = prev_resource.implementation_signature()
if prev_class_def != cur_class_def:
raise exception.UpdateReplace(self.name)
if prev_ver != cur_ver:
return True
if before != after.freeze(): if before != after.freeze():
return True return True

View File

@ -11,12 +11,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import hashlib
import json import json
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslo_serialization import jsonutils
from oslo_utils import excutils from oslo_utils import excutils
import six import six
@ -530,12 +528,3 @@ class StackResource(resource.Resource):
def _resolve_attribute(self, name): def _resolve_attribute(self, name):
return self.get_output(name) return self.get_output(name)
def implementation_signature(self):
schema_names = ([prop for prop in self.properties_schema] +
[at for at in self.attributes_schema])
schema_hash = hashlib.sha256(';'.join(schema_names))
definition = {'template': self.child_template(),
'files': self.stack.t.files}
definition_hash = hashlib.sha256(jsonutils.dumps(definition))
return (schema_hash.hexdigest(), definition_hash.hexdigest())

View File

@ -178,10 +178,6 @@ class TemplateResource(stack_resource.StackResource):
self._get_resource_info(definition) self._get_resource_info(definition)
self._generate_schema(definition) self._generate_schema(definition)
def implementation_signature(self):
self._generate_schema(self.t)
return super(TemplateResource, self).implementation_signature()
def template_data(self): def template_data(self):
# we want to have the latest possible template. # we want to have the latest possible template.
# 1. look in files # 1. look in files

View File

@ -19,7 +19,6 @@ from oslo_config import cfg
from oslo_messaging import exceptions as msg_exceptions from oslo_messaging import exceptions as msg_exceptions
from oslo_serialization import jsonutils from oslo_serialization import jsonutils
import six import six
import testtools
from heat.common import exception from heat.common import exception
from heat.common import template_format from heat.common import template_format
@ -207,20 +206,6 @@ class StackResourceTest(StackResourceBaseTest):
self.assertEqual(0, delete_nested.call_count) self.assertEqual(0, delete_nested.call_count)
@testtools.skipIf(six.PY3, "needs a separate change")
def test_implementation_signature(self):
self.parent_resource.child_template = mock.Mock(
return_value=self.simple_template)
sig1, sig2 = self.parent_resource.implementation_signature()
self.assertEqual('7b0eaabb5b82b9e90804d42e0bb739035588cb797'
'82427770646686ca2235028', sig1)
self.assertEqual('8fa647d036b8f36909386e1e1004539dfae7a8e88'
'c24aac0d85399e881421301', sig2)
self.parent_stack.t.files["foo"] = "bar"
sig1a, sig2a = self.parent_resource.implementation_signature()
self.assertEqual(sig1, sig1a)
self.assertNotEqual(sig2, sig2a)
def test_propagated_files(self): def test_propagated_files(self):
"""Test passing of the files map in the top level to the child. """Test passing of the files map in the top level to the child.