def main(): logging.register_options(cfg.CONF) cfg.CONF(project='heat', prog='heat-engine', version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-engine') logging.set_defaults() messaging.setup() config.startup_sanity_check() mgr = None try: mgr = template._get_template_extension_manager() except template.TemplatePluginNotRegistered as ex: LOG.critical(_LC("%s"), ex) if not mgr or not mgr.names(): sys.exit("ERROR: No template format plugins registered") from heat.engine import service as engine # noqa profiler.setup('heat-engine', cfg.CONF.host) gmr.TextGuruMeditation.setup_autorun(version) srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC) workers = cfg.CONF.num_engine_workers if not workers: workers = max(4, processutils.get_worker_count()) launcher = service.launch(cfg.CONF, srv, workers=workers) if cfg.CONF.enable_cloud_watch_lite: # We create the periodic tasks here, which mean they are created # only in the parent process when num_engine_workers>1 is specified srv.create_periodic_tasks() launcher.wait()
def init_application(): i18n.enable_lazy() # NOTE(hberaud): Call reset to ensure the ConfigOpts object doesn't # already contain registered options if the app is reloaded. CONF.reset() logging.register_options(CONF) CONF(project='heat', prog='heat-api-cfn', version=version.version_info.version_string()) logging.setup(CONF, CONF.prog) logging.set_defaults() LOG = logging.getLogger(CONF.prog) config.set_config_defaults() messaging.setup() port = CONF.heat_api_cfn.bind_port host = CONF.heat_api_cfn.bind_host LOG.info('Starting Heat API on %(host)s:%(port)s', { 'host': host, 'port': port }) profiler.setup(CONF.prog, host) return config.load_paste_app()
def launch_api(setup_logging=True): if setup_logging: logging.register_options(CONF) CONF(project='heat', prog='heat-api', version=version.version_info.version_string()) if setup_logging: logging.setup(CONF, CONF.prog) LOG = logging.getLogger(CONF.prog) config.set_config_defaults() messaging.setup() app = config.load_paste_app() port = CONF.heat_api.bind_port host = CONF.heat_api.bind_host LOG.info('Starting Heat REST API on %(host)s:%(port)s', { 'host': host, 'port': port }) profiler.setup(CONF.prog, host) gmr.TextGuruMeditation.setup_autorun(version) server = wsgi.Server(CONF.prog, CONF.heat_api) server.start(app, default_port=port) return server
def main(): try: logging.register_options(cfg.CONF) cfg.CONF(project='heat', prog='heat-api-cloudwatch', version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-api-cloudwatch') logging.set_defaults() messaging.setup() app = config.load_paste_app() port = cfg.CONF.heat_api_cloudwatch.bind_port host = cfg.CONF.heat_api_cloudwatch.bind_host LOG.info(_LI('Starting Heat CloudWatch API on %(host)s:%(port)s'), {'host': host, 'port': port}) profiler.setup('heat-api-cloudwatch', host) gmr.TextGuruMeditation.setup_autorun(version) server = wsgi.Server('heat-api-cloudwatch', cfg.CONF.heat_api_cloudwatch) server.start(app, default_port=port) systemd.notify_once() server.wait() except RuntimeError as e: msg = six.text_type(e) sys.exit("ERROR: %s" % msg)
def launch_engine(setup_logging=True): if setup_logging: logging.register_options(cfg.CONF) cfg.CONF(project='heat', prog='heat-engine', version=version.version_info.version_string()) if setup_logging: logging.setup(cfg.CONF, 'heat-engine') logging.set_defaults() messaging.setup() config.startup_sanity_check() mgr = None try: mgr = template._get_template_extension_manager() except template.TemplatePluginNotRegistered as ex: LOG.critical("%s", ex) if not mgr or not mgr.names(): sys.exit("ERROR: No template format plugins registered") from heat.engine import service as engine # noqa profiler.setup('heat-engine', cfg.CONF.host) gmr.TextGuruMeditation.setup_autorun(version) srv = engine.EngineService(cfg.CONF.host, rpc_api.ENGINE_TOPIC) workers = cfg.CONF.num_engine_workers if not workers: workers = max(4, processutils.get_worker_count()) launcher = service.launch(cfg.CONF, srv, workers=workers, restart_method='mutate') return launcher
def launch_cfn_api(setup_logging=True): if setup_logging: logging.register_options(cfg.CONF) cfg.CONF(project='heat', prog='heat-api-cfn', version=version.version_info.version_string()) if setup_logging: logging.setup(cfg.CONF, 'heat-api-cfn') logging.set_defaults() config.set_config_defaults() messaging.setup() app = config.load_paste_app() port = cfg.CONF.heat_api_cfn.bind_port host = cfg.CONF.heat_api_cfn.bind_host LOG.info('Starting Heat API on %(host)s:%(port)s', { 'host': host, 'port': port }) profiler.setup('heat-api-cfn', host) gmr.TextGuruMeditation.setup_autorun(version) server = wsgi.Server('heat-api-cfn', cfg.CONF.heat_api_cfn) server.start(app, default_port=port) return server
def main(): try: logging.register_options(cfg.CONF) cfg.CONF(project='heat', prog='heat-api', version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-api') messaging.setup() app = config.load_paste_app() port = cfg.CONF.heat_api.bind_port host = cfg.CONF.heat_api.bind_host LOG.info(_LI('Starting Heat REST API on %(host)s:%(port)s'), { 'host': host, 'port': port }) profiler.setup('heat-api', host) gmr.TextGuruMeditation.setup_autorun(version) server = wsgi.Server('heat-api', cfg.CONF.heat_api) server.start(app, default_port=port) systemd.notify_once() server.wait() except RuntimeError as e: msg = six.text_type(e) sys.exit("ERROR: %s" % msg)
def setUp(self): super(HeatTestCase, self).setUp() self.m = mox.Mox() self.addCleanup(self.m.UnsetStubs) self.setup_logging() scheduler.ENABLE_SLEEP = False self.useFixture(fixtures.MonkeyPatch("heat.common.exception._FATAL_EXCEPTION_FORMAT_ERRORS", True)) def enable_sleep(): scheduler.ENABLE_SLEEP = True self.addCleanup(enable_sleep) mod_dir = os.path.dirname(sys.modules[__name__].__file__) project_dir = os.path.abspath(os.path.join(mod_dir, "../../")) env_dir = os.path.join(project_dir, "etc", "heat", "environment.d") cfg.CONF.set_default("environment_dir", env_dir) self.addCleanup(cfg.CONF.reset) messaging.setup("fake://", optional=True) self.addCleanup(messaging.cleanup) tri = resources.global_env().get_resource_info( "AWS::RDS::DBInstance", registry_type=environment.TemplateResourceInfo ) if tri is not None: cur_path = tri.template_name templ_path = os.path.join(project_dir, "etc", "heat", "templates") if templ_path not in cur_path: tri.template_name = cur_path.replace("/etc/heat/templates", templ_path) utils.setup_dummy_db() self.addCleanup(utils.reset_dummy_db)
def setUp(self): messaging.setup("fake://", optional=True) self.addCleanup(messaging.cleanup) self.context = utils.dummy_context() self.stubs = stubout.StubOutForTesting() self.identity = dict( identifier.HeatIdentifier('engine_test_tenant', '6', 'wordpress')) super(EngineRpcAPITestCase, self).setUp()
def setUp(self): messaging.setup("fake://", optional=True) self.addCleanup(messaging.cleanup) self.context = utils.dummy_context() self.stubs = stubout.StubOutForTesting() self.identity = dict(identifier.HeatIdentifier("engine_test_tenant", "6", "wordpress")) self.rpcapi = rpc_client.EngineClient() super(EngineRpcAPITestCase, self).setUp()
def setUp(self, mock_keystone=True, mock_resource_policy=True, quieten_logging=True): super(HeatTestCase, self).setUp() self.m = mox.Mox() self.addCleanup(self.m.UnsetStubs) self.setup_logging(quieten=quieten_logging) self.warnings = self.useFixture(fixtures.WarningsCapture()) scheduler.ENABLE_SLEEP = False self.useFixture(fixtures.MonkeyPatch( 'heat.common.exception._FATAL_EXCEPTION_FORMAT_ERRORS', True)) def enable_sleep(): scheduler.ENABLE_SLEEP = True self.addCleanup(enable_sleep) mod_dir = os.path.dirname(sys.modules[__name__].__file__) project_dir = os.path.abspath(os.path.join(mod_dir, '../../')) env_dir = os.path.join(project_dir, 'etc', 'heat', 'environment.d') template_dir = os.path.join(project_dir, 'etc', 'heat', 'templates') cfg.CONF.set_default('environment_dir', env_dir) cfg.CONF.set_override('error_wait_time', None, enforce_type=True) cfg.CONF.set_default('template_dir', template_dir) self.addCleanup(cfg.CONF.reset) messaging.setup("fake://", optional=True) self.addCleanup(messaging.cleanup) tri_names = ['AWS::RDS::DBInstance', 'AWS::CloudWatch::Alarm'] tris = [] for name in tri_names: tris.append(resources.global_env().get_resource_info( name, registry_type=environment.TemplateResourceInfo)) for tri in tris: if tri is not None: cur_path = tri.template_name templ_path = os.path.join(project_dir, 'etc', 'heat', 'templates') if templ_path not in cur_path: tri.template_name = cur_path.replace( '/etc/heat/templates', templ_path) if mock_keystone: self.stub_keystoneclient() if mock_resource_policy: self.mock_resource_policy = self.patchobject( policy.ResourceEnforcer, 'enforce') utils.setup_dummy_db() self.register_test_resources() self.addCleanup(utils.reset_dummy_db)
def launch_all(setup_logging=True): if setup_logging: logging.register_options(cfg.CONF) cfg.CONF(project='heat', prog='heat-all', version=version.version_info.version_string()) if setup_logging: logging.setup(cfg.CONF, 'heat-all') config.set_config_defaults() messaging.setup() return _start_service_threads(set(cfg.CONF.heat_all.enabled_services))
def do_migrate(): messaging.setup() client = rpc_client.EngineClient() ctxt = context.get_admin_context() try: client.migrate_convergence_1(ctxt, CONF.command.stack_id) except exception.NotFound: raise Exception( _("Stack with id %s can not be found.") % CONF.command.stack_id) except (exception.NotSupported, exception.ActionNotComplete) as ex: raise Exception(ex.message)
def do_migrate(): messaging.setup() client = rpc_client.EngineClient() ctxt = context.get_admin_context() try: client.migrate_convergence_1(ctxt, CONF.command.stack_id) except exception.NotFound: raise Exception(_("Stack with id %s can not be found.") % CONF.command.stack_id) except exception.ActionInProgress: raise Exception(_("The stack or some of its nested stacks are " "in progress. Note, that all the stacks should be " "in COMPLETE state in order to be migrated."))
def setUp(self): super(HeatTestCase, self).setUp() self.m = mox.Mox() self.addCleanup(self.m.UnsetStubs) self.setup_logging() scheduler.ENABLE_SLEEP = False self.useFixture(fixtures.MonkeyPatch( 'heat.common.exception._FATAL_EXCEPTION_FORMAT_ERRORS', True)) def enable_sleep(): scheduler.ENABLE_SLEEP = True self.addCleanup(enable_sleep) mod_dir = os.path.dirname(sys.modules[__name__].__file__) project_dir = os.path.abspath(os.path.join(mod_dir, '../../')) env_dir = os.path.join(project_dir, 'etc', 'heat', 'environment.d') cfg.CONF.set_default('environment_dir', env_dir) self.addCleanup(cfg.CONF.reset) messaging.setup("fake://", optional=True) self.addCleanup(messaging.cleanup) tri = resources.global_env().get_resource_info( 'AWS::RDS::DBInstance', registry_type=environment.TemplateResourceInfo) if tri is not None: cur_path = tri.template_name templ_path = os.path.join(project_dir, 'etc', 'heat', 'templates') if templ_path not in cur_path: tri.template_name = cur_path.replace('/etc/heat/templates', templ_path) # use CWLiteAlarm for testing. resources.global_env().registry.load( {"AWS::CloudWatch::Alarm": "OS::Heat::CWLiteAlarm"}) utils.setup_dummy_db() self.addCleanup(utils.reset_dummy_db) cached_wait_time = stack.ERROR_WAIT_TIME stack.ERROR_WAIT_TIME = None def replace_wait_time(): stack.ERROR_WAIT_TIME = cached_wait_time self.addCleanup(replace_wait_time)
def do_migrate(): messaging.setup() client = rpc_client.EngineClient() ctxt = context.get_admin_context() try: client.migrate_convergence_1(ctxt, CONF.command.stack_id) except exception.NotFound: raise Exception( _("Stack with id %s can not be found.") % CONF.command.stack_id) except exception.ActionInProgress: raise Exception( _("The stack or some of its nested stacks are " "in progress. Note, that all the stacks should be " "in COMPLETE state in order to be migrated."))
def setUp(self): super(HeatTestCase, self).setUp() self.m = mox.Mox() self.addCleanup(self.m.UnsetStubs) self.setup_logging() scheduler.ENABLE_SLEEP = False self.useFixture( fixtures.MonkeyPatch( 'heat.common.exception._FATAL_EXCEPTION_FORMAT_ERRORS', True)) def enable_sleep(): scheduler.ENABLE_SLEEP = True self.addCleanup(enable_sleep) mod_dir = os.path.dirname(sys.modules[__name__].__file__) project_dir = os.path.abspath(os.path.join(mod_dir, '../../')) env_dir = os.path.join(project_dir, 'etc', 'heat', 'environment.d') cfg.CONF.set_default('environment_dir', env_dir) self.addCleanup(cfg.CONF.reset) messaging.setup("fake://", optional=True) self.addCleanup(messaging.cleanup) tri = resources.global_env().get_resource_info( 'AWS::RDS::DBInstance', registry_type=environment.TemplateResourceInfo) if tri is not None: cur_path = tri.template_name templ_path = os.path.join(project_dir, 'etc', 'heat', 'templates') if templ_path not in cur_path: tri.template_name = cur_path.replace('/etc/heat/templates', templ_path) # use CWLiteAlarm for testing. resources.global_env().registry.load( {"AWS::CloudWatch::Alarm": "OS::Heat::CWLiteAlarm"}) utils.setup_dummy_db() self.addCleanup(utils.reset_dummy_db) cached_wait_time = stack.ERROR_WAIT_TIME stack.ERROR_WAIT_TIME = None def replace_wait_time(): stack.ERROR_WAIT_TIME = cached_wait_time self.addCleanup(replace_wait_time)
def init_application(): i18n.enable_lazy() LOG = logging.getLogger('heat.api') logging.register_options(cfg.CONF) version = hversion.version_info.version_string() cfg.CONF(project='heat', prog='heat-api', version=version) logging.setup(cfg.CONF, 'heat-api') messaging.setup() port = cfg.CONF.heat_api.bind_port host = cfg.CONF.heat_api.bind_host profiler.setup('heat-api', host) LOG.info(_LI('Starting Heat REST API on %(host)s:%(port)s'), {'host': host, 'port': port}) return config.load_paste_app()
def init_application(): i18n.enable_lazy() LOG = logging.getLogger('heat.api') logging.register_options(cfg.CONF) version = hversion.version_info.version_string() cfg.CONF(project='heat', prog='heat-api', version=version) logging.setup(cfg.CONF, 'heat-api') config.set_config_defaults() messaging.setup() port = cfg.CONF.heat_api.bind_port host = cfg.CONF.heat_api.bind_host profiler.setup('heat-api', host) LOG.info(_LI('Starting Heat REST API on %(host)s:%(port)s'), {'host': host, 'port': port}) return config.load_paste_app()
def init_application(): i18n.enable_lazy() LOG = logging.getLogger('heat.api.cloudwatch') logging.register_options(cfg.CONF) cfg.CONF(project='heat', prog='heat-api-cloudwatch', version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-api-cloudwatch') logging.set_defaults() messaging.setup() port = cfg.CONF.heat_api_cloudwatch.bind_port host = cfg.CONF.heat_api_cloudwatch.bind_host LOG.info(_LI('Starting Heat CloudWatch API on %(host)s:%(port)s'), {'host': host, 'port': port}) profiler.setup('heat-api-cloudwatch', host) return config.load_paste_app()
def init_application(): i18n.enable_lazy() logging.register_options(CONF) CONF(project='heat', prog='heat-api-cfn', version=version.version_info.version_string()) logging.setup(CONF, CONF.prog) logging.set_defaults() LOG = logging.getLogger(CONF.prog) config.set_config_defaults() messaging.setup() port = CONF.heat_api_cfn.bind_port host = CONF.heat_api_cfn.bind_host LOG.info('Starting Heat API on %(host)s:%(port)s', {'host': host, 'port': port}) profiler.setup(CONF.prog, host) return config.load_paste_app()
def launch_api(setup_logging=True): if setup_logging: logging.register_options(cfg.CONF) cfg.CONF(project='heat', prog='heat-api', version=version.version_info.version_string()) if setup_logging: logging.setup(cfg.CONF, 'heat-api') config.set_config_defaults() messaging.setup() app = config.load_paste_app() port = cfg.CONF.heat_api.bind_port host = cfg.CONF.heat_api.bind_host LOG.info(_LI('Starting Heat REST API on %(host)s:%(port)s'), {'host': host, 'port': port}) profiler.setup('heat-api', host) gmr.TextGuruMeditation.setup_autorun(version) server = wsgi.Server('heat-api', cfg.CONF.heat_api) server.start(app, default_port=port) return server
def main(): try: logging.register_options(cfg.CONF) cfg.CONF(project="heat", prog="heat-api", version=version.version_info.version_string()) logging.setup(cfg.CONF, "heat-api") config.set_config_defaults() messaging.setup() app = config.load_paste_app() port = cfg.CONF.heat_api.bind_port host = cfg.CONF.heat_api.bind_host LOG.info(_LI("Starting Heat REST API on %(host)s:%(port)s"), {"host": host, "port": port}) profiler.setup("heat-api", host) gmr.TextGuruMeditation.setup_autorun(version) server = wsgi.Server("heat-api", cfg.CONF.heat_api) server.start(app, default_port=port) systemd.notify_once() server.wait() except RuntimeError as e: msg = six.text_type(e) sys.exit("ERROR: %s" % msg)
def init_application(): i18n.enable_lazy() LOG = logging.getLogger('heat.api.cloudwatch') logging.register_options(cfg.CONF) cfg.CONF(project='heat', prog='heat-api-cloudwatch', version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-api-cloudwatch') logging.set_defaults() config.set_config_defaults() messaging.setup() port = cfg.CONF.heat_api_cloudwatch.bind_port host = cfg.CONF.heat_api_cloudwatch.bind_host LOG.info('Starting Heat CloudWatch API on %(host)s:%(port)s', { 'host': host, 'port': port }) profiler.setup('heat-api-cloudwatch', host) return config.load_paste_app()
import oslo_i18n as i18n from oslo_log import log as logging from heat.common import config from heat.common.i18n import _LI from heat.common import messaging from heat.common import profiler from heat import version i18n.enable_lazy() LOG = logging.getLogger('heat.api.cloudwatch') logging.register_options(cfg.CONF) cfg.CONF(project='heat', prog='heat-api-cloudwatch', version=version.version_info.version_string()) logging.setup(cfg.CONF, 'heat-api-cloudwatch') logging.set_defaults() messaging.setup() port = cfg.CONF.heat_api_cloudwatch.bind_port host = cfg.CONF.heat_api_cloudwatch.bind_host LOG.info(_LI('Starting Heat CloudWatch API on %(host)s:%(port)s'), { 'host': host, 'port': port }) profiler.setup('heat-api-cloudwatch', host) application = config.load_paste_app()
""" from oslo_config import cfg import oslo_i18n as i18n from oslo_log import log as logging from heat.common import config from heat.common.i18n import _LI from heat.common import messaging from heat.common import profiler from heat import version i18n.enable_lazy() LOG = logging.getLogger('heat.api') logging.register_options(cfg.CONF) version = version.version_info.version_string() cfg.CONF(project='heat', prog='heat-api', version=version) logging.setup(cfg.CONF, 'heat-api') messaging.setup() port = cfg.CONF.heat_api.bind_port host = cfg.CONF.heat_api.bind_host LOG.info(_LI('Starting Heat REST API on %(host)s:%(port)s'), {'host': host, 'port': port}) profiler.setup('heat-api', host) application = config.load_paste_app()