def main(): # NOTE(jaosorior): This is needed in order for db-sync to also register the # keystonemiddleware options. Those options are used by clients that need a # keystone session in order to be able to register their actions. # This can be removed when mistral moves out of using keystonemiddleware in # favor of keystoneauth1. for group, opts in keystonemw_opts.list_auth_token_opts(): CONF.register_opts(opts, group=group) CONF.register_cli_opt(config.os_actions_mapping_path) logging.register_options(CONF) config.parse_args() if len(CONF.config_file) == 0: print("Usage: sync_db --config-file <path-to-config-file>") return exit(1) logging.setup(CONF, 'Mistral') LOG.info("Starting db_sync") LOG.debug("Setting up db") db_api.setup_db() LOG.debug("populating db") action_manager.sync_db() workflows.sync_db()
def test_original_list_all_options(self): result_of_old_opts = old_opts.list_auth_token_opts() self.assertThat(result_of_old_opts, matchers.HasLength(1)) for group in (g for (g, _l) in result_of_old_opts): self.assertEqual('keystone_authtoken', group) # This is the original list that includes deprecated options expected_opt_names = [ 'auth_admin_prefix', 'auth_host', 'auth_port', 'auth_protocol', 'www_authenticate_uri', 'auth_uri', 'identity_uri', 'auth_version', 'delay_auth_decision', 'http_connect_timeout', 'http_request_max_retries', 'admin_token', 'admin_user', 'admin_password', 'admin_tenant_name', 'cache', 'certfile', 'keyfile', 'cafile', 'region_name', 'insecure', 'signing_dir', 'memcached_servers', 'token_cache_time', 'revocation_cache_time', 'memcache_security_strategy', 'memcache_secret_key', 'memcache_use_advanced_pool', 'memcache_pool_dead_retry', 'memcache_pool_maxsize', 'memcache_pool_unused_timeout', 'memcache_pool_conn_get_timeout', 'memcache_pool_socket_timeout', 'include_service_catalog', 'enforce_token_bind', 'check_revocations_for_cached', 'hash_algorithms', 'auth_type', 'auth_section', 'service_token_roles', 'service_token_roles_required', ] opt_names = [o.name for (g, l) in result_of_old_opts for o in l] self.assertThat(opt_names, matchers.HasLength(len(expected_opt_names))) for opt in opt_names: self.assertIn(opt, expected_opt_names)
def _register_opts(cls, conf): """Register keystonemiddleware options.""" options = [] keystone_opts = opts.list_auth_token_opts() for n in keystone_opts: if (n[0] == cls.OPT_GROUP_NAME): options = n[1] break if cls.OPT_GROUP_NAME not in conf: conf.register_opts(options, group=cls.OPT_GROUP_NAME) auth_token.CONF = conf
def prepare_service(args=None): conf = cfg.ConfigOpts() # FIXME(jd) Use the pkg_entry info to register the options of these libs log.register_options(conf) db_options.set_defaults(conf) for group, options in ks_opts.list_auth_token_opts(): conf.register_opts(list(options), group=group) policy_opts.set_defaults(conf) # Register our own Gnocchi options for group, options in opts.list_opts(): conf.register_opts(list(options), group=None if group == "DEFAULT" else group) # HACK(jd) I'm not happy about that, fix AP class to handle a conf object? archive_policy.ArchivePolicy.DEFAULT_AGGREGATION_METHODS = ( conf.archive_policy.default_aggregation_methods ) try: default_workers = multiprocessing.cpu_count() or 1 except NotImplementedError: default_workers = 1 conf.set_default("workers", default_workers, group="api") conf(args, project='gnocchi', validate_default_values=True) log.setup(conf, 'gnocchi') conf.log_opt_values(LOG, logging.DEBUG) # NOTE(sileht): keystonemiddleware assume we use the global CONF object # (LP#1428317). In gnocchi, this is not the case, so we have to register # some keystoneclient options ourself. Missing options are hidden into # private area of keystonemiddleware and keystoneclient, so we # create a keystoneclient AuthPlugin object, that will register the options # into our configuration object. This have to be done after the # configuration files have been loaded because the authplugin options # depends of the authplugin present in the configuration file. keystoneclient.auth.register_conf_options(conf, 'keystone_authtoken') keystoneclient.auth.load_from_conf_options(conf, 'keystone_authtoken') return conf
def prepare_service(argv=None): conf = cfg.ConfigOpts() oslo_i18n.enable_lazy() log.register_options(conf) log_levels = (conf.default_log_levels + ['stevedore=INFO', 'keystoneclient=INFO']) log.set_defaults(default_log_levels=log_levels) db_options.set_defaults(conf) policy_opts.set_defaults(conf) for group, options in ks_opts.list_auth_token_opts(): conf.register_opts(list(options), group=group) from aodh import opts # Register our own Aodh options for group, options in opts.list_opts(): conf.register_opts(list(options), group=None if group == "DEFAULT" else group) conf(argv, project='aodh', validate_default_values=True) log.setup(conf, 'aodh') messaging.setup() return conf
limitations under the License. """ import os from keystonemiddleware import opts from oslo_config import cfg from oslo_log import log from oslo_policy import policy from freezer_api import __version__ as FREEZER_API_VERSION from freezer_api.storage import driver CONF = cfg.CONF AUTH_GROUP, AUTH_OPTS = opts.list_auth_token_opts()[0] paste_deploy = [ cfg.StrOpt('config_file', default='freezer-paste.ini', help='Name of the paste configuration file that defines ' 'the available pipelines.'), ] def api_common_opts(): _COMMON = [ cfg.IPOpt('bind-host', default='0.0.0.0', dest='bind_host', help='IP address to listen on. Default is 0.0.0.0'),
def test_list_auth_token_opts(self): self._test_list_auth_token_opts(opts.list_auth_token_opts())