improve help docs for cli commands
Adds default field into help docs for all lists cli commands. Closes-bug: #1527271 Change-Id: I3081f273bf7b5fd512b0bbd105b3dfd1d69772b9
This commit is contained in:
@@ -56,6 +56,10 @@ ORDER_DIRECTIONS = ['asc', 'desc']
|
|||||||
COMPLEX_OPERATORS = ['and', 'or']
|
COMPLEX_OPERATORS = ['and', 'or']
|
||||||
SIMPLE_OPERATORS = ["=", "!=", "<", "<=", '>', '>=']
|
SIMPLE_OPERATORS = ["=", "!=", "<", "<=", '>', '>=']
|
||||||
|
|
||||||
|
DEFAULT_API_LIMIT = ('API server limits result to <default_api_return_limit> '
|
||||||
|
'rows if no limit provided. Option is configured in '
|
||||||
|
'ceilometer.conf [api] group')
|
||||||
|
|
||||||
|
|
||||||
class NotEmptyAction(argparse.Action):
|
class NotEmptyAction(argparse.Action):
|
||||||
def __call__(self, parser, namespace, values, option_string=None):
|
def __call__(self, parser, namespace, values, option_string=None):
|
||||||
@@ -134,7 +138,7 @@ def do_statistics(cc, args):
|
|||||||
@utils.arg('-m', '--meter', metavar='<NAME>',
|
@utils.arg('-m', '--meter', metavar='<NAME>',
|
||||||
action=NotEmptyAction, help='Name of meter to show samples for.')
|
action=NotEmptyAction, help='Name of meter to show samples for.')
|
||||||
@utils.arg('-l', '--limit', metavar='<NUMBER>',
|
@utils.arg('-l', '--limit', metavar='<NUMBER>',
|
||||||
help='Maximum number of samples to return.')
|
help='Maximum number of samples to return. %s' % DEFAULT_API_LIMIT)
|
||||||
def do_sample_list(cc, args):
|
def do_sample_list(cc, args):
|
||||||
"""List the samples (return OldSample objects if -m/--meter is set)."""
|
"""List the samples (return OldSample objects if -m/--meter is set)."""
|
||||||
if not args.meter:
|
if not args.meter:
|
||||||
@@ -261,7 +265,7 @@ def do_sample_create(cc, args={}):
|
|||||||
help='key[op]data_type::value; list. data_type is optional, '
|
help='key[op]data_type::value; list. data_type is optional, '
|
||||||
'but if supplied must be string, integer, float, or boolean.')
|
'but if supplied must be string, integer, float, or boolean.')
|
||||||
@utils.arg('-l', '--limit', metavar='<NUMBER>',
|
@utils.arg('-l', '--limit', metavar='<NUMBER>',
|
||||||
help='Maximum number of meters to return.')
|
help='Maximum number of meters to return. %s' % DEFAULT_API_LIMIT)
|
||||||
def do_meter_list(cc, args={}):
|
def do_meter_list(cc, args={}):
|
||||||
"""List the user's meters."""
|
"""List the user's meters."""
|
||||||
meters = cc.meters.list(q=options.cli_to_array(args.query),
|
meters = cc.meters.list(q=options.cli_to_array(args.query),
|
||||||
@@ -1064,7 +1068,8 @@ def do_alarm_history(cc, args={}):
|
|||||||
@utils.arg('--meter-links', dest='meter_links', action='store_true',
|
@utils.arg('--meter-links', dest='meter_links', action='store_true',
|
||||||
help='If specified, meter links will be generated.')
|
help='If specified, meter links will be generated.')
|
||||||
@utils.arg('-l', '--limit', metavar='<NUMBER>',
|
@utils.arg('-l', '--limit', metavar='<NUMBER>',
|
||||||
help='Maximum number of resources to return.')
|
help='Maximum number of resources to return. %s' %
|
||||||
|
DEFAULT_API_LIMIT)
|
||||||
def do_resource_list(cc, args={}):
|
def do_resource_list(cc, args={}):
|
||||||
"""List the resources."""
|
"""List the resources."""
|
||||||
resources = cc.resources.list(q=options.cli_to_array(args.query),
|
resources = cc.resources.list(q=options.cli_to_array(args.query),
|
||||||
@@ -1099,7 +1104,7 @@ def do_resource_show(cc, args={}):
|
|||||||
@utils.arg('--no-traits', dest='no_traits', action='store_true',
|
@utils.arg('--no-traits', dest='no_traits', action='store_true',
|
||||||
help='If specified, traits will not be printed.')
|
help='If specified, traits will not be printed.')
|
||||||
@utils.arg('-l', '--limit', metavar='<NUMBER>',
|
@utils.arg('-l', '--limit', metavar='<NUMBER>',
|
||||||
help='Maximum number of events to return.')
|
help='Maximum number of events to return. %s' % DEFAULT_API_LIMIT)
|
||||||
def do_event_list(cc, args={}):
|
def do_event_list(cc, args={}):
|
||||||
"""List events."""
|
"""List events."""
|
||||||
events = cc.events.list(q=options.cli_to_array(args.query),
|
events = cc.events.list(q=options.cli_to_array(args.query),
|
||||||
@@ -1170,7 +1175,7 @@ def do_trait_list(cc, args={}):
|
|||||||
help=('[{field_name: direction}, {field_name: direction}] '
|
help=('[{field_name: direction}, {field_name: direction}] '
|
||||||
'The direction is one of: ' + str(ORDER_DIRECTIONS) + '.'))
|
'The direction is one of: ' + str(ORDER_DIRECTIONS) + '.'))
|
||||||
@utils.arg('-l', '--limit', metavar='<LIMIT>',
|
@utils.arg('-l', '--limit', metavar='<LIMIT>',
|
||||||
help='Maximum number of samples to return.')
|
help='Maximum number of samples to return. %s' % DEFAULT_API_LIMIT)
|
||||||
def do_query_samples(cc, args):
|
def do_query_samples(cc, args):
|
||||||
"""Query samples."""
|
"""Query samples."""
|
||||||
fields = {'filter': args.filter,
|
fields = {'filter': args.filter,
|
||||||
@@ -1197,7 +1202,7 @@ def do_query_samples(cc, args):
|
|||||||
help=('[{field_name: direction}, {field_name: direction}] '
|
help=('[{field_name: direction}, {field_name: direction}] '
|
||||||
'The direction is one of: ' + str(ORDER_DIRECTIONS) + '.'))
|
'The direction is one of: ' + str(ORDER_DIRECTIONS) + '.'))
|
||||||
@utils.arg('-l', '--limit', metavar='<LIMIT>',
|
@utils.arg('-l', '--limit', metavar='<LIMIT>',
|
||||||
help='Maximum number of alarms to return.')
|
help='Maximum number of alarms to return. %s' % DEFAULT_API_LIMIT)
|
||||||
def do_query_alarms(cc, args):
|
def do_query_alarms(cc, args):
|
||||||
"""Query Alarms."""
|
"""Query Alarms."""
|
||||||
fields = {'filter': args.filter,
|
fields = {'filter': args.filter,
|
||||||
@@ -1219,7 +1224,8 @@ def do_query_alarms(cc, args):
|
|||||||
help=('[{field_name: direction}, {field_name: direction}] '
|
help=('[{field_name: direction}, {field_name: direction}] '
|
||||||
'The direction is one of: ' + str(ORDER_DIRECTIONS) + '.'))
|
'The direction is one of: ' + str(ORDER_DIRECTIONS) + '.'))
|
||||||
@utils.arg('-l', '--limit', metavar='<LIMIT>',
|
@utils.arg('-l', '--limit', metavar='<LIMIT>',
|
||||||
help='Maximum number of alarm history items to return.')
|
help='Maximum number of alarm history items to return. %s' %
|
||||||
|
DEFAULT_API_LIMIT)
|
||||||
def do_query_alarm_history(cc, args):
|
def do_query_alarm_history(cc, args):
|
||||||
"""Query Alarm History."""
|
"""Query Alarm History."""
|
||||||
fields = {'filter': args.filter,
|
fields = {'filter': args.filter,
|
||||||
|
|||||||
Reference in New Issue
Block a user