Remove CONF values from OrchestrationClient
To move OrchestrationClient to tempest-lib, this patch moves CONF values from OrchestrationClient to the client setting. In addition, this patch adds default_params into general client setting class and makes use it for removing default_params values from service client code in the future. Change-Id: Ia988862516b7bc1d6e8bd79c671da4ecc2abe8f3
This commit is contained in:
parent
d1ef1333c0
commit
c2b11cef0b
|
@ -133,6 +133,13 @@ class Manager(manager.Manager):
|
|||
Top level manager for OpenStack tempest clients
|
||||
"""
|
||||
|
||||
default_params = {
|
||||
'disable_ssl_certificate_validation':
|
||||
CONF.identity.disable_ssl_certificate_validation,
|
||||
'ca_certs': CONF.identity.ca_certificates_file,
|
||||
'trace_requests': CONF.debug.trace_requests
|
||||
}
|
||||
|
||||
def __init__(self, credentials=None, interface='json', service=None):
|
||||
# Set interface and client type first
|
||||
self.interface = interface
|
||||
|
@ -170,7 +177,14 @@ class Manager(manager.Manager):
|
|||
self.container_client = ContainerClient(self.auth_provider)
|
||||
self.object_client = ObjectClient(self.auth_provider)
|
||||
self.orchestration_client = OrchestrationClient(
|
||||
self.auth_provider)
|
||||
self.auth_provider,
|
||||
CONF.orchestration.catalog_type,
|
||||
CONF.orchestration.region or CONF.identity.region,
|
||||
endpoint_type=CONF.orchestration.endpoint_type,
|
||||
build_interval=CONF.orchestration.build_interval,
|
||||
build_timeout=CONF.orchestration.build_timeout,
|
||||
**self.default_params)
|
||||
|
||||
self.ec2api_client = botoclients.APIClientEC2(*ec2_client_args)
|
||||
self.s3_client = botoclients.ObjectClientS3(*ec2_client_args)
|
||||
self.data_processing_client = DataProcessingClient(
|
||||
|
|
|
@ -21,13 +21,21 @@ CONF = config.CONF
|
|||
class ServiceClient(rest_client.RestClient):
|
||||
|
||||
def __init__(self, auth_provider, service, region,
|
||||
endpoint_type=None, build_interval=None, build_timeout=None):
|
||||
endpoint_type=None, build_interval=None, build_timeout=None,
|
||||
disable_ssl_certificate_validation=None, ca_certs=None,
|
||||
trace_requests=None):
|
||||
|
||||
# TODO(oomichi): This params setting should be removed after all
|
||||
# service clients pass these values, and we can make ServiceClient
|
||||
# free from CONF values.
|
||||
dscv = (disable_ssl_certificate_validation or
|
||||
CONF.identity.disable_ssl_certificate_validation)
|
||||
params = {
|
||||
'disable_ssl_certificate_validation':
|
||||
CONF.identity.disable_ssl_certificate_validation,
|
||||
'ca_certs': CONF.identity.ca_certificates_file,
|
||||
'trace_requests': CONF.debug.trace_requests
|
||||
'disable_ssl_certificate_validation': dscv,
|
||||
'ca_certs': ca_certs or CONF.identity.ca_certificates_file,
|
||||
'trace_requests': trace_requests or CONF.debug.trace_requests
|
||||
}
|
||||
|
||||
if endpoint_type is not None:
|
||||
params.update({'endpoint_type': endpoint_type})
|
||||
if build_interval is not None:
|
||||
|
|
|
@ -19,23 +19,11 @@ import time
|
|||
import urllib
|
||||
|
||||
from tempest.common import service_client
|
||||
from tempest import config
|
||||
from tempest import exceptions
|
||||
|
||||
CONF = config.CONF
|
||||
|
||||
|
||||
class OrchestrationClient(service_client.ServiceClient):
|
||||
|
||||
def __init__(self, auth_provider):
|
||||
super(OrchestrationClient, self).__init__(
|
||||
auth_provider,
|
||||
CONF.orchestration.catalog_type,
|
||||
CONF.orchestration.region or CONF.identity.region,
|
||||
endpoint_type=CONF.orchestration.endpoint_type,
|
||||
build_interval=CONF.orchestration.build_interval,
|
||||
build_timeout=CONF.orchestration.build_timeout)
|
||||
|
||||
def list_stacks(self, params=None):
|
||||
"""Lists all stacks for a user."""
|
||||
|
||||
|
|
Loading…
Reference in New Issue