From 7ccf4d045e81566c85ff7f09979bd1a6b607a395 Mon Sep 17 00:00:00 2001 From: Joe D'Andrea Date: Mon, 14 Dec 2015 16:39:30 +0000 Subject: [PATCH] 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 --- heat/engine/environment.py | 11 +++++++++-- .../resources/openstack/heat/software_deployment.py | 6 ++---- .../resources/openstack/heat/structured_config.py | 6 ++---- heat/engine/resources/openstack/neutron/extraroute.py | 3 +-- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/heat/engine/environment.py b/heat/engine/environment.py index 326ef39402..be2a6fd249 100644 --- a/heat/engine/environment.py +++ b/heat/engine/environment.py @@ -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 diff --git a/heat/engine/resources/openstack/heat/software_deployment.py b/heat/engine/resources/openstack/heat/software_deployment.py index 6a790a694c..3c7850d197 100644 --- a/heat/engine/resources/openstack/heat/software_deployment.py +++ b/heat/engine/resources/openstack/heat/software_deployment.py @@ -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') diff --git a/heat/engine/resources/openstack/heat/structured_config.py b/heat/engine/resources/openstack/heat/structured_config.py index fe386a49dd..1f95c84930 100644 --- a/heat/engine/resources/openstack/heat/structured_config.py +++ b/heat/engine/resources/openstack/heat/structured_config.py @@ -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') diff --git a/heat/engine/resources/openstack/neutron/extraroute.py b/heat/engine/resources/openstack/neutron/extraroute.py index c0ac15ed54..eb06f9faeb 100644 --- a/heat/engine/resources/openstack/neutron/extraroute.py +++ b/heat/engine/resources/openstack/neutron/extraroute.py @@ -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,