From b2e2b905691e678b27e686067a6369c9033ff621 Mon Sep 17 00:00:00 2001 From: Feei Date: Fri, 11 Aug 2017 15:15:31 +0800 Subject: [PATCH] improves running list data --- cobra/__init__.py | 2 +- cobra/api.py | 6 +++--- cobra/cli.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cobra/__init__.py b/cobra/__init__.py index 9cc09c93..f9524bd9 100644 --- a/cobra/__init__.py +++ b/cobra/__init__.py @@ -69,7 +69,7 @@ def main(): if args.sid is None: a_sid = get_sid(args.target, True) data = { - 'sids': [] + 'sids': {} } Running(a_sid).list(data) data = { diff --git a/cobra/api.py b/cobra/api.py index ad3ec801..27bc8e7e 100644 --- a/cobra/api.py +++ b/cobra/api.py @@ -94,7 +94,7 @@ def post(): } a_sid_data = { - 'sids': [] + 'sids': {} } running = Running(a_sid) @@ -145,8 +145,8 @@ def post(): r_data = running.list() ret = True logger.info(r_data['sids']) - for s in r_data['sids']: - if Running(s).is_file(True) is False: + for sid, git in r_data['sids'].items(): + if Running(sid).is_file(True) is False: ret = False if ret: result['status'] = 'done' diff --git a/cobra/cli.py b/cobra/cli.py index 7ecfcdc9..92531cee 100644 --- a/cobra/cli.py +++ b/cobra/cli.py @@ -46,7 +46,7 @@ def start(target, formatter, output, special_rules, a_sid=None): s_sid = get_sid(target) r = Running(a_sid) data = r.list() - data['sids'].append(s_sid) + data['sids'][s_sid] = target r.list(data) report = '?sid={a_sid}'.format(a_sid=a_sid)