Пример #1
0
def start():
    """ Starts baboon client !
    """

    # Ensure the validity of the configuration file.
    check_config(add_mandatory_server_fields=['streamer', 'max_stanza_size'])

    metadirs = []
    monitor = None
    transport = None

    try:
        transport = _start_transport()
        monitor = _start_monitor()
        metadirs = _start_metadirs(monitor.handler.exclude)

        # Wait until the transport is disconnected before exiting Baboon.
        _wait_disconnect(transport)
    except BaboonException as err:
        logger.error(err)
    except KeyboardInterrupt:
        pass
    finally:
        _start_close(monitor, transport, metadirs)
        logger.info("Bye !")
Пример #2
0
def kick():
    """ Kick the username to the project.
    """

    check_config()

    project = config['parser']['project']
    username = _get_username()

    print("Kick in progress...")
    with AdminTransport(logger_enabled=False) as transport:
        ret_status, msg = transport.kick(project, username)
        _on_action_finished(ret_status, msg)
Пример #3
0
def accept():
    """ Accept the username to the project.
    """

    check_config()

    project = config['parser']['project']
    username = _get_username()

    print("Acceptation in progress...")
    with AdminTransport(logger_enabled=False) as transport:
        ret_status, msg = transport.accept_pending(project, username)
        _on_action_finished(ret_status, msg)
Пример #4
0
def projects():
    """ Lists all users in a project.
    """

    check_config()

    project = config['parser'].get('project')
    subs_by_project = []

    with AdminTransport(logger_enabled=False) as transport:
        # Get all subscriptions
        subscriptions = _projects_specific(transport, project) if project \
            else _projects_all(transport)

        # Display the subscriptions in a good format.
        _projects_print_users(subscriptions)
Пример #5
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()
Пример #6
0
def init():
    """ Initialialize a new project.
    """

    check_config()

    project = config['parser']['project']
    project_path = _get_project_path(project)
    url = config['parser']['git-url']

    print("Initialize the project %s..." % project)
    with AdminTransport(logger_enabled=False) as transport:
        ret_status, msg = transport.first_git_init(project, url)

        metadir_controller = MetadirController(project, project_path)
        metadir_controller.init_index()
        metadir_controller.create_baboon_index()
        metadir_controller.index.close()

        if not _on_action_finished(ret_status, msg):
            _delete_metadir(project, project_path)