Add docstrings to the CLI actions
These docstrings are used in the help messages for example when doing `tuskar --help` or `tuskar help overcloud-show` Change-Id: I13770cb802cc34757e9dc502f1675a95a8faf269
This commit is contained in:
parent
113cd72ea8
commit
c64aa510da
@ -26,7 +26,6 @@ class OvercloudRole(common_base.Resource):
|
||||
class OvercloudRoleManager(base.Manager):
|
||||
"""OvercloudRoleManager interacts with the Tuskar API and provides CRUD
|
||||
operations for the overcloud role type.
|
||||
|
||||
"""
|
||||
|
||||
#: The class used to represent an overcloud role instance
|
||||
|
@ -20,14 +20,13 @@ from tuskarclient.common import utils
|
||||
|
||||
@utils.arg('id', metavar="<ID>", help="ID of Overcloud Role to show.")
|
||||
def do_overcloud_role_show(tuskar, args, outfile=sys.stdout):
|
||||
"""Given a Tuskar client instance and the command line arguments display
|
||||
the detail to the user.
|
||||
"""
|
||||
"""Show an individual Overcloud Role by its ID."""
|
||||
overcloud_role = utils.find_resource(tuskar.overcloud_roles, args.id)
|
||||
print_role_detail(overcloud_role, outfile=outfile)
|
||||
|
||||
|
||||
def do_overcloud_role_list(tuskar, args, outfile=sys.stdout):
|
||||
"""Show a list of the Overcloud Roles."""
|
||||
overcloud_roles = tuskar.overcloud_roles.list()
|
||||
fields = ['id', 'name', 'image_name', 'flavor_id']
|
||||
fmt.print_list(overcloud_roles, fields, outfile=outfile)
|
||||
@ -41,6 +40,7 @@ def do_overcloud_role_list(tuskar, args, outfile=sys.stdout):
|
||||
@utils.arg('-f', '--flavor-id', metavar="<FLAVOR ID>",
|
||||
help='UUID of the flavor of node this role should be deployed on.')
|
||||
def do_overcloud_role_create(tuskar, args, outfile=sys.stdout):
|
||||
"""Create a new Overcloud Role."""
|
||||
overcloud_role_dict = create_overcloud_role_dict(args)
|
||||
overcloud_role = tuskar.overcloud_roles.create(**overcloud_role_dict)
|
||||
print_role_detail(overcloud_role, outfile=outfile)
|
||||
@ -56,6 +56,7 @@ def do_overcloud_role_create(tuskar, args, outfile=sys.stdout):
|
||||
@utils.arg('-f', '--flavor-id', metavar="<FLAVOR ID>",
|
||||
help='UUID of the flavor of node this role should be deployed on.')
|
||||
def do_overcloud_role_update(tuskar, args, outfile=sys.stdout):
|
||||
"""Update an existing Overcloud Role by its ID."""
|
||||
overcloud_role = utils.find_resource(tuskar.overcloud_roles, args.id)
|
||||
overcloud_role_dict = create_overcloud_role_dict(args)
|
||||
updated_overcloud_role = tuskar.overcloud_roles.update(
|
||||
@ -67,6 +68,7 @@ def do_overcloud_role_update(tuskar, args, outfile=sys.stdout):
|
||||
|
||||
@utils.arg('id', metavar="<ID>", help="ID of Overcloud Role to show.")
|
||||
def do_overcloud_role_delete(tuskar, args, outfile=sys.stdout):
|
||||
"""Delete an Overcloud Role by its ID."""
|
||||
overcloud_role = utils.find_resource(tuskar.overcloud_roles, args.id)
|
||||
tuskar.overcloud_roles.delete(args.id)
|
||||
print(u'Deleted Overcloud Role "%s".' % overcloud_role.name, file=outfile)
|
||||
|
@ -26,7 +26,6 @@ class Overcloud(common_base.Resource):
|
||||
class OvercloudManager(base.Manager):
|
||||
"""OvercloudManager interacts with the Tuskar API and provides CRUD
|
||||
operations for the Overcloud type.
|
||||
|
||||
"""
|
||||
|
||||
#: The class used to represent an Overcloud instance
|
||||
|
@ -20,14 +20,13 @@ from tuskarclient.common import utils
|
||||
|
||||
@utils.arg('id', metavar="<ID>", help="ID of Overcloud to show.")
|
||||
def do_overcloud_show(tuskar, args, outfile=sys.stdout):
|
||||
"""Given a Tuskar client instance and the command line arguments display
|
||||
the detail to the user.
|
||||
"""
|
||||
"""Show an individual Overcloud by its ID."""
|
||||
overcloud = utils.find_resource(tuskar.overclouds, args.id)
|
||||
print_overcloud_detail(overcloud, outfile=outfile)
|
||||
|
||||
|
||||
def do_overcloud_list(tuskar, args, outfile=sys.stdout):
|
||||
"""Show a list of the Overclouds."""
|
||||
overclouds = tuskar.overclouds.list()
|
||||
fields = ['id', 'name', 'description', 'stack_id', 'attributes', 'counts']
|
||||
|
||||
@ -53,6 +52,7 @@ def do_overcloud_list(tuskar, args, outfile=sys.stdout):
|
||||
' separated by semicolon.',
|
||||
action='append')
|
||||
def do_overcloud_create(tuskar, args, outfile=sys.stdout):
|
||||
"""Create a new Overcloud."""
|
||||
overcloud_dict = create_overcloud_dict(args)
|
||||
overcloud = tuskar.overclouds.create(**overcloud_dict)
|
||||
print_overcloud_detail(overcloud, outfile=outfile)
|
||||
@ -74,6 +74,7 @@ def do_overcloud_create(tuskar, args, outfile=sys.stdout):
|
||||
' separated by semicolon.',
|
||||
action='append')
|
||||
def do_overcloud_update(tuskar, args, outfile=sys.stdout):
|
||||
"""Update an existing Overcloud by its ID."""
|
||||
overcloud = utils.find_resource(tuskar.overclouds, args.id)
|
||||
overcloud_dict = create_overcloud_dict(args)
|
||||
updated_overcloud = tuskar.overclouds.update(overcloud.id,
|
||||
@ -83,6 +84,7 @@ def do_overcloud_update(tuskar, args, outfile=sys.stdout):
|
||||
|
||||
@utils.arg('id', metavar="<ID>", help="ID of Overcloud to show.")
|
||||
def do_overcloud_delete(tuskar, args, outfile=sys.stdout):
|
||||
"""Delete an Overcloud by its ID."""
|
||||
overcloud = utils.find_resource(tuskar.overclouds, args.id)
|
||||
tuskar.overclouds.delete(args.id)
|
||||
print(u'Deleted Overcloud "%s".' % overcloud.name, file=outfile)
|
||||
|
@ -21,11 +21,11 @@ COMMAND_MODULES = [
|
||||
|
||||
|
||||
def enhance_parser(parser, subparsers):
|
||||
'''Take a basic (nonversioned) parser and enhance it with
|
||||
"""Take a basic (nonversioned) parser and enhance it with
|
||||
commands and options specific for this version of API.
|
||||
|
||||
:param parser: top level parser :param subparsers: top level
|
||||
parser's subparsers collection where subcommands will go
|
||||
'''
|
||||
"""
|
||||
for command_module in COMMAND_MODULES:
|
||||
utils.define_commands_from_module(subparsers, command_module)
|
||||
|
Loading…
x
Reference in New Issue
Block a user