Use specified client service name for client usage
Create CLIENT_NAME for every client, which can be used to replace seperated string for service client name. Change-Id: Id8425e8cca3ad9cea5f7364fdf057260e1d8f27c
This commit is contained in:
parent
4c649151cf
commit
bed7e1f7c9
|
@ -17,13 +17,15 @@ from heat.engine.clients import client_plugin
|
|||
|
||||
from barbicanclient import client as barbican_client
|
||||
|
||||
CLIENT_NAME = 'barbican'
|
||||
|
||||
|
||||
class BarbicanClientPlugin(client_plugin.ClientPlugin):
|
||||
|
||||
service_types = [KEY_MANAGER] = ['key-manager']
|
||||
|
||||
def _create(self):
|
||||
endpoint_type = self._get_client_option('barbican', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
endpoint = self.url_for(service_type=self.KEY_MANAGER,
|
||||
endpoint_type=endpoint_type)
|
||||
self._keystone_session.auth = self.context.auth_plugin
|
||||
|
|
|
@ -17,6 +17,8 @@ from ceilometerclient.openstack.common.apiclient import exceptions as api_exc
|
|||
|
||||
from heat.engine.clients import client_plugin
|
||||
|
||||
CLIENT_NAME = 'ceilometer'
|
||||
|
||||
|
||||
class CeilometerClientPlugin(client_plugin.ClientPlugin):
|
||||
|
||||
|
@ -27,7 +29,7 @@ class CeilometerClientPlugin(client_plugin.ClientPlugin):
|
|||
def _create(self):
|
||||
|
||||
con = self.context
|
||||
endpoint_type = self._get_client_option('ceilometer', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
endpoint = self.url_for(service_type=self.METERING,
|
||||
endpoint_type=endpoint_type)
|
||||
args = {
|
||||
|
@ -37,10 +39,10 @@ class CeilometerClientPlugin(client_plugin.ClientPlugin):
|
|||
'token': lambda: self.auth_token,
|
||||
'endpoint_type': endpoint_type,
|
||||
'os_endpoint': endpoint,
|
||||
'cacert': self._get_client_option('ceilometer', 'ca_file'),
|
||||
'cert_file': self._get_client_option('ceilometer', 'cert_file'),
|
||||
'key_file': self._get_client_option('ceilometer', 'key_file'),
|
||||
'insecure': self._get_client_option('ceilometer', 'insecure')
|
||||
'cacert': self._get_client_option(CLIENT_NAME, 'ca_file'),
|
||||
'cert_file': self._get_client_option(CLIENT_NAME, 'cert_file'),
|
||||
'key_file': self._get_client_option(CLIENT_NAME, 'key_file'),
|
||||
'insecure': self._get_client_option(CLIENT_NAME, 'insecure')
|
||||
}
|
||||
|
||||
return cc.get_client('2', **args)
|
||||
|
|
|
@ -26,7 +26,7 @@ from heat.engine import constraints
|
|||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
SERVICE_NAME = 'cinder'
|
||||
CLIENT_NAME = 'cinder'
|
||||
|
||||
|
||||
class CinderClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -38,7 +38,7 @@ class CinderClientPlugin(client_plugin.ClientPlugin):
|
|||
def get_volume_api_version(self):
|
||||
'''Returns the most recent API version.'''
|
||||
|
||||
endpoint_type = self._get_client_option('cinder', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
try:
|
||||
self.url_for(service_type=self.VOLUME_V2,
|
||||
endpoint_type=endpoint_type)
|
||||
|
@ -67,7 +67,7 @@ class CinderClientPlugin(client_plugin.ClientPlugin):
|
|||
LOG.info(_LI('Creating Cinder client with volume API version %d.'),
|
||||
volume_api_version)
|
||||
|
||||
endpoint_type = self._get_client_option('cinder', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
args = {
|
||||
'service_type': service_type,
|
||||
'auth_url': con.auth_url or '',
|
||||
|
@ -75,10 +75,10 @@ class CinderClientPlugin(client_plugin.ClientPlugin):
|
|||
'username': None,
|
||||
'api_key': None,
|
||||
'endpoint_type': endpoint_type,
|
||||
'http_log_debug': self._get_client_option('cinder',
|
||||
'http_log_debug': self._get_client_option(CLIENT_NAME,
|
||||
'http_log_debug'),
|
||||
'cacert': self._get_client_option('cinder', 'ca_file'),
|
||||
'insecure': self._get_client_option('cinder', 'insecure')
|
||||
'cacert': self._get_client_option(CLIENT_NAME, 'ca_file'),
|
||||
'insecure': self._get_client_option(CLIENT_NAME, 'insecure')
|
||||
}
|
||||
|
||||
client = cc.Client(client_version, **args)
|
||||
|
@ -183,7 +183,7 @@ class CinderClientPlugin(client_plugin.ClientPlugin):
|
|||
|
||||
class BaseCinderConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
resource_client_name = SERVICE_NAME
|
||||
resource_client_name = CLIENT_NAME
|
||||
|
||||
|
||||
class VolumeConstraint(BaseCinderConstraint):
|
||||
|
|
|
@ -20,7 +20,7 @@ from heat.common import exception as heat_exception
|
|||
from heat.engine.clients import client_plugin
|
||||
from heat.engine import constraints
|
||||
|
||||
SERVICE_NAME = 'designate'
|
||||
CLIENT_NAME = 'designate'
|
||||
|
||||
|
||||
class DesignateClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -30,7 +30,7 @@ class DesignateClientPlugin(client_plugin.ClientPlugin):
|
|||
service_types = [DNS] = ['dns']
|
||||
|
||||
def _create(self):
|
||||
args = self._get_client_args(service_name='designate',
|
||||
args = self._get_client_args(service_name=CLIENT_NAME,
|
||||
service_type=self.DNS)
|
||||
|
||||
return client.Client(auth_url=args['auth_url'],
|
||||
|
@ -90,5 +90,5 @@ class DesignateClientPlugin(client_plugin.ClientPlugin):
|
|||
|
||||
class DesignateDomainConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
resource_client_name = SERVICE_NAME
|
||||
resource_client_name = CLIENT_NAME
|
||||
resource_getter_name = 'get_domain_id'
|
||||
|
|
|
@ -20,7 +20,7 @@ from heat.common.i18n import _
|
|||
from heat.engine.clients import client_plugin
|
||||
from heat.engine import constraints
|
||||
|
||||
SERVICE_NAME = 'glance'
|
||||
CLIENT_NAME = 'glance'
|
||||
|
||||
|
||||
class GlanceClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -32,7 +32,7 @@ class GlanceClientPlugin(client_plugin.ClientPlugin):
|
|||
def _create(self):
|
||||
|
||||
con = self.context
|
||||
endpoint_type = self._get_client_option('glance', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
endpoint = self.url_for(service_type=self.IMAGE,
|
||||
endpoint_type=endpoint_type)
|
||||
args = {
|
||||
|
@ -41,10 +41,10 @@ class GlanceClientPlugin(client_plugin.ClientPlugin):
|
|||
'project_id': con.tenant_id,
|
||||
'token': self.auth_token,
|
||||
'endpoint_type': endpoint_type,
|
||||
'cacert': self._get_client_option('glance', 'ca_file'),
|
||||
'cert_file': self._get_client_option('glance', 'cert_file'),
|
||||
'key_file': self._get_client_option('glance', 'key_file'),
|
||||
'insecure': self._get_client_option('glance', 'insecure')
|
||||
'cacert': self._get_client_option(CLIENT_NAME, 'ca_file'),
|
||||
'cert_file': self._get_client_option(CLIENT_NAME, 'cert_file'),
|
||||
'key_file': self._get_client_option(CLIENT_NAME, 'key_file'),
|
||||
'insecure': self._get_client_option(CLIENT_NAME, 'insecure')
|
||||
}
|
||||
|
||||
return gc.Client('1', endpoint, **args)
|
||||
|
@ -101,5 +101,5 @@ class GlanceClientPlugin(client_plugin.ClientPlugin):
|
|||
|
||||
|
||||
class ImageConstraint(constraints.BaseCustomConstraint):
|
||||
resource_client_name = SERVICE_NAME
|
||||
resource_client_name = CLIENT_NAME
|
||||
resource_getter_name = 'get_image_id'
|
||||
|
|
|
@ -16,6 +16,8 @@ from heatclient import exc
|
|||
|
||||
from heat.engine.clients import client_plugin
|
||||
|
||||
CLIENT_NAME = 'heat'
|
||||
|
||||
|
||||
class HeatClientPlugin(client_plugin.ClientPlugin):
|
||||
|
||||
|
@ -30,14 +32,14 @@ class HeatClientPlugin(client_plugin.ClientPlugin):
|
|||
'token': self.auth_token,
|
||||
'username': None,
|
||||
'password': None,
|
||||
'ca_file': self._get_client_option('heat', 'ca_file'),
|
||||
'cert_file': self._get_client_option('heat', 'cert_file'),
|
||||
'key_file': self._get_client_option('heat', 'key_file'),
|
||||
'insecure': self._get_client_option('heat', 'insecure')
|
||||
'ca_file': self._get_client_option(CLIENT_NAME, 'ca_file'),
|
||||
'cert_file': self._get_client_option(CLIENT_NAME, 'cert_file'),
|
||||
'key_file': self._get_client_option(CLIENT_NAME, 'key_file'),
|
||||
'insecure': self._get_client_option(CLIENT_NAME, 'insecure')
|
||||
}
|
||||
|
||||
endpoint = self.get_heat_url()
|
||||
if self._get_client_option('heat', 'url'):
|
||||
if self._get_client_option(CLIENT_NAME, 'url'):
|
||||
# assume that the heat API URL is manually configured because
|
||||
# it is not in the keystone catalog, so include the credentials
|
||||
# for the standalone auth_password middleware
|
||||
|
@ -57,18 +59,19 @@ class HeatClientPlugin(client_plugin.ClientPlugin):
|
|||
return isinstance(ex, exc.HTTPConflict)
|
||||
|
||||
def get_heat_url(self):
|
||||
heat_url = self._get_client_option('heat', 'url')
|
||||
heat_url = self._get_client_option(CLIENT_NAME, 'url')
|
||||
if heat_url:
|
||||
tenant_id = self.context.tenant_id
|
||||
heat_url = heat_url % {'tenant_id': tenant_id}
|
||||
else:
|
||||
endpoint_type = self._get_client_option('heat', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME,
|
||||
'endpoint_type')
|
||||
heat_url = self.url_for(service_type=self.ORCHESTRATION,
|
||||
endpoint_type=endpoint_type)
|
||||
return heat_url
|
||||
|
||||
def get_heat_cfn_url(self):
|
||||
endpoint_type = self._get_client_option('heat',
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME,
|
||||
'endpoint_type')
|
||||
heat_cfn_url = self.url_for(service_type=self.CLOUDFORMATION,
|
||||
endpoint_type=endpoint_type)
|
||||
|
|
|
@ -18,7 +18,7 @@ from heat.common import heat_keystoneclient as hkc
|
|||
from heat.engine.clients import client_plugin
|
||||
from heat.engine import constraints
|
||||
|
||||
SERVICE_NAME = 'keystone'
|
||||
CLIENT_NAME = 'keystone'
|
||||
|
||||
|
||||
class KeystoneClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -136,7 +136,7 @@ class KeystoneClientPlugin(client_plugin.ClientPlugin):
|
|||
|
||||
class KeystoneBaseConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
resource_client_name = SERVICE_NAME
|
||||
resource_client_name = CLIENT_NAME
|
||||
|
||||
|
||||
class KeystoneRoleConstraint(KeystoneBaseConstraint):
|
||||
|
|
|
@ -18,7 +18,7 @@ from heat.common import exception
|
|||
from heat.engine.clients import client_plugin
|
||||
from heat.engine import constraints
|
||||
|
||||
SERVICE_NAME = 'magnum'
|
||||
CLIENT_NAME = 'magnum'
|
||||
|
||||
|
||||
class MagnumClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -26,7 +26,7 @@ class MagnumClientPlugin(client_plugin.ClientPlugin):
|
|||
service_types = [CONTAINER] = ['container']
|
||||
|
||||
def _create(self):
|
||||
endpoint_type = self._get_client_option('magnum', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
endpoint = self.url_for(service_type=self.CONTAINER,
|
||||
endpoint_type=endpoint_type)
|
||||
|
||||
|
@ -56,5 +56,5 @@ class MagnumClientPlugin(client_plugin.ClientPlugin):
|
|||
|
||||
class BaymodelConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
resource_client_name = SERVICE_NAME
|
||||
resource_client_name = CLIENT_NAME
|
||||
resource_getter_name = 'get_baymodel'
|
||||
|
|
|
@ -18,7 +18,7 @@ from manilaclient import client as manila_client
|
|||
from manilaclient import exceptions
|
||||
|
||||
MANILACLIENT_VERSION = "1"
|
||||
SERVICE_NAME = 'manila'
|
||||
CLIENT_NAME = 'manila'
|
||||
|
||||
|
||||
class ManilaClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -28,7 +28,7 @@ class ManilaClientPlugin(client_plugin.ClientPlugin):
|
|||
service_types = [SHARE] = ['share']
|
||||
|
||||
def _create(self):
|
||||
endpoint_type = self._get_client_option('manila', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
endpoint = self.url_for(service_type=self.SHARE,
|
||||
endpoint_type=endpoint_type)
|
||||
|
||||
|
@ -120,7 +120,7 @@ class ManilaShareBaseConstraint(constraints.BaseCustomConstraint):
|
|||
# doc tests on gates will fail
|
||||
expected_exceptions = (heat_exception.EntityNotFound,
|
||||
exceptions.NoUniqueMatch)
|
||||
resource_client_name = SERVICE_NAME
|
||||
resource_client_name = CLIENT_NAME
|
||||
|
||||
|
||||
class ManilaShareNetworkConstraint(ManilaShareBaseConstraint):
|
||||
|
|
|
@ -16,13 +16,15 @@ from mistralclient.api import client as mistral_client
|
|||
|
||||
from heat.engine.clients import client_plugin
|
||||
|
||||
CLIENT_NAME = 'mistral'
|
||||
|
||||
|
||||
class MistralClientPlugin(client_plugin.ClientPlugin):
|
||||
|
||||
service_types = [WORKFLOW_V2] = ['workflowv2']
|
||||
|
||||
def _create(self):
|
||||
endpoint_type = self._get_client_option('mistral', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
endpoint = self.url_for(service_type=self.WORKFLOW_V2,
|
||||
endpoint_type=endpoint_type)
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ from heat.engine import constraints
|
|||
client = importutils.try_import('monascaclient.client')
|
||||
monasca_exc = importutils.try_import('monascaclient.exc')
|
||||
|
||||
SERVICE_NAME = 'monasca'
|
||||
CLIENT_NAME = 'monasca'
|
||||
|
||||
|
||||
class MonascaClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -34,7 +34,7 @@ class MonascaClientPlugin(client_plugin.ClientPlugin):
|
|||
return client is not None
|
||||
|
||||
def _create(self):
|
||||
args = self._get_client_args(service_name=SERVICE_NAME,
|
||||
args = self._get_client_args(service_name=CLIENT_NAME,
|
||||
service_type=self.MONITORING)
|
||||
|
||||
return client.Client(
|
||||
|
@ -68,5 +68,5 @@ class MonascaClientPlugin(client_plugin.ClientPlugin):
|
|||
|
||||
class MonascaNotificationConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
resource_client_name = SERVICE_NAME
|
||||
resource_client_name = CLIENT_NAME
|
||||
resource_getter_name = 'get_notification'
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
|
||||
from heat.engine.clients.os.neutron import neutron_constraints as nc
|
||||
|
||||
CLIENT_NAME = 'neutron'
|
||||
|
||||
|
||||
class LoadbalancerConstraint(nc.NeutronConstraint):
|
||||
resource_name = 'loadbalancer'
|
||||
|
|
|
@ -16,8 +16,11 @@
|
|||
from neutronclient.common import exceptions as qe
|
||||
|
||||
from heat.common import exception
|
||||
from heat.engine.clients.os import nova
|
||||
from heat.engine import constraints
|
||||
|
||||
CLIENT_NAME = 'neutron'
|
||||
|
||||
|
||||
class NetworkConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
|
@ -27,12 +30,12 @@ class NetworkConstraint(constraints.BaseCustomConstraint):
|
|||
|
||||
def validate_with_client(self, client, value):
|
||||
try:
|
||||
client.client('neutron')
|
||||
client.client(CLIENT_NAME)
|
||||
except Exception:
|
||||
# is not using neutron
|
||||
client.client_plugin('nova').get_nova_network_id(value)
|
||||
client.client_plugin(nova.CLIENT_NAME).get_nova_network_id(value)
|
||||
else:
|
||||
neutron_plugin = client.client_plugin('neutron')
|
||||
neutron_plugin = client.client_plugin(CLIENT_NAME)
|
||||
neutron_plugin.find_resourceid_by_name_or_id(
|
||||
'network', value, cmd_resource=None)
|
||||
|
||||
|
@ -46,7 +49,7 @@ class NeutronConstraint(constraints.BaseCustomConstraint):
|
|||
extension = None
|
||||
|
||||
def validate_with_client(self, client, value):
|
||||
neutron_plugin = client.client_plugin('neutron')
|
||||
neutron_plugin = client.client_plugin(CLIENT_NAME)
|
||||
if (self.extension and
|
||||
not neutron_plugin.has_extension(self.extension)):
|
||||
raise exception.EntityNotFound(entity='neutron extension',
|
||||
|
|
|
@ -40,7 +40,7 @@ LOG = logging.getLogger(__name__)
|
|||
|
||||
|
||||
NOVACLIENT_VERSION = "2"
|
||||
SERVICE_NAME = 'nova'
|
||||
CLIENT_NAME = 'nova'
|
||||
|
||||
|
||||
class NovaClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -61,7 +61,7 @@ class NovaClientPlugin(client_plugin.ClientPlugin):
|
|||
service_types = [COMPUTE] = ['compute']
|
||||
|
||||
def _create(self):
|
||||
endpoint_type = self._get_client_option('nova', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
management_url = self.url_for(service_type=self.COMPUTE,
|
||||
endpoint_type=endpoint_type)
|
||||
extensions = nc.discover_extensions(NOVACLIENT_VERSION)
|
||||
|
@ -75,10 +75,10 @@ class NovaClientPlugin(client_plugin.ClientPlugin):
|
|||
'api_key': None,
|
||||
'extensions': extensions,
|
||||
'endpoint_type': endpoint_type,
|
||||
'http_log_debug': self._get_client_option('nova',
|
||||
'http_log_debug': self._get_client_option(CLIENT_NAME,
|
||||
'http_log_debug'),
|
||||
'cacert': self._get_client_option('nova', 'ca_file'),
|
||||
'insecure': self._get_client_option('nova', 'insecure')
|
||||
'cacert': self._get_client_option(CLIENT_NAME, 'ca_file'),
|
||||
'insecure': self._get_client_option(CLIENT_NAME, 'insecure')
|
||||
}
|
||||
|
||||
client = nc.Client(NOVACLIENT_VERSION, **args)
|
||||
|
@ -683,7 +683,7 @@ echo -e '%s\tALL=(ALL)\tNOPASSWD: ALL' >> /etc/sudoers
|
|||
|
||||
class NovaBaseConstraint(constraints.BaseCustomConstraint):
|
||||
|
||||
resource_client_name = SERVICE_NAME
|
||||
resource_client_name = CLIENT_NAME
|
||||
|
||||
|
||||
class ServerConstraint(NovaBaseConstraint):
|
||||
|
|
|
@ -23,7 +23,7 @@ from heat.common.i18n import _
|
|||
from heat.engine.clients import client_plugin
|
||||
from heat.engine import constraints
|
||||
|
||||
SERVICE_NAME = 'sahara'
|
||||
CLIENT_NAME = 'sahara'
|
||||
|
||||
|
||||
class SaharaClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -34,7 +34,7 @@ class SaharaClientPlugin(client_plugin.ClientPlugin):
|
|||
|
||||
def _create(self):
|
||||
con = self.context
|
||||
endpoint_type = self._get_client_option('sahara', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
endpoint = self.url_for(service_type=self.DATA_PROCESSING,
|
||||
endpoint_type=endpoint_type)
|
||||
args = {
|
||||
|
@ -43,8 +43,8 @@ class SaharaClientPlugin(client_plugin.ClientPlugin):
|
|||
'auth_url': con.auth_url,
|
||||
'project_name': con.tenant,
|
||||
'sahara_url': endpoint,
|
||||
'insecure': self._get_client_option('sahara', 'insecure'),
|
||||
'cacert': self._get_client_option('sahara', 'ca_file')
|
||||
'insecure': self._get_client_option(CLIENT_NAME, 'insecure'),
|
||||
'cacert': self._get_client_option(CLIENT_NAME, 'ca_file')
|
||||
}
|
||||
client = sahara_client.Client('1.1', **args)
|
||||
return client
|
||||
|
@ -135,7 +135,7 @@ class SaharaClientPlugin(client_plugin.ClientPlugin):
|
|||
|
||||
|
||||
class SaharaBaseConstraint(constraints.BaseCustomConstraint):
|
||||
resource_client_name = SERVICE_NAME
|
||||
resource_client_name = CLIENT_NAME
|
||||
|
||||
|
||||
class ImageConstraint(SaharaBaseConstraint):
|
||||
|
|
|
@ -17,6 +17,8 @@ from heat.engine import constraints
|
|||
from senlinclient import client
|
||||
from senlinclient.common import exc
|
||||
|
||||
CLIENT_NAME = 'senlin'
|
||||
|
||||
|
||||
class SenlinClientPlugin(client_plugin.ClientPlugin):
|
||||
|
||||
|
@ -41,4 +43,4 @@ class ProfileConstraint(constraints.BaseCustomConstraint):
|
|||
expected_exceptions = (exc.HTTPNotFound,)
|
||||
|
||||
def validate_with_client(self, client, profile):
|
||||
client.client('senlin').get_profile(profile)
|
||||
client.client(CLIENT_NAME).get_profile(profile)
|
||||
|
|
|
@ -29,6 +29,8 @@ IN_PROGRESS = 'in progress'
|
|||
|
||||
MAX_EPOCH = 2147483647
|
||||
|
||||
CLIENT_NAME = 'swift'
|
||||
|
||||
|
||||
class SwiftClientPlugin(client_plugin.ClientPlugin):
|
||||
|
||||
|
@ -39,7 +41,7 @@ class SwiftClientPlugin(client_plugin.ClientPlugin):
|
|||
def _create(self):
|
||||
|
||||
con = self.context
|
||||
endpoint_type = self._get_client_option('swift', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
args = {
|
||||
'auth_version': '2.0',
|
||||
'tenant_name': con.tenant,
|
||||
|
@ -50,8 +52,8 @@ class SwiftClientPlugin(client_plugin.ClientPlugin):
|
|||
'preauthurl': self.url_for(service_type=self.OBJECT_STORE,
|
||||
endpoint_type=endpoint_type),
|
||||
'os_options': {'endpoint_type': endpoint_type},
|
||||
'cacert': self._get_client_option('swift', 'ca_file'),
|
||||
'insecure': self._get_client_option('swift', 'insecure')
|
||||
'cacert': self._get_client_option(CLIENT_NAME, 'ca_file'),
|
||||
'insecure': self._get_client_option(CLIENT_NAME, 'insecure')
|
||||
}
|
||||
return sc.Connection(**args)
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ from heat.common.i18n import _
|
|||
from heat.engine.clients import client_plugin
|
||||
from heat.engine import constraints
|
||||
|
||||
SERVICE_NAME = 'trove'
|
||||
CLIENT_NAME = 'trove'
|
||||
|
||||
|
||||
class TroveClientPlugin(client_plugin.ClientPlugin):
|
||||
|
@ -31,15 +31,15 @@ class TroveClientPlugin(client_plugin.ClientPlugin):
|
|||
def _create(self):
|
||||
|
||||
con = self.context
|
||||
endpoint_type = self._get_client_option('trove', 'endpoint_type')
|
||||
endpoint_type = self._get_client_option(CLIENT_NAME, 'endpoint_type')
|
||||
args = {
|
||||
'service_type': self.DATABASE,
|
||||
'auth_url': con.auth_url or '',
|
||||
'proxy_token': con.auth_token,
|
||||
'username': None,
|
||||
'password': None,
|
||||
'cacert': self._get_client_option('trove', 'ca_file'),
|
||||
'insecure': self._get_client_option('trove', 'insecure'),
|
||||
'cacert': self._get_client_option(CLIENT_NAME, 'ca_file'),
|
||||
'insecure': self._get_client_option(CLIENT_NAME, 'insecure'),
|
||||
'endpoint_type': endpoint_type
|
||||
}
|
||||
|
||||
|
@ -119,5 +119,5 @@ class FlavorConstraint(constraints.BaseCustomConstraint):
|
|||
|
||||
expected_exceptions = (exception.EntityNotFound,)
|
||||
|
||||
resource_client_name = SERVICE_NAME
|
||||
resource_client_name = CLIENT_NAME
|
||||
resource_getter_name = 'get_flavor_id'
|
||||
|
|
|
@ -22,6 +22,8 @@ from zaqarclient.transport import errors as zaqar_errors
|
|||
|
||||
from heat.engine.clients import client_plugin
|
||||
|
||||
CLIENT_NAME = 'zaqar'
|
||||
|
||||
|
||||
class ZaqarClientPlugin(client_plugin.ClientPlugin):
|
||||
|
||||
|
|
Loading…
Reference in New Issue