Merge pull request #27 from EdLeafe/master
Added support for request timeouts.
This commit is contained in:
commit
0118cb3161
novaclient
@ -63,9 +63,10 @@ class OpenStack(object):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, username, apikey, projectid,
|
def __init__(self, username, apikey, projectid,
|
||||||
auth_url='https://auth.api.rackspacecloud.com/v1.0'):
|
auth_url='https://auth.api.rackspacecloud.com/v1.0', timeout=None):
|
||||||
self.backup_schedules = BackupScheduleManager(self)
|
self.backup_schedules = BackupScheduleManager(self)
|
||||||
self.client = OpenStackClient(username, apikey, projectid, auth_url)
|
self.client = OpenStackClient(username, apikey, projectid, auth_url,
|
||||||
|
timeout=timeout)
|
||||||
self.flavors = FlavorManager(self)
|
self.flavors = FlavorManager(self)
|
||||||
self.images = ImageManager(self)
|
self.images = ImageManager(self)
|
||||||
self.ipgroups = IPGroupManager(self)
|
self.ipgroups = IPGroupManager(self)
|
||||||
|
@ -28,8 +28,8 @@ class OpenStackClient(httplib2.Http):
|
|||||||
|
|
||||||
USER_AGENT = 'python-novaclient/%s' % novaclient.__version__
|
USER_AGENT = 'python-novaclient/%s' % novaclient.__version__
|
||||||
|
|
||||||
def __init__(self, user, apikey, projectid, auth_url):
|
def __init__(self, user, apikey, projectid, auth_url, timeout=None):
|
||||||
super(OpenStackClient, self).__init__()
|
super(OpenStackClient, self).__init__(timeout=timeout)
|
||||||
self.user = user
|
self.user = user
|
||||||
self.apikey = apikey
|
self.apikey = apikey
|
||||||
self.projectid = projectid
|
self.projectid = projectid
|
||||||
@ -77,7 +77,7 @@ class OpenStackClient(httplib2.Http):
|
|||||||
else:
|
else:
|
||||||
body = None
|
body = None
|
||||||
|
|
||||||
if resp.status in (400, 401, 403, 404, 413, 500, 501):
|
if resp.status in (400, 401, 403, 404, 408, 413, 500, 501):
|
||||||
raise exceptions.from_response(resp, body)
|
raise exceptions.from_response(resp, body)
|
||||||
|
|
||||||
return resp, body
|
return resp, body
|
||||||
|
Loading…
x
Reference in New Issue
Block a user