Replaces exceptions.Error with NovaException
Fixes bug 817107 Change-Id: I6253e6bbcc44676c587b315fa32afba6459e676a
This commit is contained in:
@@ -447,7 +447,7 @@ class AuthManager(object):
|
||||
"""
|
||||
if role == 'projectmanager':
|
||||
if not project:
|
||||
raise exception.Error(_("Must specify project"))
|
||||
raise exception.NovaException(_("Must specify project"))
|
||||
return self.is_project_manager(user, project)
|
||||
|
||||
global_role = self._has_role(User.safe_id(user),
|
||||
|
||||
@@ -78,7 +78,7 @@ class Signer(object):
|
||||
def s3_authorization(self, headers, verb, path):
|
||||
"""Generate S3 authorization string."""
|
||||
if not boto:
|
||||
raise exception.Error('boto is not installed')
|
||||
raise exception.NovaException('boto is not installed')
|
||||
c_string = boto.utils.canonical_string(verb, path, headers)
|
||||
hmac_copy = self.hmac.copy()
|
||||
hmac_copy.update(c_string)
|
||||
@@ -97,7 +97,7 @@ class Signer(object):
|
||||
return self._calc_signature_1(params)
|
||||
if params['SignatureVersion'] == '2':
|
||||
return self._calc_signature_2(params, verb, server_string, path)
|
||||
raise exception.Error('Unknown Signature Version: %s' %
|
||||
raise exception.NovaException('Unknown Signature Version: %s' %
|
||||
params['SignatureVersion'])
|
||||
|
||||
@staticmethod
|
||||
@@ -140,16 +140,17 @@ class Signer(object):
|
||||
string_to_sign = '%s\n%s\n%s\n' % (verb, server_string, path)
|
||||
|
||||
if 'SignatureMethod' not in params:
|
||||
raise exception.Error('No SignatureMethod specified')
|
||||
raise exception.NovaException('No SignatureMethod specified')
|
||||
|
||||
if params['SignatureMethod'] == 'HmacSHA256':
|
||||
if not self.hmac_256:
|
||||
raise exception.Error('SHA256 not supported on this server')
|
||||
msg = _('SHA256 not supported on this server')
|
||||
raise exception.NovaException(msg)
|
||||
current_hmac = self.hmac_256
|
||||
elif params['SignatureMethod'] == 'HmacSHA1':
|
||||
current_hmac = self.hmac
|
||||
else:
|
||||
raise exception.Error('SignatureMethod %s not supported'
|
||||
raise exception.NovaException('SignatureMethod %s not supported'
|
||||
% params['SignatureMethod'])
|
||||
|
||||
keys = params.keys()
|
||||
|
||||
@@ -1193,8 +1193,8 @@ class LibvirtConnTestCase(test.TestCase):
|
||||
conn.ensure_filtering_rules_for_instance(instance_ref,
|
||||
network_info,
|
||||
time=fake_timer)
|
||||
except exception.Error, e:
|
||||
c1 = (0 <= e.message.find('Timeout migrating for'))
|
||||
except exception.NovaException, e:
|
||||
c1 = (0 <= str(e).find('Timeout migrating for'))
|
||||
self.assertTrue(c1)
|
||||
|
||||
self.assertEqual(29, fake_timer.counter, "Didn't wait the expected "
|
||||
|
||||
@@ -65,14 +65,14 @@ class SignerTestCase(test.TestCase):
|
||||
'GET', 'server', '/foo'))
|
||||
|
||||
def test_generate_invalid_signature_method_defined(self):
|
||||
self.assertRaises(exception.Error,
|
||||
self.assertRaises(exception.NovaException,
|
||||
self.signer.generate,
|
||||
{'SignatureVersion': '2',
|
||||
'SignatureMethod': 'invalid_method'},
|
||||
'GET', 'server', '/foo')
|
||||
|
||||
def test_generate_no_signature_method_defined(self):
|
||||
self.assertRaises(exception.Error,
|
||||
self.assertRaises(exception.NovaException,
|
||||
self.signer.generate,
|
||||
{'SignatureVersion': '2'},
|
||||
'GET', 'server', '/foo')
|
||||
@@ -85,7 +85,7 @@ class SignerTestCase(test.TestCase):
|
||||
# Create Signer again now that hashlib.sha256 is None
|
||||
self.signer = signer.Signer(
|
||||
'uV3F3YluFJax1cknvbcGwgjvx4QpvB+leU8dUj2o')
|
||||
self.assertRaises(exception.Error,
|
||||
self.assertRaises(exception.NovaException,
|
||||
self.signer.generate,
|
||||
{'SignatureVersion': '2',
|
||||
'SignatureMethod': 'HmacSHA256'},
|
||||
@@ -106,7 +106,7 @@ class SignerTestCase(test.TestCase):
|
||||
'GET', 'server', '/foo'))
|
||||
|
||||
def test_generate_unknown_version(self):
|
||||
self.assertRaises(exception.Error,
|
||||
self.assertRaises(exception.NovaException,
|
||||
self.signer.generate,
|
||||
{'SignatureMethod': 'HmacSHA256', 'SignatureVersion': '9'},
|
||||
'GET', 'server', '/foo')
|
||||
|
||||
@@ -195,7 +195,7 @@ class VolumeTestCase(test.TestCase):
|
||||
instance_ref = db.volume_get_instance(self.context, volume_id)
|
||||
self.assertEqual(instance_ref['id'], instance_id)
|
||||
|
||||
self.assertRaises(exception.Error,
|
||||
self.assertRaises(exception.NovaException,
|
||||
self.volume.delete_volume,
|
||||
self.context,
|
||||
volume_id)
|
||||
|
||||
@@ -304,7 +304,7 @@ class XenAPIVMTestCase(test.TestCase):
|
||||
instance = self._create_instance()
|
||||
|
||||
name = "MySnapshot"
|
||||
self.assertRaises(exception.Error, self.conn.snapshot,
|
||||
self.assertRaises(exception.NovaException, self.conn.snapshot,
|
||||
self.context, instance, name)
|
||||
|
||||
def test_instance_snapshot(self):
|
||||
|
||||
Reference in New Issue
Block a user