Clean up tenant and server
* remove '_' from class names * add class name to log instances * some cleanups to HACKING Change-Id: I1f6334318ee0d7d83cd3cea0e71ba4f05dd2b5c5
This commit is contained in:
parent
d6a2762746
commit
90f9f1dfa0
7
HACKING
7
HACKING
@ -1,5 +1,5 @@
|
|||||||
Nova Style Commandments
|
OpenStack Style Commandments
|
||||||
=======================
|
============================
|
||||||
|
|
||||||
Step 1: Read http://www.python.org/dev/peps/pep-0008/
|
Step 1: Read http://www.python.org/dev/peps/pep-0008/
|
||||||
Step 2: Read http://www.python.org/dev/peps/pep-0008/ again
|
Step 2: Read http://www.python.org/dev/peps/pep-0008/ again
|
||||||
@ -23,7 +23,6 @@ Imports
|
|||||||
\n
|
\n
|
||||||
{{begin your code}}
|
{{begin your code}}
|
||||||
|
|
||||||
|
|
||||||
General
|
General
|
||||||
-------
|
-------
|
||||||
- thou shalt put two newlines twixt toplevel code (funcs, classes, etc)
|
- thou shalt put two newlines twixt toplevel code (funcs, classes, etc)
|
||||||
@ -33,7 +32,6 @@ General
|
|||||||
- thou shalt not name anything the same name as a builtin or reserved word
|
- thou shalt not name anything the same name as a builtin or reserved word
|
||||||
- thou shalt not violate causality in our time cone, or else
|
- thou shalt not violate causality in our time cone, or else
|
||||||
|
|
||||||
|
|
||||||
Human Alphabetical Order Examples
|
Human Alphabetical Order Examples
|
||||||
---------------------------------
|
---------------------------------
|
||||||
::
|
::
|
||||||
@ -54,7 +52,6 @@ Docstrings
|
|||||||
----------
|
----------
|
||||||
"""A one line docstring looks like this and ends in a period."""
|
"""A one line docstring looks like this and ends in a period."""
|
||||||
|
|
||||||
|
|
||||||
"""A multiline docstring has a one-line summary, less than 80 characters.
|
"""A multiline docstring has a one-line summary, less than 80 characters.
|
||||||
|
|
||||||
Then a new paragraph after a newline that explains in more detail any
|
Then a new paragraph after a newline that explains in more detail any
|
||||||
|
@ -44,14 +44,14 @@ def _format_servers_list_networks(server):
|
|||||||
return '; '.join(output)
|
return '; '.join(output)
|
||||||
|
|
||||||
|
|
||||||
class List_Server(command.OpenStackCommand, lister.Lister):
|
class ListServer(command.OpenStackCommand, lister.Lister):
|
||||||
"List server command."
|
"""List server command"""
|
||||||
|
|
||||||
api = 'compute'
|
api = 'compute'
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__ + '.ListServer')
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(List_Server, self).get_parser(prog_name)
|
parser = super(ListServer, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--reservation-id',
|
'--reservation-id',
|
||||||
help='only return instances that match the reservation',
|
help='only return instances that match the reservation',
|
||||||
@ -125,14 +125,14 @@ class List_Server(command.OpenStackCommand, lister.Lister):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Show_Server(command.OpenStackCommand, show.ShowOne):
|
class ShowServer(command.OpenStackCommand, show.ShowOne):
|
||||||
"Show server command."
|
"""Show server command"""
|
||||||
|
|
||||||
api = 'compute'
|
api = 'compute'
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__ + '.ShowServer')
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(Show_Server, self).get_parser(prog_name)
|
parser = super(ShowServer, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'server',
|
'server',
|
||||||
metavar='<server>',
|
metavar='<server>',
|
||||||
@ -164,7 +164,4 @@ class Show_Server(command.OpenStackCommand, show.ShowOne):
|
|||||||
|
|
||||||
# Remove a couple of values that are long and not too useful
|
# Remove a couple of values that are long and not too useful
|
||||||
info.pop('links', None)
|
info.pop('links', None)
|
||||||
|
return zip(*sorted(info.iteritems()))
|
||||||
columns = sorted(info.keys())
|
|
||||||
values = [info[c] for c in columns]
|
|
||||||
return (columns, values)
|
|
||||||
|
@ -28,14 +28,14 @@ from openstackclient.common import command
|
|||||||
from openstackclient.common import utils
|
from openstackclient.common import utils
|
||||||
|
|
||||||
|
|
||||||
class Create_Tenant(command.OpenStackCommand, show.ShowOne):
|
class CreateTenant(command.OpenStackCommand, show.ShowOne):
|
||||||
"""Create tenant command"""
|
"""Create tenant command"""
|
||||||
|
|
||||||
api = 'identity'
|
api = 'identity'
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__ + '.CreateTenant')
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(Create_Tenant, self).get_parser(prog_name)
|
parser = super(CreateTenant, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'tenant_name',
|
'tenant_name',
|
||||||
metavar='<tenant-name>',
|
metavar='<tenant-name>',
|
||||||
@ -73,20 +73,17 @@ class Create_Tenant(command.OpenStackCommand, show.ShowOne):
|
|||||||
|
|
||||||
info = {}
|
info = {}
|
||||||
info.update(tenant._info)
|
info.update(tenant._info)
|
||||||
|
return zip(*sorted(info.iteritems()))
|
||||||
columns = sorted(info.keys())
|
|
||||||
values = [info[c] for c in columns]
|
|
||||||
return (columns, values)
|
|
||||||
|
|
||||||
|
|
||||||
class Delete_Tenant(command.OpenStackCommand):
|
class DeleteTenant(command.OpenStackCommand):
|
||||||
"""Delete tenant command"""
|
"""Delete tenant command"""
|
||||||
|
|
||||||
api = 'identity'
|
api = 'identity'
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__ + '.DeleteTenant')
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(Delete_Tenant, self).get_parser(prog_name)
|
parser = super(DeleteTenant, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'tenant',
|
'tenant',
|
||||||
metavar='<tenant>',
|
metavar='<tenant>',
|
||||||
@ -103,14 +100,14 @@ class Delete_Tenant(command.OpenStackCommand):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class List_Tenant(command.OpenStackCommand, lister.Lister):
|
class ListTenant(command.OpenStackCommand, lister.Lister):
|
||||||
"""List tenant command"""
|
"""List tenant command"""
|
||||||
|
|
||||||
api = 'identity'
|
api = 'identity'
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__ + '.ListTenant')
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(List_Tenant, self).get_parser(prog_name)
|
parser = super(ListTenant, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--long',
|
'--long',
|
||||||
action='store_true',
|
action='store_true',
|
||||||
@ -134,14 +131,14 @@ class List_Tenant(command.OpenStackCommand, lister.Lister):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class Set_Tenant(command.OpenStackCommand):
|
class SetTenant(command.OpenStackCommand):
|
||||||
"""Set tenant command"""
|
"""Set tenant command"""
|
||||||
|
|
||||||
api = 'identity'
|
api = 'identity'
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__ + '.SetTenant')
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(Set_Tenant, self).get_parser(prog_name)
|
parser = super(SetTenant, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'tenant',
|
'tenant',
|
||||||
metavar='<tenant>',
|
metavar='<tenant>',
|
||||||
@ -193,14 +190,14 @@ class Set_Tenant(command.OpenStackCommand):
|
|||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class Show_Tenant(command.OpenStackCommand, show.ShowOne):
|
class ShowTenant(command.OpenStackCommand, show.ShowOne):
|
||||||
"""Show tenant command"""
|
"""Show tenant command"""
|
||||||
|
|
||||||
api = 'identity'
|
api = 'identity'
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__ + '.ShowTenant')
|
||||||
|
|
||||||
def get_parser(self, prog_name):
|
def get_parser(self, prog_name):
|
||||||
parser = super(Show_Tenant, self).get_parser(prog_name)
|
parser = super(ShowTenant, self).get_parser(prog_name)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'tenant',
|
'tenant',
|
||||||
metavar='<tenant>',
|
metavar='<tenant>',
|
||||||
@ -216,7 +213,4 @@ class Show_Tenant(command.OpenStackCommand, show.ShowOne):
|
|||||||
|
|
||||||
info = {}
|
info = {}
|
||||||
info.update(tenant._info)
|
info.update(tenant._info)
|
||||||
|
return zip(*sorted(info.iteritems()))
|
||||||
columns = sorted(info.keys())
|
|
||||||
values = [info[c] for c in columns]
|
|
||||||
return (columns, values)
|
|
||||||
|
14
setup.py
14
setup.py
@ -59,8 +59,8 @@ setuptools.setup(
|
|||||||
entry_points={
|
entry_points={
|
||||||
'console_scripts': ['openstack=openstackclient.shell:main'],
|
'console_scripts': ['openstack=openstackclient.shell:main'],
|
||||||
'openstack.cli': [
|
'openstack.cli': [
|
||||||
'list_server=openstackclient.compute.v2.server:List_Server',
|
'list_server=openstackclient.compute.v2.server:ListServer',
|
||||||
'show_server=openstackclient.compute.v2.server:Show_Server',
|
'show_server=openstackclient.compute.v2.server:ShowServer',
|
||||||
'create_service=' +
|
'create_service=' +
|
||||||
'openstackclient.identity.v2_0.service:CreateService',
|
'openstackclient.identity.v2_0.service:CreateService',
|
||||||
'delete_service=' +
|
'delete_service=' +
|
||||||
@ -68,12 +68,12 @@ setuptools.setup(
|
|||||||
'list_service=openstackclient.identity.v2_0.service:ListService',
|
'list_service=openstackclient.identity.v2_0.service:ListService',
|
||||||
'show_service=openstackclient.identity.v2_0.service:ShowService',
|
'show_service=openstackclient.identity.v2_0.service:ShowService',
|
||||||
'create_tenant=' +
|
'create_tenant=' +
|
||||||
'openstackclient.identity.v2_0.tenant:Create_Tenant',
|
'openstackclient.identity.v2_0.tenant:CreateTenant',
|
||||||
'delete_tenant=' +
|
'delete_tenant=' +
|
||||||
'openstackclient.identity.v2_0.tenant:Delete_Tenant',
|
'openstackclient.identity.v2_0.tenant:DeleteTenant',
|
||||||
'list_tenant=openstackclient.identity.v2_0.tenant:List_Tenant',
|
'list_tenant=openstackclient.identity.v2_0.tenant:ListTenant',
|
||||||
'set_tenant=openstackclient.identity.v2_0.tenant:Set_Tenant',
|
'set_tenant=openstackclient.identity.v2_0.tenant:SetTenant',
|
||||||
'show_tenant=openstackclient.identity.v2_0.tenant:Show_Tenant',
|
'show_tenant=openstackclient.identity.v2_0.tenant:ShowTenant',
|
||||||
'create_user=' +
|
'create_user=' +
|
||||||
'openstackclient.identity.v2_0.user:CreateUser',
|
'openstackclient.identity.v2_0.user:CreateUser',
|
||||||
'delete_user=' +
|
'delete_user=' +
|
||||||
|
Loading…
x
Reference in New Issue
Block a user