diff --git a/scalpels/agents/server.py b/scalpels/agents/server.py index ef730cb..3409750 100644 --- a/scalpels/agents/server.py +++ b/scalpels/agents/server.py @@ -23,7 +23,7 @@ class TraceEndpoint(object): def tracer_list(self, ctx): # TODO db_api # XXX ctx required? - from scalpels.cli.utils import traces_map + from scalpels.client.utils import traces_map return traces_map def start_tracers(self, ctx, tracers): diff --git a/scalpels/cli/__init__.py b/scalpels/client/__init__.py similarity index 100% rename from scalpels/cli/__init__.py rename to scalpels/client/__init__.py diff --git a/scalpels/cli/actions/__init__.py b/scalpels/client/actions/__init__.py similarity index 100% rename from scalpels/cli/actions/__init__.py rename to scalpels/client/actions/__init__.py diff --git a/scalpels/cli/actions/load.py b/scalpels/client/actions/load.py similarity index 100% rename from scalpels/cli/actions/load.py rename to scalpels/client/actions/load.py diff --git a/scalpels/cli/actions/report.py b/scalpels/client/actions/report.py similarity index 73% rename from scalpels/cli/actions/report.py rename to scalpels/client/actions/report.py index da3b83d..54f0ce0 100644 --- a/scalpels/cli/actions/report.py +++ b/scalpels/client/actions/report.py @@ -2,9 +2,9 @@ #-*- coding:utf-8 -*- # Author: Kun Huang -from scalpels.cli.api import api as agent_api -from scalpels.cli.utils import generate_multiple_result_html -from scalpels.cli.utils import pprint_result +from scalpels.client.api import api as agent_api +from scalpels.client.utils import generate_multiple_result_html +from scalpels.client.utils import pprint_result def run(config): diff --git a/scalpels/cli/actions/result.py b/scalpels/client/actions/result.py similarity index 89% rename from scalpels/cli/actions/result.py rename to scalpels/client/actions/result.py index bfe9fce..b1cce32 100644 --- a/scalpels/cli/actions/result.py +++ b/scalpels/client/actions/result.py @@ -2,8 +2,8 @@ #-*- coding:utf-8 -*- # Author: Kun Huang -from scalpels.cli.actions import report -from scalpels.cli.api import api as agent_api +from scalpels.client.actions import report +from scalpels.client.api import api as agent_api def run(config): """ diff --git a/scalpels/cli/actions/setup.py b/scalpels/client/actions/setup.py similarity index 100% rename from scalpels/cli/actions/setup.py rename to scalpels/client/actions/setup.py diff --git a/scalpels/cli/actions/start.py b/scalpels/client/actions/start.py similarity index 95% rename from scalpels/cli/actions/start.py rename to scalpels/client/actions/start.py index f52210d..ce8fd80 100644 --- a/scalpels/cli/actions/start.py +++ b/scalpels/client/actions/start.py @@ -4,7 +4,7 @@ import os import json -from scalpels.cli.api import api as agent_api +from scalpels.client.api import api as agent_api def _parse_agents_from_args(config): parsed_agents = set() diff --git a/scalpels/cli/actions/stop.py b/scalpels/client/actions/stop.py similarity index 83% rename from scalpels/cli/actions/stop.py rename to scalpels/client/actions/stop.py index ee43bb9..f945410 100644 --- a/scalpels/cli/actions/stop.py +++ b/scalpels/client/actions/stop.py @@ -2,7 +2,7 @@ #-*- coding:utf-8 -*- # Author: Kun Huang -from scalpels.cli.api import api as agent_api +from scalpels.client.api import api as agent_api def run(config): diff --git a/scalpels/cli/actions/tracer.py b/scalpels/client/actions/tracer.py similarity index 87% rename from scalpels/cli/actions/tracer.py rename to scalpels/client/actions/tracer.py index b29205e..2f20576 100644 --- a/scalpels/cli/actions/tracer.py +++ b/scalpels/client/actions/tracer.py @@ -2,7 +2,7 @@ #-*- coding:utf-8 -*- # Author: Kun Huang -from scalpels.cli.api import api as agent_api +from scalpels.client.api import api as agent_api from prettytable import PrettyTable diff --git a/scalpels/cli/api.py b/scalpels/client/api.py similarity index 92% rename from scalpels/cli/api.py rename to scalpels/client/api.py index b17dadd..cf51fbd 100644 --- a/scalpels/cli/api.py +++ b/scalpels/client/api.py @@ -3,8 +3,8 @@ # Author: Kun Huang -from scalpels.cli.rpcapi import rpcapi -from scalpels.cli.utils import UUID_LOWEST_SUPPORT +from scalpels.client.rpcapi import rpcapi +from scalpels.client.utils import UUID_LOWEST_SUPPORT class API(object): def __init__(self): diff --git a/scalpels/cli/rpcapi.py b/scalpels/client/rpcapi.py similarity index 100% rename from scalpels/cli/rpcapi.py rename to scalpels/client/rpcapi.py diff --git a/scalpels/cli/shell.py b/scalpels/client/shell.py similarity index 97% rename from scalpels/cli/shell.py rename to scalpels/client/shell.py index 641bdd8..b6ef3e7 100755 --- a/scalpels/cli/shell.py +++ b/scalpels/client/shell.py @@ -8,7 +8,7 @@ import importlib def run(parser): config = parser.__dict__ - modstr = "scalpels.cli.actions.%s" % config.pop("action") + modstr = "scalpels.client.actions.%s" % config.pop("action") mod = importlib.import_module(modstr) func = getattr(mod, "run") return func(config) diff --git a/scalpels/cli/utils.py b/scalpels/client/utils.py similarity index 100% rename from scalpels/cli/utils.py rename to scalpels/client/utils.py diff --git a/scalpels/cmd/__init__.py b/scalpels/cmd/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/scalpels/cmd/agent.py b/scalpels/cmd/agent.py new file mode 100644 index 0000000..eb7a8b8 --- /dev/null +++ b/scalpels/cmd/agent.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- +# Author: Kun Huang + +def main(): + raise NotImplementedError() + +if __name__ == "__main__": + main() diff --git a/scalpels/cli/manage.py b/scalpels/cmd/manage.py similarity index 100% rename from scalpels/cli/manage.py rename to scalpels/cmd/manage.py diff --git a/scalpels/cmd/tracer.py b/scalpels/cmd/tracer.py new file mode 100644 index 0000000..eb7a8b8 --- /dev/null +++ b/scalpels/cmd/tracer.py @@ -0,0 +1,9 @@ +#!/usr/bin/env python +#-*- coding:utf-8 -*- +# Author: Kun Huang + +def main(): + raise NotImplementedError() + +if __name__ == "__main__": + main() diff --git a/scripts/agent.py b/scripts/agent.py index e5f1a9f..80f4f39 100755 --- a/scripts/agent.py +++ b/scripts/agent.py @@ -18,7 +18,7 @@ python /agent.py mysql def read_from_ag(ag): # wrong impl. here, need read from config or db instead - from scalpels.cli.utils import tracers_map as agents_map + from scalpels.client.utils import tracers_map as agents_map data_dir = db_api.setup_config_get()["data_dir"].rstrip("/") return agents_map.get(ag) % data_dir diff --git a/setup.cfg b/setup.cfg index 31cfa63..757739a 100644 --- a/setup.cfg +++ b/setup.cfg @@ -27,5 +27,7 @@ packages = scalpels [entry_points] console_scripts = - sca = scalpels.cli.shell:main - sca-m = scalpels.cli.manage:main + sca = scalpels.client.shell:main + sca-manage = scalpels.cmd.manage:main + sca-agent = scalpels.cmd.agent:main + sca-tracer = scalpels.cmd.tracer:main