Example #1
0
def main():
    CONF(sys.argv[1:], project='oslo')
    logging.setup("oslo")

    with contextlib.closing(impl_zmq.ZmqProxy(CONF)) as reactor:
        reactor.consume_in_thread()
        reactor.wait()
Example #2
0
def create_main_app(global_config, **local_conf):
    """uWSGI factory method for the Barbican-API application"""

    # Configure oslo logging and configuration services.
    config.parse_args()
    log.setup('barbican')

    # Crypto Plugin Manager
    crypto_mgr = ext.CryptoExtensionManager()

    # Resources
    versions = res.VersionResource()
    secrets = res.SecretsResource(crypto_mgr)
    secret = res.SecretResource(crypto_mgr)
    orders = res.OrdersResource()
    order = res.OrderResource()

    wsgi_app = api = falcon.API()
    api.add_route('/', versions)
    api.add_route('/v1/{keystone_id}/secrets', secrets)
    api.add_route('/v1/{keystone_id}/secrets/{secret_id}', secret)
    api.add_route('/v1/{keystone_id}/orders', orders)
    api.add_route('/v1/{keystone_id}/orders/{order_id}', order)

    return wsgi_app
Example #3
0
def create_main_app(global_config, **local_conf):
    """uWSGI factory method for the Barbican-API application"""

    config.parse_args()
    log.setup('barbican')

    # Crypto Plugin Manager
    crypto_mgr = CryptoExtensionManager(
        'barbican.crypto.extension',
        ['simple_crypto']  # TODO: grab this list from cfg
    )

    # Resources
    VERSIONS = VersionResource()
    SECRETS = SecretsResource(crypto_mgr)
    SECRET = SecretResource(crypto_mgr)
    ORDERS = OrdersResource()
    ORDER = OrderResource()

    wsgi_app = api = falcon.API()
    api.add_route('/', VERSIONS)
    api.add_route('/v1/{tenant_id}/secrets', SECRETS)
    api.add_route('/v1/{tenant_id}/secrets/{secret_id}', SECRET)
    api.add_route('/v1/{tenant_id}/orders', ORDERS)
    api.add_route('/v1/{tenant_id}/orders/{order_id}', ORDER)

    return wsgi_app
Example #4
0
def create_main_app(global_config, **local_conf):
    """uWSGI factory method for the Barbican-API application"""

    # Configure oslo logging and configuration services.
    config.parse_args()
    log.setup('barbican')

    # Crypto Plugin Manager
    crypto_mgr = ext.CryptoExtensionManager()

    # Resources
    versions = res.VersionResource()
    secrets = res.SecretsResource(crypto_mgr)
    secret = res.SecretResource(crypto_mgr)
    orders = res.OrdersResource()
    order = res.OrderResource()

    wsgi_app = api = falcon.API()
    api.add_route('/', versions)
    api.add_route('/v1/{keystone_id}/secrets', secrets)
    api.add_route('/v1/{keystone_id}/secrets/{secret_id}', secret)
    api.add_route('/v1/{keystone_id}/orders', orders)
    api.add_route('/v1/{keystone_id}/orders/{order_id}', order)

    return wsgi_app
Example #5
0
def create_main_app(global_config, **local_conf):
    """uWSGI factory method for the Barbican-API application"""

    # Configure oslo logging and configuration services.
    config.parse_args()
    log.setup("barbican")

    # Crypto Plugin Manager
    crypto_mgr = ext.CryptoExtensionManager()

    # Resources
    versions = res.VersionResource()
    secrets = res.SecretsResource(crypto_mgr)
    secret = res.SecretResource(crypto_mgr)
    orders = res.OrdersResource()
    order = res.OrderResource()

    # For performance testing only
    performance = res.PerformanceResource()
    performance_uri = "mu-1a90dfd0-7e7abba4-4e459908-fc097d60"

    wsgi_app = api = falcon.API()
    api.add_route("/", versions)
    api.add_route("/v1/{keystone_id}/secrets", secrets)
    api.add_route("/v1/{keystone_id}/secrets/{secret_id}", secret)
    api.add_route("/v1/{keystone_id}/orders", orders)
    api.add_route("/v1/{keystone_id}/orders/{order_id}", order)

    # For performance testing only
    api.add_route("/{0}".format(performance_uri), performance)

    return wsgi_app
Example #6
0
def main():
    # Import and configure logging.
    log.setup('barbican-db-manage')
    LOG = log.getLogger(__name__)
    LOG.debug("Performing database schema migration...")

    dm = DatabaseManager()
    dm.execute()
Example #7
0
def main():
    # Import and configure logging.
    log.setup('barbican-db-manage')
    LOG = log.getLogger(__name__)
    LOG.debug("Performing database schema migration...")

    dm = DatabaseManager()
    dm.execute()
Example #8
0
def main():
    # Import and configure logging.
    log.setup('barbican-db-manage')
    LOG = log.getLogger(__name__)
    LOG.debug("Performing database schema migration...")

    try:
        dm = DatabaseManager()
        dm.execute()
    except:
        LOG.exception('Problem trying to execute Alembic commands')
