Beispiel #1
0
def main():
    if not args.files:
        raise Exception("WTF - need a config")

    config = args.files.pop(0)
    obj = json.load(open(config, 'r'))

    machines = obj['machines']
    configs = obj['configs']
    users = obj['users']

    puts("Loading users:")
    for conf in progress.bar(users):
        u = User(**conf)
        u.save()

    puts("Loading machines:")
    for conf in progress.bar(machines):
        m = Machine(**conf)
        m.save()

    puts("Loading configs:")
    for conf in progress.bar(configs):
        c = Config(**conf)
        c.save()
Beispiel #2
0
def get_config(name='default'):
    global config
    if config:
        return config

    from lucy.models.config import Config
    config = Config.load(name)
    return config
Beispiel #3
0
def setup():
    connection = Connection('localhost', 27017)
    db = connection.lucy_test
    lucy.core.db = db
    for x in db.collection_names():
        if x.startswith('system'):
            continue

        db.drop_collection(x)

    name = "default"
    incoming = "%s/incoming/" % (ROOT)
    pool = "%s/pool/" % (ROOT)

    if name != Config(_id=name, incoming=incoming, pool=pool).save():
        raise Exception
Beispiel #4
0
def main():
    try:
        conf = Config.load('default')
    except KeyError:
        puts("Error: Need to init the db")
        sys.exit(1)

    pool = conf['pool']

    shutil.rmtree(pool)
    os.makedirs(pool)

    for x in db.collection_names():
        if x.startswith('system'):
            continue
        db.drop_collection(x)
Beispiel #5
0
def main():
    obj = Config.load('default')
    process(obj)