summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--contrib/rackspace/rackspace/tests/test_cloudnetworks.py4
-rw-r--r--heat/api/aws/exception.py3
-rw-r--r--heat/api/middleware/fault.py5
-rw-r--r--heat/engine/constraints.py5
-rw-r--r--heat/engine/resource.py8
-rw-r--r--heat/engine/resources/stack_resource.py8
-rw-r--r--heat/rpc/client.py4
-rw-r--r--heat/tests/api/openstack_v1/test_routes.py7
-rw-r--r--heat/tests/test_rpc_client.py4
-rw-r--r--heat_integrationtests/functional/functional_base.py4
-rw-r--r--heat_integrationtests/scenario/scenario_base.py4
11 files changed, 38 insertions, 18 deletions
diff --git a/contrib/rackspace/rackspace/tests/test_cloudnetworks.py b/contrib/rackspace/rackspace/tests/test_cloudnetworks.py
index f44e68c60..29c36e238 100644
--- a/contrib/rackspace/rackspace/tests/test_cloudnetworks.py
+++ b/contrib/rackspace/rackspace/tests/test_cloudnetworks.py
@@ -14,6 +14,7 @@
import uuid
import mock
+from oslo_utils import reflection
import six
from heat.common import exception
@@ -103,8 +104,9 @@ class CloudNetworkTest(common.HeatTestCase):
cloudnetworks.CloudNetwork)
def _parse_stack(self):
+ class_name = reflection.get_class_name(self, fully_qualified=False)
self.stack = utils.parse_stack(self._template,
- stack_name=self.__class__.__name__)
+ stack_name=class_name)
def _setup_stack(self, mock_client, *args):
self.fake_cnw = FakeClient(*args)
diff --git a/heat/api/aws/exception.py b/heat/api/aws/exception.py
index cd27303d2..4e7dc3093 100644
--- a/heat/api/aws/exception.py
+++ b/heat/api/aws/exception.py
@@ -16,6 +16,7 @@
"""Heat API exception subclasses - maps API response errors to AWS Errors."""
+from oslo_utils import reflection
import six
import webob.exc
@@ -307,7 +308,7 @@ def map_remote_error(ex):
already_exists_errors = ('StackExists')
invalid_action_errors = ('ActionInProgress',)
- ex_type = ex.__class__.__name__
+ ex_type = reflection.get_class_name(ex, fully_qualified=False)
if ex_type.endswith('_Remote'):
ex_type = ex_type[:-len('_Remote')]
diff --git a/heat/api/middleware/fault.py b/heat/api/middleware/fault.py
index 403a1872a..b7eb7ddc6 100644
--- a/heat/api/middleware/fault.py
+++ b/heat/api/middleware/fault.py
@@ -18,12 +18,13 @@
Inspired by Cinder's faultwrapper.
"""
-import six
import sys
import traceback
from oslo_config import cfg
+from oslo_utils import reflection
+import six
import webob
from heat.common import exception
@@ -115,7 +116,7 @@ class FaultWrapper(wsgi.Middleware):
ex = ex.exc
webob_exc = ex
- ex_type = ex.__class__.__name__
+ ex_type = reflection.get_class_name(ex, fully_qualified=False)
is_remote = ex_type.endswith('_Remote')
if is_remote:
diff --git a/heat/engine/constraints.py b/heat/engine/constraints.py
index 619a52872..4c10732d3 100644
--- a/heat/engine/constraints.py
+++ b/heat/engine/constraints.py
@@ -18,6 +18,7 @@ import re
from oslo_cache import core
from oslo_config import cfg
from oslo_log import log
+from oslo_utils import reflection
from oslo_utils import strutils
import six
@@ -612,8 +613,8 @@ class BaseCustomConstraint(object):
return False
else:
return True
-
- cache_value_prefix = "{0}:{1}".format(self.__class__.__name__,
+ class_name = reflection.get_class_name(self, fully_qualified=False)
+ cache_value_prefix = "{0}:{1}".format(class_name,
six.text_type(context.tenant_id))
validation_result = check_cache_or_validate_value(
cache_value_prefix, value)
diff --git a/heat/engine/resource.py b/heat/engine/resource.py
index b26399912..6550dca30 100644
--- a/heat/engine/resource.py
+++ b/heat/engine/resource.py
@@ -19,6 +19,7 @@ import weakref
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
+from oslo_utils import reflection
import six
from heat.common import exception
@@ -505,16 +506,17 @@ class Resource(object):
return dict((k, after_props.get(k)) for k in changed_properties_set)
def __str__(self):
+ class_name = reflection.get_class_name(self, fully_qualified=False)
if self.stack.id:
if self.resource_id:
- text = '%s "%s" [%s] %s' % (self.__class__.__name__, self.name,
+ text = '%s "%s" [%s] %s' % (class_name, self.name,
self.resource_id,
six.text_type(self.stack))
else:
- text = '%s "%s" %s' % (self.__class__.__name__, self.name,
+ text = '%s "%s" %s' % (class_name, self.name,
six.text_type(self.stack))
else:
- text = '%s "%s"' % (self.__class__.__name__, self.name)
+ text = '%s "%s"' % (class_name, self.name)
return six.text_type(text)
def dep_attrs(self, resource_name):
diff --git a/heat/engine/resources/stack_resource.py b/heat/engine/resources/stack_resource.py
index 21e6dc6ff..2de55ad0a 100644
--- a/heat/engine/resources/stack_resource.py
+++ b/heat/engine/resources/stack_resource.py
@@ -16,6 +16,7 @@ import json
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import excutils
+from oslo_utils import reflection
import six
from heat.common import exception
@@ -176,8 +177,8 @@ class StackResource(resource.Resource):
child_template = self.child_template()
params = self.child_params()
except NotImplementedError:
- LOG.warning(_LW("Preview of '%s' not yet implemented"),
- self.__class__.__name__)
+ class_name = reflection.get_class_name(self, fully_qualified=False)
+ LOG.warning(_LW("Preview of '%s' not yet implemented"), class_name)
return self
name = "%s-%s" % (self.stack.name, self.name)
@@ -317,7 +318,8 @@ class StackResource(resource.Resource):
# finish
return
- if not ex.__class__.__name__.endswith('_Remote'):
+ class_name = reflection.get_class_name(ex, fully_qualified=False)
+ if not class_name.endswith('_Remote'):
raise ex
full_message = six.text_type(ex)
diff --git a/heat/rpc/client.py b/heat/rpc/client.py
index 2efdef3c0..d9d5c3b3f 100644
--- a/heat/rpc/client.py
+++ b/heat/rpc/client.py
@@ -15,6 +15,8 @@
"""Client side of the heat engine RPC API."""
+from oslo_utils import reflection
+
from heat.common import messaging
from heat.rpc import api as rpc_api
@@ -76,7 +78,7 @@ class EngineClient(object):
:param error: Remote raised error to derive the name from.
"""
- error_name = error.__class__.__name__
+ error_name = reflection.get_class_name(error, fully_qualified=False)
return error_name.split('_Remote')[0]
def ignore_error_named(self, error, name):
diff --git a/heat/tests/api/openstack_v1/test_routes.py b/heat/tests/api/openstack_v1/test_routes.py
index 4177f78e0..29d1ae4a7 100644
--- a/heat/tests/api/openstack_v1/test_routes.py
+++ b/heat/tests/api/openstack_v1/test_routes.py
@@ -11,6 +11,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_utils import reflection
+
import heat.api.openstack.v1 as api_v1
from heat.tests import common
@@ -23,8 +25,9 @@ class RoutesTest(common.HeatTestCase):
route = mapper.match(path, {'REQUEST_METHOD': method})
self.assertIsNotNone(route)
self.assertEqual(action, route['action'])
- self.assertEqual(
- controller, route['controller'].controller.__class__.__name__)
+ class_name = reflection.get_class_name(route['controller'].controller,
+ fully_qualified=False)
+ self.assertEqual(controller, class_name)
del(route['action'])
del(route['controller'])
self.assertEqual(params, route)
diff --git a/heat/tests/test_rpc_client.py b/heat/tests/test_rpc_client.py
index cf1f6e1df..cc7d7bd19 100644
--- a/heat/tests/test_rpc_client.py
+++ b/heat/tests/test_rpc_client.py
@@ -22,6 +22,7 @@ import copy
import mock
from mox import stubout
from oslo_messaging._drivers import common as rpc_common
+from oslo_utils import reflection
from heat.common import exception
from heat.common import identifier
@@ -53,7 +54,8 @@ class EngineRpcAPITestCase(common.HeatTestCase):
self.assertEqual('NotFound', self.rpcapi.local_error_name(ex))
exr = self._to_remote_error(ex)
- self.assertEqual('NotFound_Remote', exr.__class__.__name__)
+ self.assertEqual('NotFound_Remote',
+ reflection.get_class_name(exr, fully_qualified=False))
self.assertEqual('NotFound', self.rpcapi.local_error_name(exr))
def test_ignore_error_named(self):
diff --git a/heat_integrationtests/functional/functional_base.py b/heat_integrationtests/functional/functional_base.py
index 452e05535..9f760110c 100644
--- a/heat_integrationtests/functional/functional_base.py
+++ b/heat_integrationtests/functional/functional_base.py
@@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_utils import reflection
+
from heat_integrationtests.common import test
@@ -21,7 +23,7 @@ class FunctionalTestsBase(test.HeatIntegrationTest):
self.client = self.orchestration_client
def check_skip(self):
- test_cls_name = self.__class__.__name__
+ test_cls_name = reflection.get_class_name(self, fully_qualified=False)
test_method_name = '.'.join([test_cls_name, self._testMethodName])
test_skipped = (self.conf.skip_functional_test_list and (
test_cls_name in self.conf.skip_functional_test_list or
diff --git a/heat_integrationtests/scenario/scenario_base.py b/heat_integrationtests/scenario/scenario_base.py
index 66069ff77..d41c9a1c9 100644
--- a/heat_integrationtests/scenario/scenario_base.py
+++ b/heat_integrationtests/scenario/scenario_base.py
@@ -10,6 +10,8 @@
# License for the specific language governing permissions and limitations
# under the License.
+from oslo_utils import reflection
+
from heat_integrationtests.common import test
@@ -59,7 +61,7 @@ class ScenarioTestsBase(test.HeatIntegrationTest):
return stack_id
def check_skip(self):
- test_cls_name = self.__class__.__name__
+ test_cls_name = reflection.get_class_name(self, fully_qualified=False)
test_method_name = '.'.join([test_cls_name, self._testMethodName])
test_skipped = (self.conf.skip_scenario_test_list and (
test_cls_name in self.conf.skip_scenario_test_list or