def main(): """Parse environment and arguments and call the appropriate action.""" config.parse_args(sys.argv, default_config_files=jsonutils.loads( os.environ['CONFIG_FILE'])) logging.setup(CONF, "patron") global LOG LOG = logging.getLogger('patron.dhcpbridge') objects.register_all() if not CONF.conductor.use_local: block_db_access() objects_base.NovaObject.indirection_api = \ conductor_rpcapi.ConductorAPI() if CONF.action.name in ['add', 'del', 'old']: LOG.debug( "Called '%(action)s' for mac '%(mac)s' with ip '%(ip)s'", { "action": CONF.action.name, "mac": CONF.action.mac, "ip": CONF.action.ip }) CONF.action.func(CONF.action.mac, CONF.action.ip) else: try: network_id = int(os.environ.get('NETWORK_ID')) except TypeError: LOG.error(_LE("Environment variable 'NETWORK_ID' must be set.")) return (1) print(init_leases(network_id)) rpc.cleanup()
def main(): """Parse environment and arguments and call the appropriate action.""" config.parse_args(sys.argv, default_config_files=jsonutils.loads(os.environ['CONFIG_FILE'])) logging.setup(CONF, "patron") global LOG LOG = logging.getLogger('patron.dhcpbridge') objects.register_all() if not CONF.conductor.use_local: block_db_access() objects_base.NovaObject.indirection_api = \ conductor_rpcapi.ConductorAPI() if CONF.action.name in ['add', 'del', 'old']: LOG.debug("Called '%(action)s' for mac '%(mac)s' with ip '%(ip)s'", {"action": CONF.action.name, "mac": CONF.action.mac, "ip": CONF.action.ip}) CONF.action.func(CONF.action.mac, CONF.action.ip) else: try: network_id = int(os.environ.get('NETWORK_ID')) except TypeError: LOG.error(_LE("Environment variable 'NETWORK_ID' must be set.")) return(1) print(init_leases(network_id)) rpc.cleanup()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) server = service.Service.create(binary='patron-consoleauth', topic=CONF.consoleauth_topic) service.serve(server) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) server = service.Service.create(binary="patron-scheduler", topic=CONF.scheduler_topic) service.serve(server) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) server = service.Service.create(binary='patron-scheduler', topic=CONF.scheduler_topic) service.serve(server) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) should_use_ssl = 'osapi_compute' in CONF.enabled_ssl_apis server = service.WSGIService('osapi_compute', use_ssl=should_use_ssl) service.serve(server, workers=server.workers) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) should_use_ssl = "osapi_compute" in CONF.enabled_ssl_apis server = service.WSGIService("osapi_compute", use_ssl=should_use_ssl) service.serve(server, workers=server.workers) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, 'patron') utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) server = service.Service.create(binary='patron-cells', topic=CONF.cells.topic, manager=CONF.cells.manager) service.serve(server) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) server = service.Service.create(binary='patron-conductor', topic=CONF.conductor.topic, manager=CONF.conductor.manager) workers = CONF.conductor.workers or processutils.get_worker_count() service.serve(server, workers=workers) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) server = service.Service.create(binary='patron-verify', topic=CONF.verify.topic, manager=CONF.verify.manager) workers = CONF.verify.workers or processutils.get_worker_count() service.serve(server, workers=workers) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) if not CONF.conductor.use_local: objects_base.NovaObject.indirection_api = \ conductor_rpcapi.ConductorAPI() should_use_ssl = 'metadata' in CONF.enabled_ssl_apis server = service.WSGIService('metadata', use_ssl=should_use_ssl) service.serve(server, workers=server.workers) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) if not CONF.conductor.use_local: block_db_access() objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI() server = service.Service.create( binary="patron-compute", topic=CONF.compute_topic, db_allowed=CONF.conductor.use_local ) service.serve(server) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") LOG = logging.getLogger('patron.all') utils.monkey_patch() objects.register_all() launcher = service.process_launcher() # patron-api for api in CONF.enabled_apis: try: should_use_ssl = api in CONF.enabled_ssl_apis server = service.WSGIService(api, use_ssl=should_use_ssl) launcher.launch_service(server, workers=server.workers or 1) except (Exception, SystemExit): LOG.exception(_LE('Failed to load %s-api'), api) for mod in [s3server, xvp_proxy]: try: launcher.launch_service(mod.get_wsgi_server()) except (Exception, SystemExit): LOG.exception(_LE('Failed to load %s'), mod.__name__) for binary in ['patron-compute', 'patron-network', 'patron-scheduler', 'patron-cert', 'patron-conductor']: # FIXME(sirp): Most service configs are defined in patron/service.py, but # conductor has set a new precedent of storing these configs # patron/<service>/api.py. # # We should update the existing services to use this new approach so we # don't have to treat conductor differently here. if binary == 'patron-conductor': topic = CONF.conductor.topic manager = CONF.conductor.manager else: topic = None manager = None try: launcher.launch_service(service.Service.create(binary=binary, topic=topic, manager=manager)) except (Exception, SystemExit): LOG.exception(_LE('Failed to load %s'), binary) launcher.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) if not CONF.conductor.use_local: block_db_access() objects_base.NovaObject.indirection_api = \ conductor_rpcapi.ConductorAPI() server = service.Service.create(binary='patron-network', topic=CONF.network_topic, db_allowed=CONF.conductor.use_local) service.serve(server) service.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") utils.monkey_patch() objects.register_all() gmr.TextGuruMeditation.setup_autorun(version) launcher = service.process_launcher() for api in CONF.enabled_apis: should_use_ssl = api in CONF.enabled_ssl_apis if api == 'ec2': server = service.WSGIService(api, use_ssl=should_use_ssl, max_url_len=16384) else: server = service.WSGIService(api, use_ssl=should_use_ssl) launcher.launch_service(server, workers=server.workers or 1) launcher.wait()
def main(): config.parse_args(sys.argv) logging.setup(CONF, "patron") LOG = logging.getLogger("patron.all") utils.monkey_patch() objects.register_all() launcher = service.process_launcher() # patron-api for api in CONF.enabled_apis: try: should_use_ssl = api in CONF.enabled_ssl_apis server = service.WSGIService(api, use_ssl=should_use_ssl) launcher.launch_service(server, workers=server.workers or 1) except (Exception, SystemExit): LOG.exception(_LE("Failed to load %s-api"), api) for mod in [s3server, xvp_proxy]: try: launcher.launch_service(mod.get_wsgi_server()) except (Exception, SystemExit): LOG.exception(_LE("Failed to load %s"), mod.__name__) for binary in ["patron-compute", "patron-network", "patron-scheduler", "patron-cert", "patron-conductor"]: # FIXME(sirp): Most service configs are defined in patron/service.py, but # conductor has set a new precedent of storing these configs # patron/<service>/api.py. # # We should update the existing services to use this new approach so we # don't have to treat conductor differently here. if binary == "patron-conductor": topic = CONF.conductor.topic manager = CONF.conductor.manager else: topic = None manager = None try: launcher.launch_service(service.Service.create(binary=binary, topic=topic, manager=manager)) except (Exception, SystemExit): LOG.exception(_LE("Failed to load %s"), binary) launcher.wait()
from patron.tests import fixtures as patron_fixtures from patron.tests.unit import conf_fixture from patron.tests.unit import policy_fixture from patron import utils CONF = cfg.CONF CONF.import_opt('enabled', 'patron.api.openstack', group='osapi_v3') logging.register_options(CONF) CONF.set_override('use_stderr', False) logging.setup(CONF, 'patron') # NOTE(comstud): Make sure we have all of the objects loaded. We do this # at module import time, because we may be using mock decorators in our # tests that run at import time. objects.register_all() _TRUE_VALUES = ('True', 'true', '1', 'yes') class SampleNetworks(fixtures.Fixture): """Create sample networks in the database.""" def __init__(self, host=None): self.host = host def setUp(self): super(SampleNetworks, self).setUp() ctxt = context.get_admin_context() network = network_manager.VlanManager(host=self.host) bridge_interface = CONF.flat_interface or CONF.vlan_interface network.create_networks(ctxt,
from patron.tests.unit import conf_fixture from patron.tests.unit import policy_fixture from patron import utils CONF = cfg.CONF CONF.import_opt('enabled', 'patron.api.openstack', group='osapi_v3') logging.register_options(CONF) CONF.set_override('use_stderr', False) logging.setup(CONF, 'patron') # NOTE(comstud): Make sure we have all of the objects loaded. We do this # at module import time, because we may be using mock decorators in our # tests that run at import time. objects.register_all() _TRUE_VALUES = ('True', 'true', '1', 'yes') class SampleNetworks(fixtures.Fixture): """Create sample networks in the database.""" def __init__(self, host=None): self.host = host def setUp(self): super(SampleNetworks, self).setUp() ctxt = context.get_admin_context() network = network_manager.VlanManager(host=self.host)