diff --git a/heat/engine/function.py b/heat/engine/function.py index dfac156b3c..9b12dbe333 100644 --- a/heat/engine/function.py +++ b/heat/engine/function.py @@ -125,6 +125,9 @@ class Function(object): return NotImplemented return not eq + def __hash__(self): + return id(self) + def resolve(snippet): while isinstance(snippet, Function): diff --git a/heat/engine/resource.py b/heat/engine/resource.py index 52d35e7886..e65402789e 100644 --- a/heat/engine/resource.py +++ b/heat/engine/resource.py @@ -299,6 +299,9 @@ class Resource(object): return result return not result + def __hash__(self): + return id(self) + def metadata_get(self, refresh=False): if refresh: self._rsrc_metadata = None diff --git a/heat/engine/rsrc_defn.py b/heat/engine/rsrc_defn.py index 805bc30821..ec703dfedf 100644 --- a/heat/engine/rsrc_defn.py +++ b/heat/engine/rsrc_defn.py @@ -395,6 +395,13 @@ class ResourceDefinition(ResourceDefinitionCore, collections.Mapping): raise KeyError(key) + def __hash__(self): + """ + Return a hash of the ResourceDefinition object. + """ + warnings.warn(self._deprecation_msg, DeprecationWarning) + return super(ResourceDefinition, self).__hash__() + def __len__(self): """ Return the number of available CFN template keys. diff --git a/heat/tests/utils.py b/heat/tests/utils.py index 0b7caab10b..7f1e48960b 100644 --- a/heat/tests/utils.py +++ b/heat/tests/utils.py @@ -126,6 +126,9 @@ class PhysName(object): # ignore the stack portion of the name, as it may have been truncated return res == self.res + def __hash__(self): + return id(self) + def __ne__(self, physical_name): return not self.__eq__(physical_name)