ff3dbe1ea9
OBS-URL: https://build.opensuse.org/package/show/systemsmanagement:saltstack/salt?expand=0&rev=131
64 lines
2.2 KiB
Diff
64 lines
2.2 KiB
Diff
From 9d9fb3fd787b40d9d27ad7c5eb69fa0cd4f5a304 Mon Sep 17 00:00:00 2001
|
|
From: Joachim Gleissner <jgleissner@suse.com>
|
|
Date: Tue, 18 Sep 2018 15:07:13 +0200
|
|
Subject: [PATCH] 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.
|
|
|
|
remove unused import from azurearm driver
|
|
---
|
|
salt/cloud/clouds/azurearm.py | 14 ++++++++------
|
|
1 file changed, 8 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/salt/cloud/clouds/azurearm.py b/salt/cloud/clouds/azurearm.py
|
|
index 8b9a9e8903..50e5ce1f62 100644
|
|
--- a/salt/cloud/clouds/azurearm.py
|
|
+++ b/salt/cloud/clouds/azurearm.py
|
|
@@ -67,6 +67,7 @@ import logging
|
|
import pprint
|
|
import base64
|
|
import collections
|
|
+import pkgutil
|
|
import salt.cache
|
|
import salt.config as config
|
|
import salt.utils.cloud
|
|
@@ -74,7 +75,6 @@ import salt.utils.data
|
|
import salt.utils.files
|
|
import salt.utils.stringutils
|
|
import salt.utils.yaml
|
|
-from salt.utils.versions import LooseVersion
|
|
from salt.ext import six
|
|
import salt.version
|
|
from salt.exceptions import (
|
|
@@ -125,9 +125,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
|
|
@@ -160,8 +163,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
|
|
--
|
|
2.17.1
|
|
|
|
|