Esempio n. 1
0
def migrate(session, task, id, revision):
    if id == 'all':
        instances = Instance.all(session)
    else:
        instances = [Instance.get(session, id)]

    for instance in instances:
        instance.upgrade_schema(revision)
Esempio n. 2
0
def instances_allowed_for_user(context, request):
    email = urllib.unquote(request.matchdict['email'])
    user = User.get(request.db_session, email)
    res = {}
    for instance in Instance.all(request.db_session):
        if user.can_access(instance):
            res[instance.domain] = instance.to_dict()

    return res
Esempio n. 3
0
def reload(session, task, id, force=False, kill=False):
    if id == 'all':
        instances = Instance.all(session)
    else:
        instances = [Instance.get(session, id)]

    for instance in instances:
        if instance.enabled:
            instance.reload(force=force, kill=kill)
Esempio n. 4
0
def rewrite(session, task, id):
    if id == "all":
        instances = Instance.all(session)
    else:
        instances = [Instance.get(session, id)]

    envs = {}
    for instance in instances:
        if not instance.enabled:
            continue

        env = instance.environment
        envs[env.name] = env
        instance.rewrite(restart_services=False)

    for env in envs.values():
        env.restart_services()