Merge "Replace os-client-config"
This commit is contained in:
@@ -10,10 +10,11 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
from openstack import config as occ
|
||||||
|
import openstack.exceptions
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
from keystoneclient import client
|
from keystoneclient import client
|
||||||
import os_client_config
|
|
||||||
|
|
||||||
IDENTITY_CLIENT = 'identity'
|
IDENTITY_CLIENT = 'identity'
|
||||||
OPENSTACK_CLOUDS = ('functional_admin', 'devstack-admin', 'envvars')
|
OPENSTACK_CLOUDS = ('functional_admin', 'devstack-admin', 'envvars')
|
||||||
@@ -22,8 +23,8 @@ OPENSTACK_CLOUDS = ('functional_admin', 'devstack-admin', 'envvars')
|
|||||||
def get_client(version):
|
def get_client(version):
|
||||||
"""Create a keystoneclient instance to run functional tests.
|
"""Create a keystoneclient instance to run functional tests.
|
||||||
|
|
||||||
The client is instantiated via os-client-config either based on a
|
The client is instantiated either based on a clouds.yaml config file or
|
||||||
clouds.yaml config file or from the environment variables.
|
from the environment variables.
|
||||||
|
|
||||||
First, look for a 'functional_admin' cloud, as this is a cloud that the
|
First, look for a 'functional_admin' cloud, as this is a cloud that the
|
||||||
user may have defined for functional testing with admin credentials. If
|
user may have defined for functional testing with admin credentials. If
|
||||||
@@ -33,12 +34,14 @@ def get_client(version):
|
|||||||
"""
|
"""
|
||||||
for cloud in OPENSTACK_CLOUDS:
|
for cloud in OPENSTACK_CLOUDS:
|
||||||
try:
|
try:
|
||||||
cloud_config = os_client_config.get_config(
|
cloud_config = occ.OpenStackConfig().get_one(
|
||||||
cloud=cloud, identity_api_version=version)
|
cloud=cloud, identity_api_version=version)
|
||||||
return cloud_config.get_legacy_client(service_key=IDENTITY_CLIENT,
|
endpoint = cloud_config.get_session_endpoint(IDENTITY_CLIENT)
|
||||||
constructor=client.Client)
|
return client.Client(
|
||||||
|
version=version,
|
||||||
except os_client_config.exceptions.OpenStackConfigException:
|
session=cloud_config.get_session(),
|
||||||
|
endpoint=endpoint)
|
||||||
|
except openstack.exceptions.ConfigException:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
raise Exception("Could not find any cloud definition for clouds named"
|
raise Exception("Could not find any cloud definition for clouds named"
|
||||||
|
@@ -6,7 +6,7 @@ fixtures>=3.0.0 # Apache-2.0/BSD
|
|||||||
keyring>=5.5.1 # MIT/PSF
|
keyring>=5.5.1 # MIT/PSF
|
||||||
lxml>=4.5.0 # BSD
|
lxml>=4.5.0 # BSD
|
||||||
oauthlib>=0.6.2 # BSD
|
oauthlib>=0.6.2 # BSD
|
||||||
os-client-config>=1.28.0 # Apache-2.0
|
openstacksdk>=0.10.0 # Apache-2.0
|
||||||
oslotest>=3.2.0 # Apache-2.0
|
oslotest>=3.2.0 # Apache-2.0
|
||||||
requests-mock>=1.2.0 # Apache-2.0
|
requests-mock>=1.2.0 # Apache-2.0
|
||||||
tempest>=17.1.0 # Apache-2.0
|
tempest>=17.1.0 # Apache-2.0
|
||||||
|
Reference in New Issue
Block a user