From 97b8879739f0bab448ba2509e6e751c49bb76a44 Mon Sep 17 00:00:00 2001 From: Kun Huang Date: Tue, 3 Nov 2015 12:29:03 +0800 Subject: [PATCH] support list all agents/tracers Change-Id: I77de64944895031db5fcf4712174b52c41d4c555 --- scalpels/cli/actions/agent.py | 13 +++++++++++++ scalpels/cli/shell.py | 5 +++++ tests/ci/scalpels-ci.sh | 1 + 3 files changed, 19 insertions(+) create mode 100644 scalpels/cli/actions/agent.py diff --git a/scalpels/cli/actions/agent.py b/scalpels/cli/actions/agent.py new file mode 100644 index 0000000..37ab4dd --- /dev/null +++ b/scalpels/cli/actions/agent.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- +# Author: Kun Huang + +from scalpels.cli.actions.start import agents_map +from prettytable import PrettyTable + + +def run(config): + t = PrettyTable(["tracer", "tracer script"]) + for ag in agents_map: + t.add_row([ag, agents_map[ag]]) + print t diff --git a/scalpels/cli/shell.py b/scalpels/cli/shell.py index 02e6023..eefca25 100755 --- a/scalpels/cli/shell.py +++ b/scalpels/cli/shell.py @@ -49,6 +49,11 @@ def main(): result.add_argument("--html", action="store_true", dest="html", help="report html to stdout instead of pretty print") result.add_argument("--short", action="store_true", dest="short", help="report uuid only") + # agent command + agent = subparsers.add_parser("agent") + agent.add_argument("-l", "--list", action="store_true", dest="list", help="list all agents") + + parser = rootparser.parse_args() try: run(parser) diff --git a/tests/ci/scalpels-ci.sh b/tests/ci/scalpels-ci.sh index 9feaa06..ee88646 100755 --- a/tests/ci/scalpels-ci.sh +++ b/tests/ci/scalpels-ci.sh @@ -13,6 +13,7 @@ function debug_msg { } function basic_test { + sca agent -l sca start -a rpc -a rabbit -a traffic sca load --storm