Fetch an arbitrary extra chunk of config, laying in defaults.
key (string) – name of the config section to fetch
defaults (dict) – (optional) default values to merge under the found config
Register all of the common argparse options needed.
Given an argparse parser, register the keystoneauth Session arguments, the keystoneauth Auth Plugin Options and os-cloud. Also, peek in the argv to see if all of the auth plugin options should be registered or merely the ones already configured.
argparse.ArgumentParser – parser to attach argparse options to
argv – the arguments provided to the application
service_keys (string) – Service or list of services this argparse should be specialized for, if known. The first item in the list will be used as the default value for service_type (optional)
:raises exceptions.ConfigException if an invalid auth-type is requested
Allow examination of config values before loading auth plugin
OpenStackClient will override this to perform additional checks on auth_type.
Prompt user for option that requires a value
Perform the set of magic argument fixups
Retrieve a single CloudRegion and merge additional options
cloud (string) – The name of the configuration to load from clouds.yaml
validate (boolean) – Validate the config. Setting this to False causes no auth plugin to be created. It’s really only useful for testing.
argparse (Namespace) – An argparse Namespace object; allows direct passing in of argparse options to be added to the cloud config. Values of None and ‘’ will be removed.
region_name – Name of the region of the cloud.
kwargs – Additional configuration options
openstack.config.cloud_region.CloudRegion
keystoneauth1.exceptions.MissingRequiredOptions on missing required auth parameters
Retrieve a single CloudRegion and merge additional options
cloud (string) – The name of the configuration to load from clouds.yaml
validate (boolean) – Validate the config. Setting this to False causes no auth plugin to be created. It’s really only useful for testing.
argparse (Namespace) – An argparse Namespace object; allows direct passing in of argparse options to be added to the cloud config. Values of None and ‘’ will be removed.
region_name – Name of the region of the cloud.
kwargs – Additional configuration options
openstack.config.cloud_region.CloudRegion
keystoneauth1.exceptions.MissingRequiredOptions on missing required auth parameters
Retrieve a single CloudRegion and merge additional options
cloud (string) – The name of the configuration to load from clouds.yaml
validate (boolean) – Validate the config. Setting this to False causes no auth plugin to be created. It’s really only useful for testing.
argparse (Namespace) – An argparse Namespace object; allows direct passing in of argparse options to be added to the cloud config. Values of None and ‘’ will be removed.
region_name – Name of the region of the cloud.
kwargs – Additional configuration options
keystoneauth1.exceptions.MissingRequiredOptions on missing required auth parameters
Set a single cloud configuration.
config_file (string) – The path to the config file to edit. If this file does not exist it will be created.
cloud (string) – The name of the configuration to save to clouds.yaml
set_config (dict) – Configuration options to be set
The configuration for a Region of an OpenStack Cloud.
A CloudRegion encapsulates the config information needed for connections to all of the services in a Region of a Cloud.
region_name (str) – The default region name for all services in this CloudRegion. If
both region_name
and config['region_name'] are specified, the
kwarg takes precedence. May be overridden for a given ${service}
via a ${service}_region_name key in the ``config
dict.
config (dict) –
A dict of configuration values for the CloudRegion and its
services. The key for a ${config_option} for a specific ${service}
should be ${service}_${config_option}. For example, to configure
the endpoint_override for the block_storage service, the config
dict should contain:
'block_storage_endpoint_override': 'http://...'
To provide a default to be used if no service-specific override is present, just use the unprefixed ${config_option} as the service key, e.g.:
'interface': 'public'
Return a string that can be used as an identifier.
Always returns a valid string. It will have name and region_name or just one of the two if only one is set, or else ‘unknown’.
Sets the Session constructor.
Return the verify and cert values for the requests library.
Return a list of service types we know something about.
Return the endpoint for a given service as found in the catalog.
For values respecting endpoint overrides, see
endpoint_for()
service_type – Service Type of the endpoint to search for.
interface – Interface of the endpoint to search for. Optional, defaults to the configured value for interface for this Connection.
region_name – Region Name of the endpoint to search for. Optional, defaults to the configured value for region_name for this Connection.
The endpoint of the service, or None if not found.
Return a keystoneauth plugin from the auth credentials.
Set sdk information into the user agent of the Session.
Warning
This method is here to be used by os-client-config. It exists as a hook point so that os-client-config can provice backwards compatibility and still be in the User Agent for people using os-client-config directly.
Normal consumers of SDK should use app_name and app_version. However,
if someone else writes a subclass of
CloudRegion
it may be
desirable.
Return a keystoneauth session based on the auth credentials.
Helper method to grab the service catalog.
Return a prepped keystoneauth Adapter for a given service.
This is useful for making direct requests calls against a ‘mounted’ endpoint. That is, if you do:
client = get_session_client(‘compute’)
then you can do:
client.get(‘/flavors’)
and it will work like you think.
Return the endpoint from config or the catalog.
If a configuration lists an explicit endpoint for a service, return that. Otherwise, fetch the service catalog from the keystone session and return the appropriate endpoint.
service_type – Official service type of service
Get expiration time for a resource
resource – Name of the resource type
default – Default value to return if not found (optional, defaults to None)
Expiration time for the resource type as float or default
Return whether or not this cloud requires floating ips.
True of False if know, None if discovery is needed. If requires_floating_ip is not configured but the cloud is known to not provide floating ips, will return False.
Get list of network names for external networks.
Get list of network names for external IPv4 networks.
Get list of network names for external IPv6 networks.
Get list of network names for internal networks.
Get list of network names for internal IPv4 networks.
Get list of network names for internal IPv6 networks.
Get network used for default interactions.
Get network used for NAT destination.
Get network used for NAT source.
Get config settings for a named client.
Settings will also be looked for in a section called ‘client’. If settings are found in both, they will be merged with the settings from the named section winning over the settings from client section, and both winning over provided defaults.
name (string) – Name of the config section to look for.
defaults (dict) – Default settings to use.
A dict containing merged settings from the named section, the client section and the defaults.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.