Esempio n. 1
0
def join():
    """ Join the project with the project argument name.
    """

    check_server()
    check_user()

    project = config['parser']['project']
    path = config['parser']['path']
    project_scm = _check_scm(path)

    _check_project(project)
    config['projects'][project] = {
        'path': path,
        'scm': project_scm,
        'enable': 1
    }

    print("Join in progress...")
    with AdminTransport(logger_enabled=False) as transport:
        ret_status, msg = transport.join_project(project)
        if not _on_action_finished(ret_status, msg):
            return

    dump()
Esempio n. 2
0
def create():
    """ Create a new project with the project argument name.
    """

    check_server()
    check_user()

    project = config['parser']['project']
    path = config['parser']['path']
    project_scm = _check_scm(path)

    _check_project(project)
    config['projects'][project] = {
        'path': path,
        'scm': project_scm,
        'enable': 1
    }

    print("Creation in progress...")
    with AdminTransport(logger_enabled=False) as transport:
        ret_status, msg = transport.create_project(project)
        if not _on_action_finished(ret_status, msg):
            return

    dump()

    # Do an init() if the git-url can be guessed.
    git_url = _get_git_url(path)
    if git_url:
        config['parser']['git-url'] = git_url
        init()
Esempio n. 3
0
def _on_register_finished(ret_status, msg, fatal=False):
    """ Callback for the registration.
    """

    _on_action_finished(ret_status, msg, fatal=fatal)
    # Dump the configuration file if there's no error.
    if ret_status == 200:
        dump()
Esempio n. 4
0
def unjoin():
    """ Unjoin the project with the project argument name.
    """

    check_config()

    project = config['parser']['project']
    print("Unjoin in progress...")
    with AdminTransport(logger_enabled=False) as transport:
        ret_status, msg = transport.unjoin_project(project)
        _on_action_finished(ret_status, msg)

    project_path = _get_project_path(project)
    _delete_metadir(project, project_path)
    del config['projects'][project]
    dump()