diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 06:22:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-26 06:22:20 +0000 |
commit | 18bd2207b6c1977e99a93673a7be099e23f0f547 (patch) | |
tree | 40fd9e5913462a88be6ba24be6953383c5b39874 /ansible_collections/azure/azcollection/plugins/module_utils | |
parent | Releasing progress-linux version 10.0.1+dfsg-1~progress7.99u1. (diff) | |
download | ansible-18bd2207b6c1977e99a93673a7be099e23f0f547.tar.xz ansible-18bd2207b6c1977e99a93673a7be099e23f0f547.zip |
Merging upstream version 10.1.0+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ansible_collections/azure/azcollection/plugins/module_utils')
-rw-r--r-- | ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py b/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py index 79b5167b1..c747fc72c 100644 --- a/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py +++ b/ansible_collections/azure/azcollection/plugins/module_utils/azure_rm_common.py @@ -279,8 +279,6 @@ try: except ImportError: import azure.mgmt.recoveryservicesbackup.activestamp.models as RecoveryServicesBackupModels from azure.mgmt.search import SearchManagementClient - from azure.mgmt.datalake.store import DataLakeStoreAccountManagementClient - import azure.mgmt.datalake.store.models as DataLakeStoreAccountModel from azure.mgmt.notificationhubs import NotificationHubsManagementClient from azure.mgmt.eventhub import EventHubManagementClient from azure.mgmt.datafactory import DataFactoryManagementClient @@ -704,6 +702,12 @@ class AzureRMModuleBase(object): account = self.storage_client.storage_accounts.get_properties(resource_group_name=resource_group_name, account_name=storage_account_name) if auth_mode == 'login' and self.azure_auth.credentials.get('credential'): credential = self.azure_auth.credentials['credential'] + elif (auth_mode == 'login' and self.azure_auth.credentials.get('tenant') + and self.azure_auth.credentials.get('client_id') + and self.azure_auth.credentials.get('secret')): + credential = client_secret.ClientSecretCredential(tenant_id=self.azure_auth.credentials.get('tenant'), + client_id=self.azure_auth.credentials.get('client_id'), + client_secret=self.azure_auth.credentials.get('secret')) else: account_keys = self.storage_client.storage_accounts.list_keys(resource_group_name=resource_group_name, account_name=storage_account_name) credential = account_keys.keys[0].value @@ -947,11 +951,17 @@ class AzureRMModuleBase(object): def _ansible_get_models(self, *arg, **kwarg): return self._ansible_models - setattr(client, '_ansible_models', importlib.import_module(client_type.__module__).models) + try: + setattr(client, '_ansible_models', importlib.import_module(client_type.__module__).models) + except AttributeError: + setattr(client, '_ansible_models', importlib.import_module(client_type.__module__)._models) client.models = types.MethodType(_ansible_get_models, client) if self.azure_auth._cert_validation_mode == 'ignore': - client._config.session_configuration_callback = self._validation_ignore_callback + if hasattr(client, '_config'): + client._config.session_configuration_callback = self._validation_ignore_callback + else: + client.config.session_configuration_callback = self._validation_ignore_callback return client @@ -1361,19 +1371,6 @@ class AzureRMModuleBase(object): return self._search_client @property - def datalake_store_client(self): - self.log('Getting datalake store client...') - if not self._datalake_store_client: - self._datalake_store_client = self.get_mgmt_svc_client(DataLakeStoreAccountManagementClient, - base_url=self._cloud_environment.endpoints.resource_manager, - api_version='2016-11-01') - return self._datalake_store_client - - @property - def datalake_store_models(self): - return DataLakeStoreAccountModel - - @property def notification_hub_client(self): self.log('Getting notification hub client') if not self._notification_hub_client: |