From 2d77c0442b5bd443ff609be3c3ef547c024bc6de Mon Sep 17 00:00:00 2001 From: Hechen Gao Date: Tue, 8 Sep 2015 00:12:53 -0700 Subject: [PATCH] Misc doc fix + make clusters argument required --- images/portal/resources/toolset/toolset/commands/grep.py | 6 +++--- images/portal/resources/toolset/toolset/commands/log.py | 4 ++-- images/portal/resources/toolset/toolset/commands/ls.py | 2 +- images/portal/resources/toolset/toolset/commands/off.py | 4 ++-- images/portal/resources/toolset/toolset/commands/on.py | 9 ++++----- images/portal/resources/toolset/toolset/commands/ping.py | 4 ++-- images/portal/resources/toolset/toolset/commands/poll.py | 6 +++--- images/portal/resources/toolset/toolset/commands/port.py | 6 +++--- .../portal/resources/toolset/toolset/commands/reset.py | 4 ++-- .../portal/resources/toolset/toolset/commands/scale.py | 2 +- 10 files changed, 23 insertions(+), 24 deletions(-) diff --git a/images/portal/resources/toolset/toolset/commands/grep.py b/images/portal/resources/toolset/toolset/commands/grep.py index 9d8bc1f..7eb784d 100644 --- a/images/portal/resources/toolset/toolset/commands/grep.py +++ b/images/portal/resources/toolset/toolset/commands/grep.py @@ -36,7 +36,7 @@ class _Tool(Template): def customize(self, parser): - parser.add_argument('clusters', type=str, nargs='*', default='*', help='1+ clusters (can be a glob pattern, e.g foo*)') + parser.add_argument('clusters', type=str, nargs='+', help='1+ clusters (can be a glob pattern, e.g foo*)') parser.add_argument('-j', '--json', action='store_true', help='switch for json output') def body(self, args, proxy): @@ -67,7 +67,7 @@ def _query(zk): logger.info(' '.join((val.ljust(width) for val, width in zip(row, widths)))) if args.json: - + logger.info(json.dumps(outs)) - return _Tool() \ No newline at end of file + return _Tool() diff --git a/images/portal/resources/toolset/toolset/commands/log.py b/images/portal/resources/toolset/toolset/commands/log.py index 35f6ec6..b81ad9c 100644 --- a/images/portal/resources/toolset/toolset/commands/log.py +++ b/images/portal/resources/toolset/toolset/commands/log.py @@ -37,7 +37,7 @@ class _Tool(Template): def customize(self, parser): - parser.add_argument('clusters', type=str, nargs='*', default='*', help='1+ clusters (can be a glob pattern, e.g foo*)') + parser.add_argument('clusters', type=str, nargs='+', help='1+ clusters (can be a glob pattern, e.g foo*)') parser.add_argument('-l', action='store_true', dest='long', help='display the entire log') parser.add_argument('-i', '--indices', action='store', dest='indices', type=int, nargs='+', help='1+ indices') @@ -56,4 +56,4 @@ def _query(zk): logger.info('<%s> -> %d%% replies (%d pods total) ->\n%s' % (token, pct, len(js), '\n'.join(unrolled))) - return _Tool() \ No newline at end of file + return _Tool() diff --git a/images/portal/resources/toolset/toolset/commands/ls.py b/images/portal/resources/toolset/toolset/commands/ls.py index e9ab426..446b31f 100644 --- a/images/portal/resources/toolset/toolset/commands/ls.py +++ b/images/portal/resources/toolset/toolset/commands/ls.py @@ -82,4 +82,4 @@ def _query(zk): for row in rows: logger.info(' '.join((val.ljust(width) for val, width in zip(row, widths)))) - return _Tool() \ No newline at end of file + return _Tool() diff --git a/images/portal/resources/toolset/toolset/commands/off.py b/images/portal/resources/toolset/toolset/commands/off.py index 3485e34..7c3e72c 100644 --- a/images/portal/resources/toolset/toolset/commands/off.py +++ b/images/portal/resources/toolset/toolset/commands/off.py @@ -39,7 +39,7 @@ class _Tool(Template): def customize(self, parser): - parser.add_argument('clusters', type=str, nargs='*', default='*', help='1+ clusters (can be a glob pattern, e.g foo*)') + parser.add_argument('clusters', type=str, nargs='+', help='1+ clusters (can be a glob pattern, e.g foo*)') parser.add_argument('-i', '--indices', action='store', dest='indices', type=int, nargs='+', help='1+ indices') parser.add_argument('--force', action='store_true', dest='force', help='enables wildcards') @@ -58,4 +58,4 @@ def _query(zk): pct = (len(js) * 100) / total logger.info('<%s> -> %d%% replies, %d pods off' % (token, pct, len(js))) - return _Tool() \ No newline at end of file + return _Tool() diff --git a/images/portal/resources/toolset/toolset/commands/on.py b/images/portal/resources/toolset/toolset/commands/on.py index 7d4b9a8..aa3a1e5 100644 --- a/images/portal/resources/toolset/toolset/commands/on.py +++ b/images/portal/resources/toolset/toolset/commands/on.py @@ -29,16 +29,15 @@ class _Tool(Template): help = \ ''' - Switches one or more containers off (their sub-process being gracefully shutdown while the pod keeps - running). Individual containers can also be cherry-picked by specifying their sequence index and using - -i. + Switches one or more containers on. Individual containers can also be cherry-picked by specifying + their sequence index and using -i. ''' tag = 'on' def customize(self, parser): - parser.add_argument('clusters', type=str, nargs='*', default='*', help='1+ clusters (can be a glob pattern, e.g foo*)') + parser.add_argument('clusters', type=str, nargs='+', help='1+ clusters (can be a glob pattern, e.g foo*)') parser.add_argument('-i', '--indices', action='store', dest='indices', type=int, nargs='+', help='1+ indices') def body(self, args, proxy): @@ -54,4 +53,4 @@ def _query(zk): pct = (len(js) * 100) / total logger.info('<%s> -> %d%% replies, %d pods on' % (token, pct, len(js))) - return _Tool() \ No newline at end of file + return _Tool() diff --git a/images/portal/resources/toolset/toolset/commands/ping.py b/images/portal/resources/toolset/toolset/commands/ping.py index c5d4bed..a25b75b 100644 --- a/images/portal/resources/toolset/toolset/commands/ping.py +++ b/images/portal/resources/toolset/toolset/commands/ping.py @@ -43,7 +43,7 @@ class _Tool(Template): def customize(self, parser): parser.add_argument('yaml', nargs=1, help='YAML file') - parser.add_argument('clusters', type=str, nargs='*', default='*', help='1+ clusters (can be a glob pattern, e.g foo*)') + parser.add_argument('clusters', type=str, nargs='+', help='1+ clusters (can be a glob pattern, e.g foo*)') parser.add_argument('-j', action='store_true', dest='json', help='json output') def body(self, args, proxy): @@ -77,4 +77,4 @@ def _query(zk): mark = failure.problem_mark assert 0, '%s is invalid (line %s, column %s)' % (args.yaml, mark.line+1, mark.column+1) - return _Tool() \ No newline at end of file + return _Tool() diff --git a/images/portal/resources/toolset/toolset/commands/poll.py b/images/portal/resources/toolset/toolset/commands/poll.py index cd4ba5e..7193714 100644 --- a/images/portal/resources/toolset/toolset/commands/poll.py +++ b/images/portal/resources/toolset/toolset/commands/poll.py @@ -37,7 +37,7 @@ class _Tool(Template): def customize(self, parser): - parser.add_argument('clusters', type=str, nargs='*', default='*', help='1+ clusters (can be a glob pattern, e.g foo*).') + parser.add_argument('clusters', type=str, nargs='+', help='1+ clusters (can be a glob pattern, e.g foo*).') parser.add_argument('-j', '--json', action='store_true', help='switch for json output') def body(self, args, proxy): @@ -55,7 +55,7 @@ def _query(zk): return len(replies), {key: hints['metrics'] for key, (index, hints, code) in replies.items() if code == 200 and 'metrics' in hints} total, js = run(proxy, _query) - + outs.update(js) # @@ -69,7 +69,7 @@ def _query(zk): widths = [max(map(len, col)) for col in zip(*rows)] for row in rows: logger.info(' '.join((val.ljust(width) for val, width in zip(row, widths)))) - + if args.json: logger.info(json.dumps(outs)) diff --git a/images/portal/resources/toolset/toolset/commands/port.py b/images/portal/resources/toolset/toolset/commands/port.py index 7ded4dc..b4cef06 100644 --- a/images/portal/resources/toolset/toolset/commands/port.py +++ b/images/portal/resources/toolset/toolset/commands/port.py @@ -37,7 +37,7 @@ class _Tool(Template): def customize(self, parser): parser.add_argument('port', type=int, nargs=1, help='TCP port to lookup') - parser.add_argument('clusters', type=str, nargs='*', default='*', help='1+ clusters (can be a glob pattern, e.g foo*)') + parser.add_argument('clusters', type=str, nargs='+', help='1+ clusters (can be a glob pattern, e.g foo*)') parser.add_argument('-j', '--json', action='store_true', help='switch for json output') def body(self, args, proxy): @@ -67,7 +67,7 @@ def _query(zk): logger.info(' '.join((val.ljust(width) for val, width in zip(row, widths)))) if args.json: - + logger.info(json.dumps(outs)) - return _Tool() \ No newline at end of file + return _Tool() diff --git a/images/portal/resources/toolset/toolset/commands/reset.py b/images/portal/resources/toolset/toolset/commands/reset.py index a61b25e..ec43f7b 100644 --- a/images/portal/resources/toolset/toolset/commands/reset.py +++ b/images/portal/resources/toolset/toolset/commands/reset.py @@ -109,7 +109,7 @@ class _Tool(Template): def customize(self, parser): - parser.add_argument('clusters', type=str, nargs='*', default='*', help='1+ clusters (can be a glob pattern, e.g foo*)') + parser.add_argument('clusters', type=str, nargs='+', help='1+ clusters (can be a glob pattern, e.g foo*)') parser.add_argument('-i', '--indices', action='store', dest='indices', type=int, nargs='+', help='1+ indices') parser.add_argument('-j', action='store_true', dest='json', help='json output') parser.add_argument('--force', action='store_true', dest='force', help='enables wildcards') @@ -134,4 +134,4 @@ def body(self, args, proxy): return 0 if pct == 100 else 1 - return _Tool() \ No newline at end of file + return _Tool() diff --git a/images/portal/resources/toolset/toolset/commands/scale.py b/images/portal/resources/toolset/toolset/commands/scale.py index 90e4a62..65e3de6 100644 --- a/images/portal/resources/toolset/toolset/commands/scale.py +++ b/images/portal/resources/toolset/toolset/commands/scale.py @@ -252,4 +252,4 @@ def body(self, args, proxy): logger.info(json.dumps(outcome) if args.json else '%d%% success (%+d pods)' % (pct, delta)) return 0 if pct == 100 else 1 - return _Tool() \ No newline at end of file + return _Tool()