Mixed cloud configs

Bug #1439927 reported by Everett Toews
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
os-client-config
Fix Released
Undecided
Unassigned

Bug Description

Because os-client-config initializes with the OS_ env vars [1] you can easily wind up with a mixed cloud configs.

Take for example these env vars

export OS_AUTH_URL=https://identity.api.rackspacecloud.com/v2.0/
export OS_REGION_NAME=IAD
export OS_TENANT_NAME=xxx
export OS_TENANT_ID=xxx
export OS_USERNAME=xxx
export OS_PASSWORD=xxx
export OS_API_KEY=xxx

With this clouds.yaml

clouds:
  test_cloud:
    auth:
      auth_url: http://104.239.166.175:5000/v2.0
      username: demo
      password: devstack
      project_name: demo
    region_name: RegionOne

And you do

test_cloud = os_client_config.OpenStackConfig().get_one_cloud('test_cloud')

You wind up with a test_cloud.config of

{
  'auth_type': 'password',
  'username': 'xxx',
  'api_key': 'xxx',
  'password': 'xxx',
  'auth_url': 'https://identity.api.rackspacecloud.com/v2.0/',
  'region_name': 'RegionOne',
  'auth': {
    'username': 'demo',
    'project_name': 'demo',
    'password': 'devstack',
    'auth_url': 'http://xxx.xxx.xxx.xxx:5000/v2.0'
  }
  'compute_api_version': '2',
  'identity_api_version': '2',
  'image_api_version': '1',
  'network_api_version': '2',
  'object_api_version': '1',
  'volume_api_version': '1'
}

Where you can see we have mixed cloud configs. This is confusing at best. At worst the region_name has been overridden and is now invalid for the values outside of the 'auth' key.

It's tempting to suggest that env vars should be loaded after any clouds.yaml and be used to override values in clouds.yaml but that way lies madness. You'll never be able to guarantee that one env var should override a particular value for all cloud configs.

My preference would be to see the env vars define their own independent and separate cloud config. They would in no way be mixed into any other cloud config. They could be accessed by a special name or even have an env var that sets the name for the cloud config. e.g.

export OS_CLIENT_CONFIG_NAME=my_cloud_config_defined_by_env_vars
test_cloud = os_client_config.OpenStackConfig().get_one_cloud('my_cloud_config_defined_by_env_vars')

[1] http://git.openstack.org/cgit/openstack/os-client-config/tree/os_client_config/config.py#n83

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to os-client-config (master)

Reviewed: https://review.openstack.org/172652
Committed: https://git.openstack.org/cgit/openstack/os-client-config/commit/?id=7e682d3bf097a006ec43c16ecc96664bf4b29294
Submitter: Jenkins
Branch: master

commit 7e682d3bf097a006ec43c16ecc96664bf4b29294
Author: Monty Taylor <email address hidden>
Date: Sat Apr 11 08:27:05 2015 -0400

    Put env vars into their own cloud config

    The semantics around mixing environment variables and config file values
    are confusing at best and no reasonable usecase has been expressed as to
    why doing so is desirable.

    Move the logic around environment variable processing to always provide
    an "envvars" cloud if any envvars are set. The cloud will only exist in
    the presence of OS_ env vars.

    get_one_cloud() will default to returning the envvars cloud if it
    exists.

    Change-Id: I6c3a54997c3278feedfdf93cc4d1e74b6235700a
    Closes-Bug: #1439927

Changed in os-client-config:
status: New → Fix Committed
Changed in os-client-config:
milestone: none → 1.7.4
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/os-client-config 0.8.0

This issue was fixed in the openstack/os-client-config 0.8.0 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/python-openstacksdk 0.10.0

This issue was fixed in the openstack/python-openstacksdk 0.10.0 release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.