PEP8 fixes
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
|
||||
from novaclient import base
|
||||
|
||||
|
||||
class Account(base.Resource):
|
||||
"""
|
||||
Account is an opaque instance used to hold account information.
|
||||
@@ -22,13 +23,14 @@ class Account(base.Resource):
|
||||
def __repr__(self):
|
||||
return "<Account: %s>" % self.name
|
||||
|
||||
|
||||
class Accounts(base.ManagerWithFind):
|
||||
"""
|
||||
Manage :class:`Account` information.
|
||||
"""
|
||||
|
||||
resource_class = Account
|
||||
|
||||
|
||||
def _list(self, url, response_key):
|
||||
resp, body = self.api.client.get(url)
|
||||
if not body:
|
||||
@@ -41,7 +43,7 @@ class Accounts(base.ManagerWithFind):
|
||||
|
||||
:rtype: :class:`Account`.
|
||||
"""
|
||||
|
||||
|
||||
acct_name = self._get_account_name(account)
|
||||
return self._list("/mgmt/accounts/%s" % acct_name, 'account')
|
||||
|
||||
@@ -52,4 +54,3 @@ class Accounts(base.ManagerWithFind):
|
||||
return account.name
|
||||
except AttributeError:
|
||||
return account
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
def isid(obj):
|
||||
"""
|
||||
Returns true if the given object can be converted to an ID, false otherwise.
|
||||
Returns true if the given object can be converted to an ID,
|
||||
false otherwise.
|
||||
"""
|
||||
if hasattr(obj, "id"):
|
||||
return True
|
||||
@@ -12,4 +12,3 @@ def isid(obj):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
@@ -95,7 +95,8 @@ class Auth(object):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def login(self, user, apikey, tenant="dbaas", auth_url="http://localhost:5000/v1.1",
|
||||
def login(self, user, apikey, tenant="dbaas",
|
||||
auth_url="http://localhost:5000/v1.1",
|
||||
service_name="reddwarf", service_url=None):
|
||||
"""Login to retrieve an auth token to use for other api calls"""
|
||||
try:
|
||||
|
||||
@@ -42,7 +42,7 @@ class Configs(base.ManagerWithFind):
|
||||
"""
|
||||
Delete an existing configuration
|
||||
"""
|
||||
url = "/mgmt/configs/%s"% config
|
||||
url = "/mgmt/configs/%s" % config
|
||||
self._delete(url)
|
||||
|
||||
def list(self):
|
||||
|
||||
@@ -5,7 +5,8 @@ import exceptions
|
||||
|
||||
class Database(base.Resource):
|
||||
"""
|
||||
According to Wikipedia, "A database is a system intended to organize, store, and retrieve
|
||||
According to Wikipedia, "A database is a system intended to organize,
|
||||
store, and retrieve
|
||||
large amounts of data easily."
|
||||
"""
|
||||
def __repr__(self):
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
from novaclient import base
|
||||
import exceptions
|
||||
|
||||
|
||||
class Diagnostics(base.Resource):
|
||||
"""
|
||||
Account is an opaque instance used to hold account information.
|
||||
@@ -23,6 +24,7 @@ class Diagnostics(base.Resource):
|
||||
def __repr__(self):
|
||||
return "<Diagnostics: %s>" % self.version
|
||||
|
||||
|
||||
class Interrogator(base.ManagerWithFind):
|
||||
"""
|
||||
Manager class for Interrogator resource
|
||||
|
||||
@@ -20,6 +20,7 @@ import exceptions
|
||||
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
|
||||
|
||||
class Flavor(base.Resource):
|
||||
"""
|
||||
A Flavor is an Instance type, specifying among other things, RAM size.
|
||||
@@ -75,4 +76,3 @@ class Flavors(base.ManagerWithFind):
|
||||
"""
|
||||
return self._get("/flavors/%s" % base.getid(flavor),
|
||||
"flavor")
|
||||
|
||||
|
||||
@@ -113,7 +113,8 @@ class Instances(base.ManagerWithFind):
|
||||
|
||||
:param instance_id: The instance id to delete
|
||||
"""
|
||||
resp, body = self.api.client.delete("/instances/%s" % base.getid(instance))
|
||||
resp, body = self.api.client.delete("/instances/%s" %
|
||||
base.getid(instance))
|
||||
if resp.status in (422, 500):
|
||||
raise exceptions.from_response(resp, body)
|
||||
|
||||
|
||||
@@ -18,10 +18,12 @@ from novaclient import base
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
from reddwarfclient.instances import Instance
|
||||
|
||||
|
||||
class RootHistory(base.Resource):
|
||||
def __repr__(self):
|
||||
return ("<Root History: Instance %s enabled at %s by %s>"
|
||||
% (self.id, self.created, self.user))
|
||||
return ("<Root History: Instance %s enabled at %s by %s>"
|
||||
% (self.id, self.created, self.user))
|
||||
|
||||
|
||||
class Management(base.ManagerWithFind):
|
||||
"""
|
||||
@@ -41,7 +43,7 @@ class Management(base.ManagerWithFind):
|
||||
|
||||
:rtype: :class:`Instance`.
|
||||
"""
|
||||
|
||||
|
||||
return self._list("/mgmt/instances/%s" % base.getid(instance),
|
||||
'instance')
|
||||
|
||||
@@ -63,7 +65,8 @@ class Management(base.ManagerWithFind):
|
||||
resp, body = self.api.client.get(url)
|
||||
if not body:
|
||||
raise Exception("Call to " + url + " did not return a body.")
|
||||
return [self.resource_class(self, instance) for instance in body['instances']]
|
||||
return [self.resource_class(self, instance)
|
||||
for instance in body['instances']]
|
||||
|
||||
def root_enabled_history(self, instance):
|
||||
"""
|
||||
@@ -94,8 +97,8 @@ class Management(base.ManagerWithFind):
|
||||
self._action(instance_id, body)
|
||||
|
||||
def update(self, instance_id):
|
||||
"""
|
||||
Update the guest agent via apt-get.
|
||||
"""
|
||||
body = {'update': {}}
|
||||
self._action(instance_id, body)
|
||||
"""
|
||||
Update the guest agent via apt-get.
|
||||
"""
|
||||
body = {'update': {}}
|
||||
self._action(instance_id, body)
|
||||
|
||||
@@ -19,6 +19,7 @@ from reddwarfclient import users
|
||||
from reddwarfclient.common import check_for_exceptions
|
||||
import exceptions
|
||||
|
||||
|
||||
class Root(base.ManagerWithFind):
|
||||
"""
|
||||
Manager class for Root resource
|
||||
@@ -37,7 +38,7 @@ class Root(base.ManagerWithFind):
|
||||
|
||||
def is_root_enabled(self, instance_id):
|
||||
""" Return True if root is enabled for the instance;
|
||||
False otherwise"""
|
||||
False otherwise"""
|
||||
resp, body = self.api.client.get(self.url % instance_id)
|
||||
check_for_exceptions(resp, body)
|
||||
return body['rootEnabled']
|
||||
return body['rootEnabled']
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
from novaclient import base
|
||||
|
||||
|
||||
class Device(base.Resource):
|
||||
"""
|
||||
Storage is an opaque instance used to hold storage information.
|
||||
@@ -22,6 +23,7 @@ class Device(base.Resource):
|
||||
def __repr__(self):
|
||||
return "<Device: %s>" % self.name
|
||||
|
||||
|
||||
class StorageInfo(base.ManagerWithFind):
|
||||
"""
|
||||
Manage :class:`Storage` resources.
|
||||
|
||||
@@ -43,7 +43,7 @@ class Users(base.ManagerWithFind):
|
||||
|
||||
def delete(self, instance_id, user):
|
||||
"""Delete an existing user in the specified instance"""
|
||||
url = "/instances/%s/users/%s"% (instance_id, user)
|
||||
url = "/instances/%s/users/%s" % (instance_id, user)
|
||||
resp, body = self.api.client.delete(url)
|
||||
check_for_exceptions(resp, body)
|
||||
|
||||
@@ -62,4 +62,4 @@ class Users(base.ManagerWithFind):
|
||||
:rtype: list of :class:`User`.
|
||||
"""
|
||||
return self._list("/instances/%s/users" % base.getid(instance),
|
||||
"users")
|
||||
"users")
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
from novaclient import base
|
||||
|
||||
|
||||
class Version(base.Resource):
|
||||
"""
|
||||
Version is an opaque instance used to hold version information.
|
||||
@@ -22,13 +23,14 @@ class Version(base.Resource):
|
||||
def __repr__(self):
|
||||
return "<Version: %s>" % self.id
|
||||
|
||||
|
||||
class Versions(base.ManagerWithFind):
|
||||
"""
|
||||
Manage :class:`Versions` information.
|
||||
"""
|
||||
|
||||
resource_class = Version
|
||||
|
||||
|
||||
def index(self, url):
|
||||
"""
|
||||
Get a list of all versions.
|
||||
|
||||
Reference in New Issue
Block a user