redesign endpoints

see:
sca = scalpels.client.shell:main
sca-manage = scalpels.cmd.manage:main # admin's behaviour
sca-agent = scalpels.cmd.agent:main # agent daemon on node
sca-tracer = scalpels.cmd.tracer:main # tracer process

Change-Id: Ieb4fcde857290999e43aeb06a0eeac9149ea2bd7
This commit is contained in:
Kun Huang 2015-11-11 13:18:43 +08:00
parent 472f4ae4d2
commit 28a26ff91f
20 changed files with 35 additions and 15 deletions

View File

@ -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):

View File

@ -2,9 +2,9 @@
#-*- coding:utf-8 -*-
# Author: Kun Huang <academicgareth@gmail.com>
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):

View File

@ -2,8 +2,8 @@
#-*- coding:utf-8 -*-
# Author: Kun Huang <academicgareth@gmail.com>
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):
"""

View File

@ -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()

View File

@ -2,7 +2,7 @@
#-*- coding:utf-8 -*-
# Author: Kun Huang <academicgareth@gmail.com>
from scalpels.cli.api import api as agent_api
from scalpels.client.api import api as agent_api
def run(config):

View File

@ -2,7 +2,7 @@
#-*- coding:utf-8 -*-
# Author: Kun Huang <academicgareth@gmail.com>
from scalpels.cli.api import api as agent_api
from scalpels.client.api import api as agent_api
from prettytable import PrettyTable

View File

@ -3,8 +3,8 @@
# Author: Kun Huang <academicgareth@gmail.com>
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):

View File

@ -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)

0
scalpels/cmd/__init__.py Normal file
View File

9
scalpels/cmd/agent.py Normal file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# Author: Kun Huang <academicgareth@gmail.com>
def main():
raise NotImplementedError()
if __name__ == "__main__":
main()

9
scalpels/cmd/tracer.py Normal file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# Author: Kun Huang <academicgareth@gmail.com>
def main():
raise NotImplementedError()
if __name__ == "__main__":
main()

View File

@ -18,7 +18,7 @@ python <path-to-dir>/agent.py <uuid> 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

View File

@ -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