Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
common_config.register_core_common_config_opts()
# Ensure that the control exchange is set correctly
oslo_messaging.set_transport_defaults(control_exchange='neutron')
NOVA_CONF_SECTION = 'nova'
ks_loading.register_auth_conf_options(cfg.CONF, NOVA_CONF_SECTION)
ks_loading.register_session_conf_options(cfg.CONF, NOVA_CONF_SECTION)
# Register the nova configuration options
common_config.register_nova_opts()
ks_loading.register_auth_conf_options(cfg.CONF,
common_config.PLACEMENT_CONF_SECTION)
ks_loading.register_session_conf_options(cfg.CONF,
common_config.PLACEMENT_CONF_SECTION)
# Register the placement configuration options
common_config.register_placement_opts()
logging.register_options(cfg.CONF)
# Register the ironic configuration options
ks_loading.register_auth_conf_options(cfg.CONF,
common_config.IRONIC_CONF_SECTION)
ks_loading.register_session_conf_options(cfg.CONF,
common_config.IRONIC_CONF_SECTION)
common_config.register_ironic_opts()
default_config_files = [conf['oslo_config_file']]
else:
default_config_files = None
# For unit tests, support passing in a ConfigOpts in
# oslo_config_config.
self._local_oslo_config = conf.get('oslo_config_config',
cfg.ConfigOpts())
self._local_oslo_config(
{}, project=conf['oslo_config_project'],
default_config_files=default_config_files,
validate_default_values=True)
self._local_oslo_config.register_opts(
_OPTS, group=_base.AUTHTOKEN_GROUP)
loading.register_auth_conf_options(self._local_oslo_config,
group=_base.AUTHTOKEN_GROUP)
super(AuthProtocol, self).__init__(
app,
log=log,
enforce_token_bind=self._conf_get('enforce_token_bind'))
# delay_auth_decision means we still allow unauthenticated requests
# through and we let the downstream service make the final decision
self._delay_auth_decision = self._conf_get('delay_auth_decision')
self._include_service_catalog = self._conf_get(
'include_service_catalog')
self._hash_algorithms = self._conf_get('hash_algorithms')
self._identity_server = self._create_identity_server()
def add_auth_opts():
opts = ks_loading.register_session_conf_options(
cfg.CONF, constants.SERVICE_AUTH)
opt_list = copy.deepcopy(opts)
opt_list.insert(0, ks_loading.get_auth_common_conf_options()[0])
# NOTE(mhickey): There are a lot of auth plugins, we just generate
# the config options for a few common ones
plugins = ['password', 'v2password', 'v3password']
for name in plugins:
for plugin_option in ks_loading.get_auth_plugin_conf_options(name):
if all(option.name != plugin_option.name for option in opt_list):
opt_list.append(plugin_option)
opt_list.sort(key=operator.attrgetter('name'))
return (constants.SERVICE_AUTH, opt_list)
def _append_global_identity_args(self, parser):
loading.register_session_argparse_arguments(parser)
# Use "password" auth plugin as default and keep the explicit
# "--os-token" arguments below for backward compatibility.
default_auth_plugin = 'password'
# Passing [] to loading.register_auth_argparse_arguments to avoid
# the auth_type being overridden by the command line.
loading.register_auth_argparse_arguments(
parser, [], default=default_auth_plugin)
parser.add_argument(
'--os-auth-strategy', metavar='',
default=utils.env('OS_AUTH_STRATEGY', default='keystone'),
help=_('Authentication strategy (Env: OS_AUTH_STRATEGY'
', default keystone). For now, any other value will'
' disable the authentication.'))
parser.add_argument(
'--os_auth_strategy',
help=argparse.SUPPRESS)
# Change os_auth_type default value defined by
# register_auth_argparse_arguments to be backward compatible
# with OS_AUTH_SYSTEM.
env_plugin = utils.env('OS_AUTH_TYPE',
CONF.register_opts(murano_opts, group='murano')
CONF.register_opts(engine_opts, group='engine')
CONF.register_opts(file_server)
CONF.register_opt(home_region)
CONF.register_cli_opts(metadata_dir)
CONF.register_opts(stats_opts, group='stats')
CONF.register_opts(networking_opts, group='networking')
CONF.register_opts(glare_opts, group='glare')
CONF.register_opts(glance_opts, group='glance')
CONF.register_opts(murano_auth_opts, group='murano_auth')
ks_loading.register_auth_conf_options(CONF, group='murano_auth')
for group in ('heat', 'mistral', 'neutron', 'glance', 'glare',
'murano', 'murano_auth'):
ks_loading.register_session_conf_options(
CONF,
group=group,
deprecated_opts={
'cafile': [cfg.DeprecatedOpt('cacert', group),
cfg.DeprecatedOpt('ca_file', group)],
'certfile': [cfg.DeprecatedOpt('cert_file', group)],
'keyfile': [cfg.DeprecatedOpt('key_file', group)]
})
def parse_args(args=None, usage=None, default_config_files=None):
logging.register_options(CONF)
CONF(args=args,
project='murano',
version=version.version_string,
'api_interface',
default='internalURL',
help='(v2) Endpoint URL type (for keystone auth only)',
),
cfg.IntOpt(
'measure_chunk_size',
min=10, max=1000000,
default=500,
help='(v2) Maximum amount of measures to send to gnocchi at once '
'(defaults to 500).',
),
]
CONF.register_opts(gnocchi_storage_opts, 'storage_gnocchi')
ks_loading.register_session_conf_options(CONF, 'storage_gnocchi')
ks_loading.register_auth_conf_options(CONF, 'storage_gnocchi')
RESOURCE_TYPE_NAME_ROOT = 'cloudkitty_metric_'
ARCHIVE_POLICY_NAME = 'cloudkitty_archive_policy'
GROUPBY_NAME_ROOT = 'groupby_attr_'
META_NAME_ROOT = 'meta_attr_'
class GnocchiResource(object):
"""Class representing a gnocchi resource
It provides utils for resource_type/resource creation and identifying.
"""
def _append_global_identity_args(self, parser, argv):
# Register CLI identity related arguments
# Use keystoneauth to register common CLI arguments
loading.register_session_argparse_arguments(parser)
default_auth_plugin = 'password'
if 'os-token' in argv:
default_auth_plugin = 'token'
loading.register_auth_argparse_arguments(parser, argv,
default=default_auth_plugin)
parser.set_defaults(insecure=utils.env('TROVECLIENT_INSECURE',
default=False))
parser.set_defaults(os_auth_url=utils.env('OS_AUTH_URL'))
parser.set_defaults(os_project_name=utils.env(
'OS_PROJECT_NAME', 'OS_TENANT_NAME'))
parser.set_defaults(os_project_id=utils.env(
'OS_PROJECT_ID', 'OS_TENANT_ID'))
parser.add_argument('--os_tenant_name',
help=argparse.SUPPRESS)
parser.add_argument('--os_tenant_id',
def __init__(self):
auth_plugin = ks_loading.load_auth_from_conf_options(
cfg.CONF, 'placement')
self._client = ks_loading.load_session_from_conf_options(
cfg.CONF, 'placement', auth=auth_plugin)
self._disabled = False