Exemplo n.º 1
0
    def execute(self, parsed_args):
        context = get_admin_context()
        conn = self.get_connection('collector')

        data = conn.list_pg_providers(context)

        for p in data:
            keys = ['type', 'name']
            methods = [":".join([m[k] for k in keys]) for m in p['methods']]
            p['methods'] = ", ".join(methods)
        return data
Exemplo n.º 2
0
def notify(context, message):
    """Sends a notification to the RabbitMQ"""
    if not context:
        context = req_context.get_admin_context()
    priority = message.get('priority', CONF.default_notification_level)
    priority = priority.lower()
    for topic in CONF.notification_topics:
        topic = '%s.%s' % (topic, priority)
        try:
            rpc.notify(context, topic, message)
        except Exception, e:
            LOG.exception(
                _("Could not send notification to %(topic)s. "
                  "Payload=%(message)s"), locals())
Exemplo n.º 3
0
def notify(context, message):
    """Sends a notification to the RabbitMQ"""
    if not context:
        context = req_context.get_admin_context()
    priority = message.get('priority',
                           CONF.default_notification_level)
    priority = priority.lower()
    for topic in CONF.notification_topics:
        topic = '%s.%s' % (topic, priority)
        try:
            rpc.notify(context, topic, message)
        except Exception, e:
            LOG.exception(_("Could not send notification to %(topic)s. "
                            "Payload=%(message)s"), locals())
Exemplo n.º 4
0
def notify(context, message):
    """Sends a notification via RPC."""
    if not context:
        context = req_context.get_admin_context()
    priority = message.get('priority',
                           CONF.default_notification_level)
    priority = priority.lower()
    for topic in CONF.rpc_notifier2.topics:
        topic = '%s.%s' % (topic, priority)
        try:
            rpc.notify(context, topic, message, envelope=True)
        except Exception:
            LOG.exception(_("Could not send notification to %(topic)s. "
                            "Payload=%(message)s"),
                          {"topic": topic, "message": message})
Exemplo n.º 5
0
 def get_admin_context(self, **kw):
     return get_admin_context(**kw)
Exemplo n.º 6
0
SAMPLES = get_samples()


def get_fixture(name, fixture=0, values={}):
    f = SAMPLES[name][fixture].copy()
    f.update(values)
    return f


if __name__ == '__main__':
    service.prepare_service(sys.argv)
    conn = get_connection('central')

    samples = get_samples()

    ctxt = get_admin_context()

    currencies = {}
    for c in samples['currency']:
        currencies[c['name']] = conn.create_currency(ctxt, c)

    languages = {}
    for l in samples['language']:
        languages[l['name']] = conn.create_language(ctxt, l)

    country_data = {
        "currency_name": currencies['nok']['name'],
        "language_name": languages['nor']['name']}

    merchant = conn.create_merchant(
        ctxt, get_fixture('merchant', values=country_data))
Exemplo n.º 7
0
 def get_admin_context(self, **kw):
     return get_admin_context(**kw)
Exemplo n.º 8
0
 def execute(self, parsed_args):
     context = get_admin_context()
     register_providers(context)