Пример #1
0
def setup_noauth_app(config, extra_hooks=None):

    app_hooks = [hooks.ConfigHook(),
                 hooks.DBHook(db.get_connection(CONF)),
                 hooks.ContextHook()]

    if extra_hooks:
        app_hooks.extend(extra_hooks)

    if not config:
        config = get_pecan_config()

    app = pecan.make_app(
        config.app.noauth_root,
        static_root=config.app.static_root,
        template_path=config.app.template_path,
        debug=False,
        force_canonical=getattr(config.app, 'force_canonical', True),
        hooks=app_hooks,
        wrap_app=middleware.FaultWrapperMiddleware,
    )

    pecan.conf.update({'wsme': {'debug': CONF.debug}})

    return app
Пример #2
0
from gringotts.openstack.common import log


LOG = log.getLogger(__name__)


OPTS = [
    cfg.StrOpt('keystone_control_exchange',
               default='keystone',
               help="Exchange name for Keystone notifications"),
]


cfg.CONF.register_opts(OPTS)

db_conn = db.get_connection(cfg.CONF)


class RegisterNotificationBase(waiter_plugin.NotificationBase):
    @staticmethod
    def get_exchange_topics(conf):
        """Return a sequence of ExchangeTopics defining the exchange and
        topics to be connected for this plugin.
        """
        return [
            plugin.ExchangeTopics(
                exchange=conf.keystone_control_exchange,
                topics=set(topic + ".info"
                           for topic in conf.notification_topics)),
        ]
Пример #3
0
from gringotts import services
from gringotts.services import keystone as ks_client

from gringotts.openstack.common import log

LOG = log.getLogger(__name__)

OPTS = [
    cfg.StrOpt('keystone_control_exchange',
               default='keystone',
               help="Exchange name for Keystone notifications"),
]

cfg.CONF.register_opts(OPTS)

db_conn = db.get_connection(cfg.CONF)


class RegisterNotificationBase(waiter_plugin.NotificationBase):
    @staticmethod
    def get_exchange_topics(conf):
        """Return a sequence of ExchangeTopics defining the exchange and
        topics to be connected for this plugin.
        """
        return [
            plugin.ExchangeTopics(exchange=conf.keystone_control_exchange,
                                  topics=set(
                                      topic + ".info"
                                      for topic in conf.notification_topics)),
        ]