def main(): try: config.setup_remote_pydev_debug() CONF = config.CONF CONF(sys.argv[1:], project='barbican', version=version.version_info.version_string) # Import and configure logging. log.setup(CONF, 'barbican') LOG = log.getLogger(__name__) LOG.info("Booting up Barbican Keystone listener node...") # Queuing initialization queue.init(CONF) if getattr(getattr(CONF, queue.KS_NOTIFICATIONS_GRP_NAME), 'enable'): service.launch( CONF, keystone_listener.MessageServer(CONF), restart_method='mutate' ).wait() else: LOG.info("Exiting as Barbican Keystone listener is not enabled...") except RuntimeError as e: fail(1, e)
def _wrapper(global_config, **local_conf): # Queuing initialization queue.init(CONF, is_server_side=False) # Configure oslo logging and configuration services. log.setup(CONF, 'barbican') LOG = log.getLogger(__name__) config.setup_remote_pydev_debug() # Initializing the database engine and session factory before the app # starts ensures we don't lose requests due to lazy initialization of # db connections. try: repositories.setup_database_engine_and_factory( initialize_secret_stores=True ) repositories.commit() except Exception: LOG.exception('Failed to sync secret_stores table.') repositories.rollback() raise wsgi_app = func(global_config, **local_conf) if newrelic_loaded: wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app) LOG.info('Barbican app created and initialized') return wsgi_app
def main(): try: config.setup_remote_pydev_debug() CONF = config.CONF CONF(sys.argv[1:], project='barbican', version=version.version_info.version_string) # Import and configure logging. log.setup(CONF, 'barbican') LOG = log.getLogger(__name__) LOG.info("Booting up Barbican Keystone listener node...") # Queuing initialization queue.init(CONF) if getattr(getattr(CONF, queue.KS_NOTIFICATIONS_GRP_NAME), 'enable'): service.launch( CONF, keystone_listener.MessageServer(CONF), restart_method='mutate' ).wait() else: LOG.info("Exiting as Barbican Keystone listener is not enabled...") except RuntimeError as e: fail(1, e)
def create_main_app(global_config, **local_conf): """uWSGI factory method for the Barbican-API application.""" # Queuing initialization queue.init(CONF, is_server_side=False) # Configure oslo logging and configuration services. log.setup(CONF, 'barbican') config.setup_remote_pydev_debug() # Initializing the database engine and session factory before the app # starts ensures we don't lose requests due to lazy initialiation of db # connections. repositories.setup_database_engine_and_factory() # Setup app with transactional hook enabled wsgi_app = build_wsgi_app(transactional=True) if newrelic_loaded: wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app) LOG = log.getLogger(__name__) LOG.info(u._LI('Barbican app created and initialized')) return wsgi_app
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() # Crypto Plugin Manager crypto_mgr = ext.CryptoExtensionManager() # Queuing initialization CONF = cfg.CONF queue.init(CONF) # Resources secrets = res.SecretsResource(crypto_mgr) secret = res.SecretResource(crypto_mgr) orders = res.OrdersResource() order = res.OrderResource() 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("/{keystone_id}/secrets", secrets) api.add_route("/{keystone_id}/secrets/{secret_id}", secret) api.add_route("/{keystone_id}/orders", orders) api.add_route("/{keystone_id}/orders/{order_id}", order) api.add_route("/{keystone_id}/containers/", containers) api.add_route("/{keystone_id}/containers/{container_id}", container) # For performance testing only api.add_route("/{0}".format(performance_uri), performance) return wsgi_app
def _wrapper(global_config, **local_conf): # Queuing initialization queue.init(CONF, is_server_side=False) # Configure oslo logging and configuration services. log.setup(CONF, 'barbican') config.setup_remote_pydev_debug() # Initializing the database engine and session factory before the app # starts ensures we don't lose requests due to lazy initialization of # db connections. repositories.setup_database_engine_and_factory() wsgi_app = func(global_config, **local_conf) if newrelic_loaded: wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app) LOG = log.getLogger(__name__) LOG.info(u._LI('Barbican app created and initialized')) return wsgi_app
def _wrapper(global_config, **local_conf): # Queuing initialization queue.init(CONF, is_server_side=False) # Configure oslo logging and configuration services. log.setup(CONF, 'barbican') config.setup_remote_pydev_debug() # Initializing the database engine and session factory before the app # starts ensures we don't lose requests due to lazy initialiation of db # connections. repositories.setup_database_engine_and_factory() wsgi_app = func(global_config, **local_conf) if newrelic_loaded: wsgi_app = newrelic.agent.WSGIApplicationWrapper(wsgi_app) LOG = log.getLogger(__name__) LOG.info(u._LI('Barbican app created and initialized')) return wsgi_app
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
def main(): try: config.setup_remote_pydev_debug() CONF = config.CONF # Import and configure logging. log.setup(CONF, 'barbican') LOG = log.getLogger(__name__) LOG.info(u._LI("Booting up Barbican Keystone listener node...")) # Queuing initialization queue.init(CONF) if getattr(getattr(CONF, queue.KS_NOTIFICATIONS_GRP_NAME), 'enable'): service.launch(CONF, keystone_listener.MessageServer(CONF)).wait() else: LOG.info( u._LI("Exiting as Barbican Keystone listener" " is not enabled...")) except RuntimeError as e: fail(1, e)
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.common import config from barbican import queue from barbican.queue import keystone_listener from oslo_log import log from oslo_service import service def fail(returncode, e): sys.stderr.write("ERROR: {0}\n".format(e)) sys.exit(returncode) if __name__ == '__main__': try: 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 = config.CONF queue.init(CONF) if getattr(getattr(CONF, queue.KS_NOTIFICATIONS_GRP_NAME), 'enable'): service.launch( CONF, keystone_listener.MessageServer(CONF) ).wait()
from barbican.openstack.common import log from barbican.openstack.common import service 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: