loosen azure sdk dependencies in azurearm cloud driver

Remove dependency to azure-cli, which is not used at all.
Use azure-storage-sdk as fallback if multiapi version is not available.
This commit is contained in:
Joachim Gleissner 2018-09-18 15:07:13 +02:00
parent e636dacc35
commit bad28b65cd
No known key found for this signature in database
GPG Key ID: 2CFC8E8FA3EE5BB7

View File

@ -60,6 +60,7 @@ import logging
import pprint
import base64
import collections
import pkgutil
import salt.cache
import salt.config as config
import salt.utils.cloud
@ -117,9 +118,12 @@ try:
from azure.mgmt.storage import StorageManagementClient
from azure.mgmt.web import WebSiteManagementClient
from msrestazure.azure_exceptions import CloudError
from azure.multiapi.storage.v2016_05_31 import CloudStorageAccount
from azure.cli import core
HAS_LIBS = LooseVersion(core.__version__) >= LooseVersion("2.0.12")
if pkgutil.find_loader('azure.multiapi'):
# use multiapi version if available
from azure.multiapi.storage.v2016_05_31 import CloudStorageAccount
else:
from azure.storage import CloudStorageAccount
HAS_LIBS = True
except ImportError:
pass
# pylint: enable=wrong-import-position,wrong-import-order
@ -152,8 +156,7 @@ def __virtual__():
False,
'The following dependencies are required to use the AzureARM driver: '
'Microsoft Azure SDK for Python >= 2.0rc5, '
'Microsoft Azure Storage SDK for Python >= 0.32, '
'Microsoft Azure CLI >= 2.0.12'
'Microsoft Azure Storage SDK for Python >= 0.32'
)
global cache # pylint: disable=global-statement,invalid-name