multiple OpenStackConfig().get_one_cloud() calls fail when using OS_CLOUD
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.OpenStackC
>>> cc.get_one_cloud()
<os_client_
>>> cc.get_one_cloud()
<os_client_
>>> cc.get_one_cloud()
<os_client_
>>> cc.get_one_cloud()
<os_client_
>>> c2 = oscc.OpenStackC
>>> c2.get_one_cloud()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/
auth_plugin = loader.
File "/home/
raise exceptions.
keystoneauth1.
----
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:/
basic pattern that I expected to work
$ export OS_CLOUD=cloud1
$ python -i
import os_client_config
sdk = os_client_
neutron = os_client_
Reviewed: https:/ /review. openstack. org/465195 /git.openstack. org/cgit/ openstack/ os-client- config/ commit/ ?id=8235e0ce6cf f00bfa84501865a 3cf48511cdf2ec
Committed: https:/
Submitter: Jenkins
Branch: master
commit 8235e0ce6cff00b fa84501865a3cf4 8511cdf2ec
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: I279bdf68408a80 7ec18fba634df37 69c9b8fc4dc
Closes-Bug: #1691294