コード例 #1
0
ファイル: cli.py プロジェクト: kushal124/summershum
def main():
    opts, args = parse_args()

    config = fedmsg.config.load_config()
    config.update({
        'name': 'relay_inbound',
        'active': True,
    })

    dictConfig(config.get('logging', {'version': 1}))
    log.info("Starting summershum ingestion")

    fedmsg.init(**config)

    session = summershum.model.create_session(
        config['summershum.sqlalchemy.url'],
        create=True,
    )

    datagrepper_url = config['summershum.datagrepper']
    messages = __get_messages(datagrepper_url, opts.msg_id)
    for message in messages:
        msg = message['msg']
        summershum.core.ingest(
            session=session,
            msg=msg,
            config=config,
            msg_id=message.get('msg_id', None),
            force=opts.force,
        )
コード例 #2
0
ファイル: cli.py プロジェクト: fedora-infra/summershum
def main():
    opts, args = parse_args()

    config = fedmsg.config.load_config()
    config.update({
        'name': 'relay_inbound',
        'active': True,
    })

    dictConfig(config.get('logging', {'version': 1}))
    log.info("Starting summershum ingestion")

    fedmsg.init(**config)

    session = summershum.model.create_session(
        config['summershum.sqlalchemy.url'],
        create=True,
    )

    datagrepper_url = config['summershum.datagrepper']
    messages = __get_messages(datagrepper_url, opts.msg_id)
    for message in messages:
        msg = message['msg']
        summershum.core.ingest(
            session=session,
            msg=msg,
            config=config,
            msg_id=message.get('msg_id', None),
            force=opts.force,
        )
コード例 #3
0
 def __init__(self):
     config = fedmsg.config.load_config()
     config.update(dict(
         name='relay_inbound',
         cert_prefix='shell',
         active=True,
     ))
     fedmsg.init(**config)
コード例 #4
0
ファイル: __init__.py プロジェクト: kushaldas/fedmsg
def init(**kw):

    global __context
    if __context:
        raise ValueError("fedmsg already initialized")

    # Read config from CLI args and a config file
    config = fedmsg.config.load_config([], None)

    # Override the defaults with whatever the user explicitly passes in.
    config.update(kw)

    __context = fedmsg.core.FedMsgContext(**config)
    return __context
コード例 #5
0
 def __init__(self):
     config = fedmsg.config.load_config()
     config.update(dict(
         name='relay_inbound',
         cert_prefix='shell',
         active=True,
     ))
     # It seems like recursive playbooks call this over and over again and
     # fedmsg doesn't like to be initialized more than once.  So, here, just
     # catch that and ignore it.
     try:
         fedmsg.init(**config)
     except ValueError:
         pass
コード例 #6
0
def init(**kw):

    global __context
    if __context:
        raise ValueError("fedmsg already initialized")

    # Read config from CLI args and a config file
    config = fedmsg.config.load_config([], None)

    # Override the defaults with whatever the user explicitly passes in.
    config.update(kw)

    __context = fedmsg.core.FedMsgContext(**config)
    return __context
コード例 #7
0
ファイル: __init__.py プロジェクト: relrod/fedmsg
def init(**kw):
    """ Initialize an instance of :class:`fedmsg.core.FedMsgContext`.

    The config is loaded with :func:`fedmsg.config.load_config` and updated
    by any keyword arguments.  This config is used to initialize the context
    object.

    The object is stored in a thread local as
    :data:`fedmsg.__local.__context`.
    """

    if hasattr(__local, "__context"):
        raise ValueError("fedmsg already initialized")

    # Read config from CLI args and a config file
    config = fedmsg.config.load_config([], None)

    # Override the defaults with whatever the user explicitly passes in.
    config.update(kw)

    __local.__context = fedmsg.core.FedMsgContext(**config)
    return __local.__context
コード例 #8
0
ファイル: __init__.py プロジェクト: relrod/fedmsg
def init(**kw):
    """ Initialize an instance of :class:`fedmsg.core.FedMsgContext`.

    The config is loaded with :func:`fedmsg.config.load_config` and updated
    by any keyword arguments.  This config is used to initialize the context
    object.

    The object is stored in a thread local as
    :data:`fedmsg.__local.__context`.
    """

    if hasattr(__local, '__context'):
        raise ValueError("fedmsg already initialized")

    # Read config from CLI args and a config file
    config = fedmsg.config.load_config([], None)

    # Override the defaults with whatever the user explicitly passes in.
    config.update(kw)

    __local.__context = fedmsg.core.FedMsgContext(**config)
    return __local.__context