Remove usage of Exception.message
This attribute was deprecated a long time ago. Change-Id: Iae1831af1828acf21b7ab07b0f3215604c9e9729
This commit is contained in:
parent
9a17d8490e
commit
e343df1584
@ -23,6 +23,7 @@ import webbrowser
|
||||
|
||||
import jsonschema
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
import yaml
|
||||
|
||||
from rally import api
|
||||
@ -582,10 +583,7 @@ class TaskCommands(object):
|
||||
except jsonschema.ValidationError as e:
|
||||
print(_("ERROR: Invalid task result format in %s")
|
||||
% task_file_or_uuid, file=sys.stderr)
|
||||
if logging.is_debug():
|
||||
print(e, file=sys.stderr)
|
||||
else:
|
||||
print(e.message, file=sys.stderr)
|
||||
print(six.text_type(e), file=sys.stderr)
|
||||
return 1
|
||||
|
||||
elif uuidutils.is_uuid_like(task_file_or_uuid):
|
||||
|
@ -13,6 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
|
||||
from rally.common.i18n import _
|
||||
from rally import consts
|
||||
from rally import exceptions
|
||||
@ -145,7 +147,7 @@ class NovaSecGroup(utils.NovaScenario):
|
||||
self._delete_security_groups(security_groups)
|
||||
except Exception as e:
|
||||
if hasattr(e, "http_status") and e.http_status == 400:
|
||||
raise NovaSecurityGroupException(e.message)
|
||||
raise NovaSecurityGroupException(six.text_type(e))
|
||||
raise
|
||||
|
||||
error_message = ("Expected number of attached security groups to "
|
||||
|
@ -68,7 +68,7 @@ class CreateFlavorContext(context.Context):
|
||||
disk=self.config.get("disk", 1)).to_dict()
|
||||
LOG.debug("Flavor with id '%s'" % self.context["flavor"]["id"])
|
||||
except Exception as e:
|
||||
msg = "Can't create flavor: %s" % e.message
|
||||
msg = "Can't create flavor: %s" % e
|
||||
if logging.is_debug():
|
||||
LOG.exception(msg)
|
||||
else:
|
||||
@ -81,7 +81,7 @@ class CreateFlavorContext(context.Context):
|
||||
nova.flavors.delete(self.context["flavor"]["id"])
|
||||
LOG.debug("Flavor '%s' deleted" % self.context["flavor"]["id"])
|
||||
except Exception as e:
|
||||
msg = "Can't delete flavor: %s" % e.message
|
||||
msg = "Can't delete flavor: %s" % e
|
||||
if logging.is_debug():
|
||||
LOG.exception(msg)
|
||||
else:
|
||||
|
@ -21,6 +21,8 @@ import subprocess
|
||||
import traceback
|
||||
import unittest
|
||||
|
||||
import six
|
||||
|
||||
from rally import api
|
||||
from rally.common import db
|
||||
from rally import plugins
|
||||
@ -80,7 +82,7 @@ class TestTaskSamples(unittest.TestCase):
|
||||
task_config = json.loads(rendered_task)
|
||||
api.Task.validate("MAIN", task_config)
|
||||
except Exception as e:
|
||||
if not self._skip(e.message):
|
||||
if not self._skip(six.text_type(e)):
|
||||
print (traceback.format_exc())
|
||||
print ("Failed on task config %s with error." %
|
||||
full_path)
|
||||
|
Loading…
x
Reference in New Issue
Block a user