Example #9
0
def create_main_app(global_config, **local_conf):
    """uWSGI factory method for the Barbican-API application"""

    # Configure oslo logging and configuration services.
    config.parse_args()
    log.setup('barbican')

    # Crypto Plugin Manager
    crypto_mgr = ext.CryptoExtensionManager()

    # Queuing initialization
    CONF = cfg.CONF
    queue.init(CONF)

    # Resources
    versions = res.VersionResource()
    secrets = res.SecretsResource(crypto_mgr)
    secret = res.SecretResource(crypto_mgr)
    orders = res.OrdersResource()
    order = res.OrderResource()
    verifications = res.VerificationsResource()
    verification = res.VerificationResource()
    containers = res.ContainersResource()
    container = res.ContainerResource()

    # For performance testing only
    performance = res.PerformanceResource()
    performance_uri = 'mu-1a90dfd0-7e7abba4-4e459908-fc097d60'

    wsgi_app = api = falcon.API()
    if newrelic_loaded:
        wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app)

    api.add_route('/', versions)
    api.add_route('/v1/{keystone_id}/secrets', secrets)
    api.add_route('/v1/{keystone_id}/secrets/{secret_id}', secret)
    api.add_route('/v1/{keystone_id}/orders', orders)
    api.add_route('/v1/{keystone_id}/orders/{order_id}', order)
    api.add_route('/v1/{keystone_id}/verifications', verifications)
    api.add_route('/v1/{keystone_id}/verifications/{verification_id}',
                  verification)
    api.add_route('/v1/{keystone_id}/containers/', containers)
    api.add_route('/v1/{keystone_id}/containers/{container_id}', container)

    # For performance testing only
    api.add_route('/{0}'.format(performance_uri), performance)

    return wsgi_app
Example #10
0
def create_main_app(global_config, **local_conf):
    """uWSGI factory method for the Barbican-API application"""

    config.parse_args()
    log.setup('barbican')

    # Resources
    VERSIONS = VersionResource()
    SECRETS = SecretsResource()
    SECRET = SecretResource()
    ORDERS = OrdersResource()
    ORDER = OrderResource()

    wsgi_app = api = falcon.API()
    api.add_route('/', VERSIONS)
    api.add_route('/v1/{tenant_id}/secrets', SECRETS)
    api.add_route('/v1/{tenant_id}/secrets/{secret_id}', SECRET)
    api.add_route('/v1/{tenant_id}/orders', ORDERS)
    api.add_route('/v1/{tenant_id}/orders/{order_id}', ORDER)

    return wsgi_app
Example #11
0
def create_main_app(global_config, **local_conf):
    """uWSGI factory method for the Barbican-API application."""

    # Configure oslo logging and configuration services.
    config.parse_args()
    log.setup('barbican')
    config.setup_remote_pydev_debug()

    # Queuing initialization
    CONF = cfg.CONF
    queue.init(CONF)

    class RootController(object):
        secrets = secrets.SecretsController()
        orders = orders.OrdersController()
        containers = containers.ContainersController()
        transport_keys = transportkeys.TransportKeysController()

    wsgi_app = PecanAPI(RootController(), force_canonical=False)
    if newrelic_loaded:
        wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app)
    return wsgi_app
Example #12
0
def create_main_app(global_config, **local_conf):
    """uWSGI factory method for the Barbican-API application."""

    # Configure oslo logging and configuration services.
    config.parse_args()
    log.setup('barbican')
    config.setup_remote_pydev_debug()

    # Queuing initialization
    CONF = cfg.CONF
    queue.init(CONF, is_server_side=False)

    class RootController(object):
        secrets = secrets.SecretsController()
        orders = orders.OrdersController()
        containers = containers.ContainersController()
        transport_keys = transportkeys.TransportKeysController()

    wsgi_app = PecanAPI(
        RootController(), is_transactional=True, force_canonical=False)
    if newrelic_loaded:
        wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app)
    return wsgi_app
from barbican import queue
from barbican.queue import keystone_listener
from oslo_config import cfg


def fail(returncode, e):
    sys.stderr.write("ERROR: {0}\n".format(e))
    sys.exit(returncode)


if __name__ == '__main__':
    try:
        config.parse_args()
        config.setup_remote_pydev_debug()
        # Import and configure logging.
        log.setup('barbican')

        LOG = log.getLogger(__name__)
        LOG.info("Booting up Barbican Keystone listener node...")

        # Queuing initialization
        CONF = cfg.CONF
        queue.init(CONF)

        if getattr(getattr(CONF, queue.KS_NOTIFICATIONS_GRP_NAME), 'enable'):
            service.launch(
                keystone_listener.MessageServer(CONF)
            ).wait()
        else:
            LOG.info("Exiting as Barbican Keystone listener is not enabled...")
    except RuntimeError as e: