API Reference

API Reference

class openstack.config.OpenStackConfig(config_files=None, vendor_files=None, override_defaults=None, force_ipv4=None, envvar_prefix=None, secure_files=None, pw_func=None, session_constructor=None, app_name=None, app_version=None, load_yaml_config=True, load_envvars=True)
get_extra_config(key, defaults=None)

Fetch an arbitrary extra chunk of config, laying in defaults.

Parameters:
  • key (string) – name of the config section to fetch
  • defaults (dict) – (optional) default values to merge under the found config
register_argparse_arguments(parser, argv, service_keys=None)

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.

Parameters:
  • 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

auth_config_hook(config)

Allow examination of config values before loading auth plugin

OpenStackClient will override this to perform additional checks on auth_type.

option_prompt(config, p_opt)

Prompt user for option that requires a value

magic_fixes(config)

Perform the set of magic argument fixups

get_one(cloud=None, validate=True, argparse=None, **kwargs)

Retrieve a single CloudRegion and merge additional options

Parameters:
  • 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
Returns:

openstack.config.cloud_region.CloudRegion

Raises:

keystoneauth1.exceptions.MissingRequiredOptions on missing required auth parameters

get_one_cloud(cloud=None, validate=True, argparse=None, **kwargs)

Retrieve a single CloudRegion and merge additional options

Parameters:
  • 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
Returns:

openstack.config.cloud_region.CloudRegion

Raises:

keystoneauth1.exceptions.MissingRequiredOptions on missing required auth parameters

get_one_cloud_osc(cloud=None, validate=True, argparse=None, **kwargs)

Retrieve a single CloudRegion and merge additional options

Parameters:
  • 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
Raises:

keystoneauth1.exceptions.MissingRequiredOptions on missing required auth parameters

static set_one_cloud(config_file, cloud, set_config=None)

Set a single cloud configuration.

Parameters:
  • 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
Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.