class Connection(
_services_mixin.ServicesMixin,
_cloud._OpenStackCloudMixin,
_accelerator.AcceleratorCloudMixin,
_baremetal.BaremetalCloudMixin,
_block_storage.BlockStorageCloudMixin,
_compute.ComputeCloudMixin,
_clustering.ClusteringCloudMixin,
_coe.CoeCloudMixin,
_dns.DnsCloudMixin,
_floating_ip.FloatingIPCloudMixin,
_identity.IdentityCloudMixin,
_image.ImageCloudMixin,
_network.NetworkCloudMixin,
_network_common.NetworkCommonCloudMixin,
_object_store.ObjectStoreCloudMixin,
_orchestration.OrchestrationCloudMixin,
_security_group.SecurityGroupCloudMixin,
_shared_file_system.SharedFileSystemCloudMixin,
):
def __init__(self, cloud=None,
config=None, session=None,
app_name=None,
app_version=None,
extra_services=None,
strict=False,
use_direct_get=False,
task_manager=None,
rate_limit=None,
oslo_conf=None,
service_types=None,
global_request_id=None,
strict_proxies=False,
pool_executor=None,
**kwargs):
self.config = config
self._extra_services = {}
self._strict_proxies = strict_proxies
if extra_services:
for service in extra_services:
self._extra_services[service.service_type] = service
if not self.config:
if oslo_conf:
self.config =
cloud_region.from_conf(
oslo_conf, session=session,
app_name=app_name,
app_version=app_version,
service_types=service_types)
elif session:
self.config =
cloud_region.from_session(
session=session,
app_name=app_name,
app_version=app_version,
load_yaml_config=False,
load_envvars=False,
rate_limit=rate_limit,
**kwargs)
else:
self.config =
_config.get_cloud_region(
cloud=cloud,
app_name=app_name,
app_version=app_version,
load_yaml_config=cloud is not None,
load_envvars=cloud is not None,
rate_limit=rate_limit,
**kwargs)
self._session = None
self._proxies = {}
self.__pool_executor = pool_executor
self._global_request_id =
global_request_id
self.use_direct_get = use_direct_get
self.strict_mode = strict
# Call the _*CloudMixin constructors
while we work on
# integrating things better.
_cloud._OpenStackCloudMixin.__init__(self)
_accelerator.AcceleratorCloudMixin.__init__(self)
_baremetal.BaremetalCloudMixin.__init__(self)
_block_storage.BlockStorageCloudMixin.__init__(self)
_clustering.ClusteringCloudMixin.__init__(self)
_coe.CoeCloudMixin.__init__(self)
_compute.ComputeCloudMixin.__init__(self)
_dns.DnsCloudMixin.__init__(self)
_floating_ip.FloatingIPCloudMixin.__init__(self)
_identity.IdentityCloudMixin.__init__(self)
_image.ImageCloudMixin.__init__(self)
_network_common.NetworkCommonCloudMixin.__init__(self)
_network.NetworkCloudMixin.__init__(self)
_object_store.ObjectStoreCloudMixin.__init__(self)
_orchestration.OrchestrationCloudMixin.__init__(self)
_security_group.SecurityGroupCloudMixin.__init__(self)
_shared_file_system.SharedFileSystemCloudMixin.__init__(self)
vendor_hook = kwargs.get('vendor_hook')
if not vendor_hook and 'vendor_hook'
in self.config.config:
vendor_hook =
self.config.config.get('vendor_hook')
if vendor_hook:
try:
try:
(package_name, function) = vendor_hook.rsplit(':')
if package_name and function:
ep = importlib_metadata.EntryPoint(
name='vendor_hook',
value=vendor_hook,
group='vendor_hook',
)
hook = ep.load()
hook(self)
except ValueError:
self.log.warning('Hook should be in the entrypoint '
'module:attribute format')
except (ImportError, TypeError,
AttributeError) as e:
self.log.warning('Configured hook %s cannot be executed: %s',
vendor_hook, e)
if (self.config._influxdb_config
and 'additional_metric_tags' in self.config.config):
self.config._influxdb_config['additional_metric_tags'] = \
self.config.config['additional_metric_tags']