Avoid crash when registering resources

When a resource that has a support status different than SUPPORTED is
registered, the heat engine prints the message associated with its
SupportStatus object as a warning. This change avoids an engine crash
that occurs when a resource's SupportStatus does not define a message.

Change-Id: Id86bf93baade5b4fb0a71a80275b20d70710f2f4
This commit is contained in:
Miguel Grinberg
2015-05-27 18:57:56 -07:00
parent 6cf94a3ece
commit 960c43c7cd

View File

@@ -259,8 +259,9 @@ class ResourceRegistry(object):
if isinstance(info, ClassResourceInfo):
if info.value.support_status.status != support.SUPPORTED:
warnings.warn(encodeutils.safe_encode(
info.value.support_status.message))
if info.value.support_status.message is not None:
warnings.warn(encodeutils.safe_encode(
info.value.support_status.message))
info.user_resource = (self.global_registry is not None)
registry[name] = info