multiple OpenStackConfig().get_one_cloud() calls fail when using OS_CLOUD

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

Bug Description

with OS_CLOUD as an envvar or as an command arg multiple calls create an instance of OpenStackConfig and then call get_one_cloud() fail

$ python -i
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os_client_config as oscc
>>> cc = oscc.OpenStackConfig()
>>> cc.get_one_cloud()
<os_client_config.cloud_config.CloudConfig object at 0x7f94e06b5cd0>
>>> cc.get_one_cloud()
<os_client_config.cloud_config.CloudConfig object at 0x7f94e0610610>
>>> cc.get_one_cloud()
<os_client_config.cloud_config.CloudConfig object at 0x7f94e06afc10>
>>> cc.get_one_cloud()
<os_client_config.cloud_config.CloudConfig object at 0x7f94e0610390>
>>> c2 = oscc.OpenStackConfig()
>>> c2.get_one_cloud()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/os_client_config/config.py", line 1071, in get_one_cloud
    auth_plugin = loader.load_from_options(**config['auth'])
  File "/home/awoodward/.local/lib/python2.7/site-packages/keystoneauth1/loading/base.py", line 162, in load_from_options
    raise exceptions.MissingRequiredOptions(missing_required)
keystoneauth1.exceptions.auth_plugins.MissingRequiredOptions: Auth plugin requires parameters which were not given: auth_url

----

This works fine in the traditonal envvars openrc style.
This fails using clouds.yaml format
To further isolate, this also works if you explicitly call for cloud='name'

More debugging: https://gist.github.com/xarses/55e2517bd49903df2c5ec7ff5f697d74

basic pattern that I expected to work

$ export OS_CLOUD=cloud1
$ python -i

import os_client_config

sdk = os_client_config.make_sdk()
neutron = os_client_config.make_client('network')

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

Reviewed: https://review.openstack.org/465195
Committed: https://git.openstack.org/cgit/openstack/os-client-config/commit/?id=8235e0ce6cff00bfa84501865a3cf48511cdf2ec
Submitter: Jenkins
Branch: master

commit 8235e0ce6cff00bfa84501865a3cf48511cdf2ec
Author: Monty Taylor <email address hidden>
Date: Tue May 16 18:12:41 2017 -0500

    Keep a singleton to support multiple get_config calls

    We are destructive to os.environ in the OpenStackConfig constructor- so
    it really should only ever be called once. Make sure get_config does
    this.

    Change-Id: I279bdf68408a807ec18fba634df3769c9b8fc4dc
    Closes-Bug: #1691294

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

This issue was fixed in the openstack/os-client-config 1.28.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.