Extend the query_keyvals script to allow you to pass in multiple
job IDs.
Risk: Low
Visibility: Make the query_keyval command easier to use with multiple
jobs.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@2695 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/cli/query_keyvals b/cli/query_keyvals
index cb0f6f5..e8e7503 100644
--- a/cli/query_keyvals
+++ b/cli/query_keyvals
@@ -53,20 +53,21 @@
def main():
parser, options, args = parse_options()
- if len(args) != 1:
- print "Invalid number of arguments"
- print
+ if not args:
parser.print_help()
- sys.exit(1)
+ return
- query_filter = {"job_tag__startswith": "%s-" % args[0]}
+ query_filter = {}
if options.machine:
query_filter["hostname"] = options.machine
if options.test:
query_filter["test_name"] = options.test
comm = rpc.tko_comm()
- test_views = comm.run("get_detailed_test_views", **query_filter)
+ test_views = []
+ for job_id in args:
+ query_filter["job_tag__startswith"] = "%s-" % job_id
+ test_views += comm.run("get_detailed_test_views", **query_filter)
print_views(test_views, options)