{"id":7478,"library":"os-client-config","title":"OpenStack Client Configuration Library","description":"os-client-config is a Python library designed for standardizing OpenStack client configuration. It aggregates configuration data from environment variables (prefixed with `OS_`) and `clouds.yaml` files, providing a consistent interface for OpenStack applications. The current version is 2.3.0. While still maintained, it is largely superseded by `openstacksdk` for new development.","status":"maintenance","version":"2.3.0","language":"en","source_language":"en","source_url":"https://github.com/openstack/os-client-config","tags":["OpenStack","cloud","configuration","authentication","client"],"install":[{"cmd":"pip install os-client-config","lang":"bash","label":"Install latest version"}],"dependencies":[{"reason":"Required by PyPI metadata.","package":"python>=3.10"}],"imports":[{"symbol":"OpenStackConfig","correct":"from os_client_config import OpenStackConfig"}],"quickstart":{"code":"import os\nfrom os_client_config import OpenStackConfig\n\n# Configure a cloud either via environment variables (OS_CLOUD, OS_AUTH_URL, etc.)\n# or a clouds.yaml file (e.g., in ~/.config/openstack/clouds.yaml)\n\n# Example: Get configuration for a cloud named 'mycloud'\n# Ensure OS_CLOUD is set or 'mycloud' is defined in clouds.yaml\ncloud_name = os.environ.get('OS_CLOUD', 'mycloud')\n\ntry:\n    # Initialize the config object\n    config = OpenStackConfig()\n\n    # Get the configuration for a specific cloud\n    cloud = config.get_one_cloud(cloud_name)\n\n    # Access configuration details\n    print(f\"Cloud name: {cloud.name}\")\n    print(f\"Region: {cloud.region_name}\")\n    print(f\"Auth URL: {cloud.auth['auth_url']}\")\n\n    # Example: Print a few more details (be cautious with sensitive info)\n    if 'username' in cloud.auth:\n        print(f\"Username: {cloud.auth['username']}\")\n    \nexcept Exception as e:\n    print(f\"Error getting OpenStack cloud config: {e}\")\n    print(\"Please ensure 'OS_CLOUD' environment variable is set or 'clouds.yaml' is configured correctly.\")\n","lang":"python","description":"This quickstart demonstrates how to initialize `OpenStackConfig` and retrieve the configuration for a named OpenStack cloud. The library automatically looks for configuration in environment variables (`OS_*`) or `clouds.yaml` files located in the current directory, `~/.config/openstack`, or `/etc/openstack`."},"warnings":[{"fix":"Migrate your application to use `openstacksdk` directly. Install with `pip install openstacksdk` and update your import paths and client instantiation logic.","message":"The `os-client-config` library has been largely superseded by `openstacksdk`. While `os-client-config` will continue to exist, OpenStack strongly recommends migrating to `openstacksdk` for all new projects and existing ones where feasible, as `openstacksdk` provides a more comprehensive and actively developed client experience.","severity":"breaking","affected_versions":"All versions, especially 2.x and newer"},{"fix":"Ensure that all clouds you intend to use are consistently defined across both `clouds.yaml` and `secrets.yaml` files, especially if using OpenStack dynamic inventories or similar tools.","message":"When combining `clouds.yaml` (public configuration) and `secrets.yaml` (sensitive data), issues can arise if the number or names of clouds defined in each file do not perfectly match. This can lead to incomplete cloud configurations, with essential parameters like `auth_url` missing for clouds only partially defined.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use generic `OS_USERNAME` and other `OS_*` prefixed environment variables. Refer to the OpenStack official documentation for the correct, current environment variable names.","message":"`os-client-config` does not provide backward compatibility for older, service-specific environment variables such as `NOVA_USERNAME`. It strictly honors the generic `OS_*` variables.","severity":"deprecated","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Avoid building from tarball releases directly if you encounter this issue. The recommended workaround is to build from the git package and ensure proper tagging, or rely on official PyPI releases which are pre-built correctly.","cause":"When building `os-client-config` from a tarball (e.g., using `pbr`), certain JSON configuration files required by the library might be omitted from the distribution.","error":"Building from tar will have missing files, such as defaults.json, schema.json and so on."},{"fix":"Verify that either the `OS_CLOUD` environment variable is set to a valid cloud name, or that a `clouds.yaml` file exists in one of the standard locations (`.`, `~/.config/openstack`, `/etc/openstack`) and contains a definition for the cloud name you are trying to access. Ensure the cloud name in your code matches the configuration.","cause":"This error occurs when the specified cloud name (`'mycloud'` in the example) cannot be found in any of the configured sources (environment variables, `clouds.yaml` files). This could be due to a missing `OS_CLOUD` environment variable, an incorrectly named cloud in `clouds.yaml`, or `clouds.yaml` not being found in expected locations.","error":"Error getting OpenStack cloud config: The cloud 'mycloud' was not found."}]}