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, )
def __init__(self): config = fedmsg.config.load_config() config.update(dict( name='relay_inbound', cert_prefix='shell', active=True, )) fedmsg.init(**config)
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
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
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
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