fixing up a few pep8 issues, and pointing client to the new endpoint

This commit is contained in:
Jake Dahn 2011-08-15 13:38:40 -07:00
parent 1a9a14951e
commit 5a53520698

View File

@ -17,12 +17,10 @@ from novaclient import base
class QuotaSet(base.Resource):
def get(self):
self.manager.get(self)
def delete(self):
self.manager.delete(self)
def update(self, *args, **kwargs):
self.manager.update(self.tenant_id, *args, **kwargs)
@ -30,22 +28,15 @@ class QuotaSet(base.Resource):
class QuotaSetManager(base.ManagerWithFind):
resource_class = QuotaSet
def list(self, defaults=False):
if defaults == True:
return self._list('/os-quotas?defaults=True',
'quota_set_list')
else:
return self._list("/os-quotas", "quota_set_list")
def get(self, tenant_id):
if hasattr(tenant_id, 'tenant_id'):
tenant_id = tenant_id.tenant_id
return self._get("/os-quotas/%s" % (tenant_id), "quota_set")
return self._get("/os-quota-sets/%s" % (tenant_id), "quota_set")
def update(self, tenant_id, metadata_items=None,
injected_file_content_bytes=None, volumes=None, gigabytes=None,
ram=None, floating_ips=None, instances=None, injected_files=None,
cores=None):
ram=None, floating_ips=None, instances=None,
injected_files=None, cores=None):
body = {'quota_set': {
'tenant_id': tenant_id,
@ -57,17 +48,14 @@ class QuotaSetManager(base.ManagerWithFind):
'floating_ips': floating_ips,
'instances': instances,
'injected_files': injected_files,
'cores': cores,
}}
'cores': cores}}
for key in body['quota_set'].keys():
if body['quota_set'][key] == None:
body['quota_set'].pop(key)
return self._update('/os-quotas/%s' % (tenant_id), body)
def delete(self, tenant_id):
if hasattr(tenant_id, 'tenant_id'):
tenant_id = tenant_id.tenant_id
self._delete("/os-quotas/%s" % (tenant_id))
return self._update('/os-quota-sets/%s' % (tenant_id), body)
def defaults(self, tenant_id):
return self._get('/os-quota-sets/%s/defaults' % tenant_id,
'quota_set_list')