예제 #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 unpack(data):
    """ Unpacks the data. On error, log an error message and returns None.
    """

    try:
        return pickle.loads(data)
    except Exception as err:
        logger.error(err)
예제 #3
0
파일: main.py 프로젝트: rhunter/baboon
def main():
    """ The entry point of the Baboon client.
    """

    try:
        # Call the correct method according to the current arg subparser.
        getattr(commands, config['parser']['which'])()
    except (ConfigException, KeyError) as err:
        logger.error(err)
        sys.exit(1)