More error reporting
This commit is contained in:
@@ -558,17 +558,25 @@ class Swauth(object):
|
|||||||
account_suffix = req.headers.get('x-account-suffix')
|
account_suffix = req.headers.get('x-account-suffix')
|
||||||
if not account_suffix:
|
if not account_suffix:
|
||||||
account_suffix = str(uuid4())
|
account_suffix = str(uuid4())
|
||||||
conn = self.get_conn()
|
|
||||||
# Create the new account in the Swift cluster
|
# Create the new account in the Swift cluster
|
||||||
path = quote('%s/%s%s' % (self.dsc_parsed.path, self.reseller_prefix,
|
path = quote('%s/%s%s' % (self.dsc_parsed.path,
|
||||||
account_suffix))
|
self.reseller_prefix, account_suffix))
|
||||||
conn.request('PUT', path,
|
try:
|
||||||
headers={'X-Auth-Token': self.get_itoken(req.environ)})
|
conn = self.get_conn()
|
||||||
resp = conn.getresponse()
|
conn.request('PUT', path,
|
||||||
resp.read()
|
headers={'X-Auth-Token': self.get_itoken(req.environ)})
|
||||||
if resp.status // 100 != 2:
|
resp = conn.getresponse()
|
||||||
raise Exception('Could not create account on the Swift cluster: '
|
resp.read()
|
||||||
'%s %s %s' % (path, resp.status, resp.reason))
|
if resp.status // 100 != 2:
|
||||||
|
raise Exception('Could not create account on the Swift '
|
||||||
|
'cluster: %s %s %s' % (path, resp.status, resp.reason))
|
||||||
|
except:
|
||||||
|
self.logger.error(_('ERROR: Exception while trying to communicate '
|
||||||
|
'with %(scheme)s://%(host)s:%(port)s/%(path)s'),
|
||||||
|
{'scheme': self.dsc_parsed.scheme,
|
||||||
|
'host': self.dsc_parsed.hostname,
|
||||||
|
'port': self.dsc_parsed.port, 'path': path})
|
||||||
|
raise
|
||||||
# Record the mapping from account id back to account name
|
# Record the mapping from account id back to account name
|
||||||
path = quote('/v1/%s/.account_id/%s%s' %
|
path = quote('/v1/%s/.account_id/%s%s' %
|
||||||
(self.auth_account, self.reseller_prefix, account_suffix))
|
(self.auth_account, self.reseller_prefix, account_suffix))
|
||||||
|
|||||||
Reference in New Issue
Block a user