Improve command arguments
This patch has made the following improvements on command arguments. - Change the order of arguments which are output as Usage. - Limits the value which specifies for the argument. Change-Id: I3b69c922c35cef400a80a04dbd35d20f5f03d9db
This commit is contained in:
parent
d875c0206f
commit
f684e7c6cd
@ -136,12 +136,16 @@ class CreateHost(command.ShowOne):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--reserved',
|
'--reserved',
|
||||||
metavar='<reserved>',
|
metavar='<reserved>',
|
||||||
help=_('Host reservation. True or False.')
|
choices=['True', 'False'],
|
||||||
|
help=_('Host reservation. The supported options are: '
|
||||||
|
'True, False.')
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--on_maintenance',
|
'--on_maintenance',
|
||||||
metavar='<on_maintenance>',
|
metavar='<on_maintenance>',
|
||||||
help=_('Maintenance status of host. True or False.')
|
choices=['True', 'False'],
|
||||||
|
help=_('Maintenance status of host. The supported options are: '
|
||||||
|
'True, False.')
|
||||||
)
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
@ -184,6 +188,20 @@ class UpdateHost(command.ShowOne):
|
|||||||
metavar='<host>',
|
metavar='<host>',
|
||||||
help='Name or ID of the Host',
|
help='Name or ID of the Host',
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--reserved',
|
||||||
|
metavar='<reserved>',
|
||||||
|
choices=['True', 'False'],
|
||||||
|
help=_('Host reservation. The supported options are: '
|
||||||
|
'True, False.')
|
||||||
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--on_maintenance',
|
||||||
|
metavar='<on_maintenance>',
|
||||||
|
choices=['True', 'False'],
|
||||||
|
help=_('Maintenance status of host. The supported options are: '
|
||||||
|
'True, False.')
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--name',
|
'--name',
|
||||||
metavar='<name>',
|
metavar='<name>',
|
||||||
@ -199,16 +217,6 @@ class UpdateHost(command.ShowOne):
|
|||||||
metavar='<control_attributes>',
|
metavar='<control_attributes>',
|
||||||
help=_('Attributes about control.')
|
help=_('Attributes about control.')
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
|
||||||
'--reserved',
|
|
||||||
metavar='<reserved>',
|
|
||||||
help=_('Host reservation. True or False.')
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
'--on_maintenance',
|
|
||||||
metavar='<on_maintenance>',
|
|
||||||
help=_('Maintenance status of host. True or False.')
|
|
||||||
)
|
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
@ -99,7 +99,9 @@ class CreateNotification(command.ShowOne):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'type',
|
'type',
|
||||||
metavar='<type>',
|
metavar='<type>',
|
||||||
help=_('Type of failure.')
|
choices=['COMPUTE_HOST', 'VM', 'PROCESS'],
|
||||||
|
help=_('Type of failure. The supported options are: '
|
||||||
|
'COMPUTE_HOST, VM, PROCESS.')
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'hostname',
|
'hostname',
|
||||||
|
@ -109,7 +109,9 @@ class CreateSegment(command.ShowOne):
|
|||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'recovery_method',
|
'recovery_method',
|
||||||
metavar='<recovery_method>',
|
metavar='<recovery_method>',
|
||||||
help=_('Recovery method of segment.')
|
choices=['auto', 'reserved_host'],
|
||||||
|
help=_('Recovery method of segment. The supported options are: '
|
||||||
|
'auto, reserved_host.')
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'service_type',
|
'service_type',
|
||||||
@ -158,21 +160,23 @@ class UpdateSegment(command.ShowOne):
|
|||||||
metavar='<name>',
|
metavar='<name>',
|
||||||
help=_('Name of segment.')
|
help=_('Name of segment.')
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
|
||||||
'--description',
|
|
||||||
metavar='<description>',
|
|
||||||
help=_('Description of segment.')
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--recovery_method',
|
'--recovery_method',
|
||||||
metavar='<recovery_method>',
|
metavar='<recovery_method>',
|
||||||
help=_('Recovery method of segment.')
|
choices=['auto', 'reserved_host'],
|
||||||
|
help=_('Recovery method of segment. The supported options are: '
|
||||||
|
'auto, reserved_host')
|
||||||
)
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
'--service_type',
|
'--service_type',
|
||||||
metavar='<service_type>',
|
metavar='<service_type>',
|
||||||
help=_('Service type of segment.')
|
help=_('Service type of segment.')
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
'--description',
|
||||||
|
metavar='<description>',
|
||||||
|
help=_('Description of segment.')
|
||||||
|
)
|
||||||
return parser
|
return parser
|
||||||
|
|
||||||
def take_action(self, parsed_args):
|
def take_action(self, parsed_args):
|
||||||
|
@ -48,7 +48,9 @@ def do_notification_show(service, args):
|
|||||||
|
|
||||||
|
|
||||||
@utils.arg('--type', metavar='<TYPE>', required=True,
|
@utils.arg('--type', metavar='<TYPE>', required=True,
|
||||||
help='Type of failure.')
|
choices=['COMPUTE_HOST', 'VM', 'PROCESS'],
|
||||||
|
help='Type of failure. The supported options are: '
|
||||||
|
'COMPUTE_HOST, VM, PROCESS.')
|
||||||
@utils.arg('--hostname', metavar='<HOSTNAME>', required=True,
|
@utils.arg('--hostname', metavar='<HOSTNAME>', required=True,
|
||||||
help='Hostname of notification.')
|
help='Hostname of notification.')
|
||||||
@utils.arg('--generated-time', metavar='<GENERATED_TIME>', required=True,
|
@utils.arg('--generated-time', metavar='<GENERATED_TIME>', required=True,
|
||||||
@ -97,12 +99,14 @@ def do_segment_show(service, args):
|
|||||||
|
|
||||||
@utils.arg('--name', metavar='<SEGMENT_NAME>', required=True,
|
@utils.arg('--name', metavar='<SEGMENT_NAME>', required=True,
|
||||||
help='Name of segment.')
|
help='Name of segment.')
|
||||||
@utils.arg('--description', metavar='<DESCRIPTION>', required=True,
|
|
||||||
help='Description of segment.')
|
|
||||||
@utils.arg('--recovery-method', metavar='<RECOVERY_METHOD>', required=True,
|
@utils.arg('--recovery-method', metavar='<RECOVERY_METHOD>', required=True,
|
||||||
help='JSON string about recovery method.')
|
choices=['auto', 'reserved_host'],
|
||||||
|
help='Recovery method. '
|
||||||
|
'The supported options are: auto, reserved_host.')
|
||||||
@utils.arg('--service-type', metavar='<SERVICE_TYPE>', required=True,
|
@utils.arg('--service-type', metavar='<SERVICE_TYPE>', required=True,
|
||||||
help='Service type of segment.')
|
help='Service type of segment.')
|
||||||
|
@utils.arg('--description', metavar='<DESCRIPTION>', required=False,
|
||||||
|
help='Description of segment.')
|
||||||
def do_segment_create(service, args):
|
def do_segment_create(service, args):
|
||||||
"""Create segment."""
|
"""Create segment."""
|
||||||
try:
|
try:
|
||||||
@ -122,12 +126,15 @@ def do_segment_create(service, args):
|
|||||||
required=True, help='Name or ID of segment.')
|
required=True, help='Name or ID of segment.')
|
||||||
@utils.arg('--name', metavar='<SEGMENT_NAME>',
|
@utils.arg('--name', metavar='<SEGMENT_NAME>',
|
||||||
required=False, help='Name of segment.')
|
required=False, help='Name of segment.')
|
||||||
@utils.arg('--description', metavar='<DESCRIPTION>',
|
|
||||||
required=False, help='Description of segment.')
|
|
||||||
@utils.arg('--recovery-method', metavar='<RECOVERY_METHOD>',
|
@utils.arg('--recovery-method', metavar='<RECOVERY_METHOD>',
|
||||||
required=False, help='JSON string about recovery method.')
|
choices=['auto', 'reserved_host'],
|
||||||
|
required=False,
|
||||||
|
help='Recovery method. '
|
||||||
|
'The supported options are: auto, reserved_host.')
|
||||||
@utils.arg('--service-type', metavar='<SERVICE_TYPE>',
|
@utils.arg('--service-type', metavar='<SERVICE_TYPE>',
|
||||||
required=False, help='Service type of segment.')
|
required=False, help='Service type of segment.')
|
||||||
|
@utils.arg('--description', metavar='<DESCRIPTION>',
|
||||||
|
required=False, help='Description of segment.')
|
||||||
def do_segment_update(service, args):
|
def do_segment_update(service, args):
|
||||||
"""Update a segment."""
|
"""Update a segment."""
|
||||||
try:
|
try:
|
||||||
@ -182,18 +189,21 @@ def do_host_show(service, args):
|
|||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
|
|
||||||
@utils.arg('--segment-id', metavar='<SEGMENT_ID>', required=True,
|
|
||||||
help='Name or ID of segment.')
|
|
||||||
@utils.arg('--name', metavar='<HOST_NAME>', required=True,
|
@utils.arg('--name', metavar='<HOST_NAME>', required=True,
|
||||||
help='Name of host.')
|
help='Name of host.')
|
||||||
@utils.arg('--type', metavar='<TYPE>', required=True,
|
@utils.arg('--type', metavar='<TYPE>', required=True,
|
||||||
help='Type of host.')
|
help='Type of host.')
|
||||||
@utils.arg('--control-attributes', metavar='<CONTROL_ATTRIBUTES>',
|
@utils.arg('--control-attributes', metavar='<CONTROL_ATTRIBUTES>',
|
||||||
required=True, help='Control attributes of host.')
|
required=True, help='Control attributes of host.')
|
||||||
|
@utils.arg('--segment-id', metavar='<SEGMENT_ID>', required=True,
|
||||||
|
help='Name or ID of segment.')
|
||||||
@utils.arg('--reserved', metavar='<RESERVED>', required=False,
|
@utils.arg('--reserved', metavar='<RESERVED>', required=False,
|
||||||
help='')
|
choices=['True', 'False'],
|
||||||
|
help='Host reservation. The supported options are: True, False.')
|
||||||
@utils.arg('--on-maintenance', metavar='<ON_MAINTENANCE>', required=False,
|
@utils.arg('--on-maintenance', metavar='<ON_MAINTENANCE>', required=False,
|
||||||
help='')
|
choices=['True', 'False'],
|
||||||
|
help='Maintenance status of host. The supported options are: '
|
||||||
|
'True, False.')
|
||||||
def do_host_create(service, args):
|
def do_host_create(service, args):
|
||||||
"""Create a host."""
|
"""Create a host."""
|
||||||
try:
|
try:
|
||||||
@ -214,15 +224,19 @@ def do_host_create(service, args):
|
|||||||
help='Name or ID of segment.')
|
help='Name or ID of segment.')
|
||||||
@utils.arg('--id', metavar='<HOST_ID>', required=True,
|
@utils.arg('--id', metavar='<HOST_ID>', required=True,
|
||||||
help='Name or ID of host.')
|
help='Name or ID of host.')
|
||||||
|
@utils.arg('--reserved', metavar='<RESERVED>', required=False,
|
||||||
|
choices=['True', 'False'],
|
||||||
|
help='Host reservation. The supported options are: True, False.')
|
||||||
|
@utils.arg('--on-maintenance', metavar='<ON_MAINTENANCE>',
|
||||||
|
required=False, choices=['True', 'False'],
|
||||||
|
help='Maintenance status of host. The supported options are: '
|
||||||
|
'True, False.')
|
||||||
@utils.arg('--name', metavar='<HOST_NAME>', required=False,
|
@utils.arg('--name', metavar='<HOST_NAME>', required=False,
|
||||||
help='Name of host.')
|
help='Name of host.')
|
||||||
@utils.arg('--type', metavar='<TYPE>', required=False,
|
@utils.arg('--type', metavar='<TYPE>', required=False,
|
||||||
help='Type of host.')
|
help='Type of host.')
|
||||||
@utils.arg('--control-attributes', metavar='<CONTROL_ATTRIBUTES>',
|
@utils.arg('--control-attributes', metavar='<CONTROL_ATTRIBUTES>',
|
||||||
required=False, help='Control attributes of host.')
|
required=False, help='Control attributes of host.')
|
||||||
@utils.arg('--reserved', metavar='<RESERVED>', required=False, help='')
|
|
||||||
@utils.arg('--on-maintenance', metavar='<ON_MAINTENANCE>',
|
|
||||||
required=False, help='')
|
|
||||||
def do_host_update(service, args):
|
def do_host_update(service, args):
|
||||||
"""Update a host."""
|
"""Update a host."""
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user