diff --git a/beat/cmdline/common.py b/beat/cmdline/common.py index d4d0e337a7f8e2bd90e19023206b07281dfb5c27..4c65c4a08186bc6399eba9a9bfd07903ebddd3e3 100644 --- a/beat/cmdline/common.py +++ b/beat/cmdline/common.py @@ -50,6 +50,7 @@ from beat.core import algorithm from beat.core import toolchain from beat.core import experiment +from beat.backend.python import utils TYPE_GLOB = { 'dataformat': os.path.join('*', '*', '*.json'), @@ -393,6 +394,13 @@ def make_up_local_list(prefix, type, requirements): ''' root = os.path.join(prefix, TYPE_PLURAL[type]) + if type in NOSTORAGE: + try: + root = os.path.join(prefix, TYPE_NOSTORAGE[type]) + except: + logger.error("Selected type is not valid: %s"%type) + return 1 + l = glob.glob(os.path.join(root, TYPE_GLOB[type])) candidates = [os.path.splitext(os.path.relpath(o, root))[0] for o in l] @@ -449,8 +457,15 @@ def display_local_list(prefix, type): for name in names: logger.info("%s", name) try: - storage = TYPE_STORAGE[type](prefix, name) - contents = simplejson.loads(storage.json.load(), object_pairs_hook=collections.OrderedDict) + contents = None + if type in NOSTORAGE: + name_path = os.path.join(prefix, TYPE_NOSTORAGE[type], name) + data_json = utils.File(name_path + '.json') + with open(data_json.path, 'rt') as f: + contents = simplejson.load(f, object_pairs_hook=collections.OrderedDict) + else: + storage = TYPE_STORAGE[type](prefix, name) + contents = simplejson.loads(storage.json.load(), object_pairs_hook=collections.OrderedDict) if 'description' in contents: logger.extra(2*' ' + contents['description']) except simplejson.JSONDecodeError: @@ -778,7 +793,6 @@ def pull(webapi, prefix, type, names, fields, force, indentation): status += 1 #error continue - from beat.backend.python import utils if 'data' in fields: name_path = os.path.join(prefix, TYPE_NOSTORAGE[type], name) data_json = utils.File(name_path + '.json')