Explicitly naming resources in "unsupported" warnings

Warnings that a resource is not supported are now prefaced
with the resource name and status (e.g., DEPRECATED). In
addition, the warning is now logged via LOG.warn(_LW()).

Previously, warnings.warn(six.text_type()) was used. In
addition to being routed to the log file, it included a
confusing reference to the last line of invocation, which
was the fragment "info.value.support_status.message))".

Change-Id: I006120a395007d88f3ba04a4af89283a1a077c3f
Closes-Bug: #1524512
This commit is contained in:
Joe D'Andrea 2015-12-14 16:39:30 +00:00 committed by Sergey Kraynev
parent 3bbfb3e69d
commit 7ccf4d045e
4 changed files with 14 additions and 12 deletions

View File

@ -328,8 +328,15 @@ class ResourceRegistry(object):
if isinstance(info, ClassResourceInfo):
if info.value.support_status.status != support.SUPPORTED:
if info.value.support_status.message is not None:
LOG.warning(_LW("%s"), six.text_type(
info.value.support_status.message))
details = {
'name': info.name,
'status': six.text_type(
info.value.support_status.status),
'message': six.text_type(
info.value.support_status.message)
}
LOG.warning(_LW('%(name)s is %(status)s. %(message)s'),
details)
info.user_resource = (self.global_registry is not None)
registry[name] = info

View File

@ -657,10 +657,8 @@ class SoftwareDeploymentGroup(resource_group.ResourceGroup):
class SoftwareDeployments(SoftwareDeploymentGroup):
deprecation_msg = _('The resource OS::Heat::SoftwareDeployments is '
'deprecated and usage is discouraged. Please use '
'resource OS::Heat::SoftwareDeploymentGroup '
'instead.')
deprecation_msg = _('Use of this resource is discouraged. Please use '
'OS::Heat::SoftwareDeploymentGroup instead.')
support_status = support.SupportStatus(status=support.DEPRECATED,
message=deprecation_msg,
version='2014.2')

View File

@ -235,10 +235,8 @@ class StructuredDeploymentGroup(sd.SoftwareDeploymentGroup):
class StructuredDeployments(StructuredDeploymentGroup):
deprecation_msg = _('The resource OS::Heat::StructuredDeployments is '
'deprecated and usage is discouraged. Please use '
'resource OS::Heat::StructuredDeploymentGroup '
'instead.')
deprecation_msg = _('Use of this resource is discouraged. Please use '
'OS::Heat::StructuredDeploymentGroup instead.')
support_status = support.SupportStatus(status=support.DEPRECATED,
message=deprecation_msg,
version='2014.2')

View File

@ -32,8 +32,7 @@ class ExtraRoute(neutron.NeutronResource):
support_status = support.SupportStatus(
status=support.UNSUPPORTED,
message=_('The resource OS::Neutron::ExtraRoute is not supported, '
'use at your own risk.'))
message=_('Use this resource at your own risk.'))
PROPERTIES = (
ROUTER_ID, DESTINATION, NEXTHOP,