def register_conf_options(self, conf, group, deprecated_opts=None): """Register the oslo_config options that are needed for a session. The options that are set are: :cafile: The certificate authority filename. :certfile: The client certificate file to present. :keyfile: The key for the client certificate. :insecure: Whether to ignore SSL verification. :timeout: The max time to wait for HTTP connections. :param oslo_config.Cfg conf: config object to register with. :param string group: The ini group to register options in. :param dict deprecated_opts: Deprecated options that should be included in the definition of new options. This should be a dict from the name of the new option to a list of oslo.DeprecatedOpts that correspond to the new option. (optional) For example, to support the ``ca_file`` option pointing to the new ``cafile`` option name:: old_opt = oslo_cfg.DeprecatedOpt('ca_file', 'old_group') deprecated_opts={'cafile': [old_opt]} :returns: The list of options that was registered. """ opts = self.get_conf_options(deprecated_opts=deprecated_opts) conf.register_group(_utils.get_oslo_config().OptGroup(group)) conf.register_opts(opts, group=group) return opts
def get_conf_options(): """Get oslo_config options that are needed for a :py:class:`.Adapter`. These may be useful without being registered for config file generation or to manipulate the options before registering them yourself. The options that are set are: :service_type: The default service_type for URL discovery. :service_name: The default service_name for URL discovery. :interface: The default interface for URL discovery. :region_name: The default region_name for URL discovery. :endpoint_override: Always use this endpoint URL for requests for this client. :returns: A list of oslo_config options. """ cfg = _utils.get_oslo_config() return [ cfg.StrOpt('service-type', help='The default service_type for endpoint URL ' 'discovery.'), cfg.StrOpt('service-name', help='The default service_name for endpoint URL ' 'discovery.'), cfg.StrOpt('interface', help='The default interface for endpoint URL ' 'discovery.'), cfg.StrOpt('region-name', help='The default region_name for endpoint URL ' 'discovery.'), cfg.StrOpt('endpoint-override', help='Always use this endpoint URL for requests ' 'for this client.'), ]
def register_conf_options(self, conf, group, deprecated_opts=None): """Register the oslo_config options that are needed for a session. The options that are set are: :cafile: The certificate authority filename. :certfile: The client certificate file to present. :keyfile: The key for the client certificate. :insecure: Whether to ignore SSL verification. :timeout: The max time to wait for HTTP connections. :collect-timing: Whether to collect API timing information. :split-loggers: Whether to log requests to multiple loggers. :param oslo_config.Cfg conf: config object to register with. :param string group: The ini group to register options in. :param dict deprecated_opts: Deprecated options that should be included in the definition of new options. This should be a dict from the name of the new option to a list of oslo.DeprecatedOpts that correspond to the new option. (optional) For example, to support the ``ca_file`` option pointing to the new ``cafile`` option name:: old_opt = oslo_cfg.DeprecatedOpt('ca_file', 'old_group') deprecated_opts={'cafile': [old_opt]} :returns: The list of options that was registered. """ opts = self.get_conf_options(deprecated_opts=deprecated_opts) conf.register_group(_utils.get_oslo_config().OptGroup(group)) conf.register_opts(opts, group=group) return opts
def get_conf_options(self, deprecated_opts=None): """Get oslo_config options that are needed for a :py:class:`.Session`. These may be useful without being registered for config file generation or to manipulate the options before registering them yourself. The options that are set are: :cafile: The certificate authority filename. :certfile: The client certificate file to present. :keyfile: The key for the client certificate. :insecure: Whether to ignore SSL verification. :timeout: The max time to wait for HTTP connections. :collect-timing: Whether to collect API timing information. :split-loggers: Whether to log requests to multiple loggers. :param dict deprecated_opts: Deprecated options that should be included in the definition of new options. This should be a dict from the name of the new option to a list of oslo.DeprecatedOpts that correspond to the new option. (optional) For example, to support the ``ca_file`` option pointing to the new ``cafile`` option name:: old_opt = oslo_cfg.DeprecatedOpt('ca_file', 'old_group') deprecated_opts={'cafile': [old_opt]} :returns: A list of oslo_config options. """ cfg = _utils.get_oslo_config() if deprecated_opts is None: deprecated_opts = {} return [ cfg.StrOpt('cafile', deprecated_opts=deprecated_opts.get('cafile'), help='PEM encoded Certificate Authority to use ' 'when verifying HTTPs connections.'), cfg.StrOpt('certfile', deprecated_opts=deprecated_opts.get('certfile'), help='PEM encoded client certificate cert file'), cfg.StrOpt('keyfile', deprecated_opts=deprecated_opts.get('keyfile'), help='PEM encoded client certificate key file'), cfg.BoolOpt('insecure', default=False, deprecated_opts=deprecated_opts.get('insecure'), help='Verify HTTPS connections.'), cfg.IntOpt('timeout', deprecated_opts=deprecated_opts.get('timeout'), help='Timeout value for http requests'), cfg.BoolOpt('collect-timing', deprecated_opts=deprecated_opts.get('collect-timing'), default=False, help='Collect per-API call timing information.'), cfg.BoolOpt('split-loggers', deprecated_opts=deprecated_opts.get('split-loggers'), default=False, help='Log requests to multiple loggers.') ]
def register_conf_options(self, conf, group, include_deprecated=True, deprecated_opts=None): """Register the oslo_config options that are needed for an Adapter. The options that are set are: :service_type: The default service_type for URL discovery. :service_name: The default service_name for URL discovery. :interface: The default interface for URL discovery. (deprecated) :valid_interfaces: List of acceptable interfaces for URL discovery. Can be a list of any of 'public', 'internal' or 'admin'. :region_name: The default region_name for URL discovery. :endpoint_override: Always use this endpoint URL for requests for this client. :version: The minimum version restricted to a given Major API. Mutually exclusive with min_version and max_version. :min_version: The minimum major version of a given API, intended to be used as the lower bound of a range with max_version. Mutually exclusive with version. If min_version is given with no max_version it is as if max version is 'latest'. :max_version: The maximum major version of a given API, intended to be used as the upper bound of a range with min_version. Mutually exclusive with version. :connect_retries: The maximum number of retries that should be attempted for connection errors. :status_code_retries: The maximum number of retries that should be attempted for retriable HTTP status codes. :param oslo_config.Cfg conf: config object to register with. :param string group: The ini group to register options in. :param include_deprecated: If True (the default, for backward compatibility), deprecated options are registered. If False, they are excluded. :param dict deprecated_opts: Deprecated options that should be included in the definition of new options. This should be a dict from the name of the new option to a list of oslo.DeprecatedOpts that correspond to the new option. (optional) For example, to support the ``api_endpoint`` option pointing to the new ``endpoint_override`` option name:: old_opt = oslo_cfg.DeprecatedOpt('api_endpoint', 'old_group') deprecated_opts={'endpoint_override': [old_opt]} :returns: The list of options that was registered. """ opts = self.get_conf_options(include_deprecated=include_deprecated, deprecated_opts=deprecated_opts) conf.register_group(_utils.get_oslo_config().OptGroup(group)) conf.register_opts(opts, group=group) return opts
def _to_oslo_opt(self): cfg = _utils.get_oslo_config() deprecated_opts = [cfg.DeprecatedOpt(o.name) for o in self.deprecated] return cfg.Opt(name=self.name, type=self.type, help=self.help, secret=self.secret, required=self.required, dest=self.dest, deprecated_opts=deprecated_opts, metavar=self.metavar)
def register_conf_options(self, conf, group, include_deprecated=True, deprecated_opts=None): """Register the oslo_config options that are needed for an Adapter. The options that are set are: :service_type: The default service_type for URL discovery. :service_name: The default service_name for URL discovery. :interface: The default interface for URL discovery. (deprecated) :valid_interfaces: List of acceptable interfaces for URL discovery. Can be a list of any of 'public', 'internal' or 'admin'. :region_name: The default region_name for URL discovery. :endpoint_override: Always use this endpoint URL for requests for this client. :version: The minimum version restricted to a given Major API. Mutually exclusive with min_version and max_version. :min_version: The minimum major version of a given API, intended to be used as the lower bound of a range with max_version. Mutually exclusive with version. If min_version is given with no max_version it is as if max version is 'latest'. :max_version: The maximum major version of a given API, intended to be used as the upper bound of a range with min_version. Mutually exclusive with version. :param oslo_config.Cfg conf: config object to register with. :param string group: The ini group to register options in. :param include_deprecated: If True (the default, for backward compatibility), deprecated options are registered. If False, they are excluded. :param dict deprecated_opts: Deprecated options that should be included in the definition of new options. This should be a dict from the name of the new option to a list of oslo.DeprecatedOpts that correspond to the new option. (optional) For example, to support the ``api_endpoint`` option pointing to the new ``endpoint_override`` option name:: old_opt = oslo_cfg.DeprecatedOpt('api_endpoint', 'old_group') deprecated_opts={'endpoint_override': [old_opt]} :returns: The list of options that was registered. """ opts = self.get_conf_options(include_deprecated=include_deprecated, deprecated_opts=deprecated_opts) conf.register_group(_utils.get_oslo_config().OptGroup(group)) conf.register_opts(opts, group=group) return opts
def get_conf_options(self, deprecated_opts=None): """Get oslo_config options that are needed for a :py:class:`.Session`. These may be useful without being registered for config file generation or to manipulate the options before registering them yourself. The options that are set are: :cafile: The certificate authority filename. :certfile: The client certificate file to present. :keyfile: The key for the client certificate. :insecure: Whether to ignore SSL verification. :timeout: The max time to wait for HTTP connections. :param dict deprecated_opts: Deprecated options that should be included in the definition of new options. This should be a dict from the name of the new option to a list of oslo.DeprecatedOpts that correspond to the new option. (optional) For example, to support the ``ca_file`` option pointing to the new ``cafile`` option name:: old_opt = oslo_cfg.DeprecatedOpt('ca_file', 'old_group') deprecated_opts={'cafile': [old_opt]} :returns: A list of oslo_config options. """ cfg = _utils.get_oslo_config() if deprecated_opts is None: deprecated_opts = {} return [cfg.StrOpt('cafile', deprecated_opts=deprecated_opts.get('cafile'), help='PEM encoded Certificate Authority to use ' 'when verifying HTTPs connections.'), cfg.StrOpt('certfile', deprecated_opts=deprecated_opts.get('certfile'), help='PEM encoded client certificate cert file'), cfg.StrOpt('keyfile', deprecated_opts=deprecated_opts.get('keyfile'), help='PEM encoded client certificate key file'), cfg.BoolOpt('insecure', default=False, deprecated_opts=deprecated_opts.get('insecure'), help='Verify HTTPS connections.'), cfg.IntOpt('timeout', deprecated_opts=deprecated_opts.get('timeout'), help='Timeout value for http requests'), ]
def register_conf_options(self, conf, group): """Register the oslo_config options that are needed for an Adapter. The options that are set are: :service_type: The default service_type for URL discovery. :service_name: The default service_name for URL discovery. :interface: The default interface for URL discovery. :region_name: The default region_name for URL discovery. :endpoint_override: Always use this endpoint URL for requests for this client. :param oslo_config.Cfg conf: config object to register with. :param string group: The ini group to register options in. :returns: The list of options that was registered. """ opts = self.get_conf_options() conf.register_group(_utils.get_oslo_config().OptGroup(group)) conf.register_opts(opts, group=group) return opts
def register_conf_options(self, conf, group): """Register the oslo_config options that are needed for an Adapter. The options that are set are: :service_type: The default service_type for URL discovery. :service_name: The default service_name for URL discovery. :interface: The default interface for URL discovery. (deprecated) :valid_interfaces: List of acceptable interfaces for URL discovery. Can be a list of any of 'public', 'internal' or 'admin'. :region_name: The default region_name for URL discovery. :endpoint_override: Always use this endpoint URL for requests for this client. :version: The minimum version restricted to a given Major API. Mutually exclusive with min_version and max_version. :min_version: The minimum major version of a given API, intended to be used as the lower bound of a range with max_version. Mutually exclusive with version. If min_version is given with no max_version it is as if max version is 'latest'. :max_version: The maximum major version of a given API, intended to be used as the upper bound of a range with min_version. Mutually exclusive with version. :param oslo_config.Cfg conf: config object to register with. :param string group: The ini group to register options in. :returns: The list of options that was registered. """ opts = self.get_conf_options() conf.register_group(_utils.get_oslo_config().OptGroup(group)) conf.register_opts(opts, group=group) return opts
def get_conf_options(include_deprecated=True, deprecated_opts=None): """Get oslo_config options that are needed for a :py:class:`.Adapter`. These may be useful without being registered for config file generation or to manipulate the options before registering them yourself. The options that are set are: :service_type: The default service_type for URL discovery. :service_name: The default service_name for URL discovery. :interface: The default interface for URL discovery. (deprecated) :valid_interfaces: List of acceptable interfaces for URL discovery. Can be a list of any of 'public', 'internal' or 'admin'. :region_name: The default region_name for URL discovery. :endpoint_override: Always use this endpoint URL for requests for this client. :version: The minimum version restricted to a given Major API. Mutually exclusive with min_version and max_version. :min_version: The minimum major version of a given API, intended to be used as the lower bound of a range with max_version. Mutually exclusive with version. If min_version is given with no max_version it is as if max version is 'latest'. :max_version: The maximum major version of a given API, intended to be used as the upper bound of a range with min_version. Mutually exclusive with version. :param include_deprecated: If True (the default, for backward compatibility), deprecated options are included in the result. If False, they are excluded. :param dict deprecated_opts: Deprecated options that should be included in the definition of new options. This should be a dict from the name of the new option to a list of oslo.DeprecatedOpts that correspond to the new option. (optional) For example, to support the ``api_endpoint`` option pointing to the new ``endpoint_override`` option name:: old_opt = oslo_cfg.DeprecatedOpt('api_endpoint', 'old_group') deprecated_opts={'endpoint_override': [old_opt]} :returns: A list of oslo_config options. """ cfg = _utils.get_oslo_config() if deprecated_opts is None: deprecated_opts = {} # This is goofy, but need to support hyphens *or* underscores deprecated_opts = {name.replace('_', '-'): opt for name, opt in deprecated_opts.items()} opts = [cfg.StrOpt('service-type', deprecated_opts=deprecated_opts.get('service-type'), help='The default service_type for endpoint URL ' 'discovery.'), cfg.StrOpt('service-name', deprecated_opts=deprecated_opts.get('service-name'), help='The default service_name for endpoint URL ' 'discovery.'), cfg.ListOpt('valid-interfaces', deprecated_opts=deprecated_opts.get( 'valid-interfaces'), help='List of interfaces, in order of preference, ' 'for endpoint URL.'), cfg.StrOpt('region-name', deprecated_opts=deprecated_opts.get('region-name'), help='The default region_name for endpoint URL ' 'discovery.'), cfg.StrOpt('endpoint-override', deprecated_opts=deprecated_opts.get( 'endpoint-override'), help='Always use this endpoint URL for requests ' 'for this client. NOTE: The unversioned ' 'endpoint should be specified here; to ' 'request a particular API version, use the ' '`version`, `min-version`, and/or ' '`max-version` options.'), cfg.StrOpt('version', deprecated_opts=deprecated_opts.get('version'), help='Minimum Major API version within a given ' 'Major API version for endpoint URL ' 'discovery. Mutually exclusive with ' 'min_version and max_version'), cfg.StrOpt('min-version', deprecated_opts=deprecated_opts.get('min-version'), help='The minimum major version of a given API, ' 'intended to be used as the lower bound of a ' 'range with max_version. Mutually exclusive ' 'with version. If min_version is given with ' 'no max_version it is as if max version is ' '"latest".'), cfg.StrOpt('max-version', deprecated_opts=deprecated_opts.get('max-version'), help='The maximum major version of a given API, ' 'intended to be used as the upper bound of a ' 'range with min_version. Mutually exclusive ' 'with version.'), ] if include_deprecated: opts += [ cfg.StrOpt('interface', help='The default interface for endpoint URL ' 'discovery.', deprecated_for_removal=True, deprecated_reason='Using valid-interfaces is' ' preferrable because it is' ' capable of accepting a list of' ' possible interfaces.'), ] return opts
def get_conf_options(include_deprecated=True): """Get oslo_config options that are needed for a :py:class:`.Adapter`. These may be useful without being registered for config file generation or to manipulate the options before registering them yourself. The options that are set are: :service_type: The default service_type for URL discovery. :service_name: The default service_name for URL discovery. :interface: The default interface for URL discovery. (deprecated) :valid_interfaces: List of acceptable interfaces for URL discovery. Can be a list of any of 'public', 'internal' or 'admin'. :region_name: The default region_name for URL discovery. :endpoint_override: Always use this endpoint URL for requests for this client. :version: The minimum version restricted to a given Major API. Mutually exclusive with min_version and max_version. :min_version: The minimum major version of a given API, intended to be used as the lower bound of a range with max_version. Mutually exclusive with version. If min_version is given with no max_version it is as if max version is 'latest'. :max_version: The maximum major version of a given API, intended to be used as the upper bound of a range with min_version. Mutually exclusive with version. :param include_deprecated: If True (the default, for backward compatibility), deprecated options are included in the result. If False, they are excluded. :returns: A list of oslo_config options. """ cfg = _utils.get_oslo_config() opts = [ cfg.StrOpt('service-type', help='The default service_type for endpoint URL ' 'discovery.'), cfg.StrOpt('service-name', help='The default service_name for endpoint URL ' 'discovery.'), cfg.ListOpt('valid-interfaces', help='List of interfaces, in order of preference, ' 'for endpoint URL.'), cfg.StrOpt('region-name', help='The default region_name for endpoint URL ' 'discovery.'), cfg.StrOpt('endpoint-override', help='Always use this endpoint URL for requests ' 'for this client.'), cfg.StrOpt('version', help='Minimum Major API version within a given ' 'Major API version for endpoint URL ' 'discovery. Mutually exclusive with ' 'min_version and max_version'), cfg.StrOpt('min-version', help='The minimum major version of a given API, ' 'intended to be used as the lower bound of a ' 'range with max_version. Mutually exclusive ' 'with version. If min_version is given with ' 'no max_version it is as if max version is ' '"latest".'), cfg.StrOpt('max-version', help='The maximum major version of a given API, ' 'intended to be used as the upper bound of a ' 'range with min_version. Mutually exclusive ' 'with version.'), ] if include_deprecated: opts += [ cfg.StrOpt('interface', help='The default interface for endpoint URL ' 'discovery.', deprecated_for_removal=True, deprecated_reason='Using valid-interfaces is' ' preferrable because it is' ' capable of accepting a list of' ' possible interfaces.'), ] return opts