1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

pin azure deps to exact versions

* added warnings for newer-than-expected versions
* prevent passing api_version and profile for newer clients
This commit is contained in:
Matt Davis 2018-06-05 11:47:34 -07:00 committed by Matt Clay
parent 4fa2fb9c89
commit 980cdbe679
3 changed files with 52 additions and 38 deletions

View file

@ -195,23 +195,23 @@ AZURE_PKG_VERSIONS = {
}, },
'ComputeManagementClient': { 'ComputeManagementClient': {
'package_name': 'compute', 'package_name': 'compute',
'expected_version': '2.0.0' 'expected_version': '2.1.0'
}, },
'ContainerInstanceManagementClient': { 'ContainerInstanceManagementClient': {
'package_name': 'containerinstance', 'package_name': 'containerinstance',
'expected_version': '0.3.1' 'expected_version': '0.4.0'
}, },
'NetworkManagementClient': { 'NetworkManagementClient': {
'package_name': 'network', 'package_name': 'network',
'expected_version': '1.3.0' 'expected_version': '1.7.1'
}, },
'ResourceManagementClient': { 'ResourceManagementClient': {
'package_name': 'resource', 'package_name': 'resource',
'expected_version': '1.1.0' 'expected_version': '1.2.2'
}, },
'DnsManagementClient': { 'DnsManagementClient': {
'package_name': 'dns', 'package_name': 'dns',
'expected_version': '1.0.1' 'expected_version': '1.2.0'
}, },
'WebSiteManagementClient': { 'WebSiteManagementClient': {
'package_name': 'web', 'package_name': 'web',
@ -408,8 +408,11 @@ class AzureRMModuleBase(object):
return return
expected_version = package_version.get('expected_version') expected_version = package_version.get('expected_version')
if Version(client_version) < Version(expected_version): if Version(client_version) < Version(expected_version):
self.fail("Installed azure-mgmt-{0} client version is {1}. The supported version is {2}. Try " self.fail("Installed azure-mgmt-{0} client version is {1}. The minimum supported version is {2}. Try "
"`pip install ansible[azure]`".format(client_name, client_version, expected_version)) "`pip install ansible[azure]`".format(client_name, client_version, expected_version))
if Version(client_version) != Version(expected_version):
self.module.warn("Installed azure-mgmt-{0} client version is {1}. The expected version is {2}. Try "
"`pip install ansible[azure]`".format(client_name, client_version, expected_version))
def exec_module(self, **kwargs): def exec_module(self, **kwargs):
self.fail("Error: {0} failed to implement exec_module method.".format(self.__class__.__name__)) self.fail("Error: {0} failed to implement exec_module method.".format(self.__class__.__name__))
@ -945,6 +948,9 @@ class AzureRMModuleBase(object):
profile_default_version = api_profile_dict.get('default_api_version', None) profile_default_version = api_profile_dict.get('default_api_version', None)
if api_version or profile_default_version: if api_version or profile_default_version:
client_kwargs['api_version'] = api_version or profile_default_version client_kwargs['api_version'] = api_version or profile_default_version
if 'profile' in client_kwargs:
# remove profile; only pass API version if specified
client_kwargs.pop('profile')
client = client_type(**client_kwargs) client = client_type(**client_kwargs)

View file

@ -1,19 +1,23 @@
packaging packaging
requests[security] requests[security]
azure-mgmt-compute>=2.0.0,<3 azure-cli-core==2.0.35
azure-mgmt-network>=1.3.0,<2 azure-cli-nspkg==3.0.2
azure-mgmt-storage>=1.5.0,<2 azure-common==1.1.11
azure-mgmt-resource>=1.1.0,<2 azure-mgmt-batch==4.1.0
azure-storage>=0.35.1,<0.36 azure-mgmt-compute==2.1.0
azure-cli-core>=2.0.12,<3
msrest!=0.4.15
msrestazure>=0.4.11,<0.5
azure-mgmt-dns>=1.0.1,<2
azure-mgmt-keyvault>=0.40.0,<0.41
azure-mgmt-batch>=4.1.0,<5
azure-mgmt-sql>=0.7.1,<0.8
azure-mgmt-web>=0.32.0,<0.33
azure-mgmt-containerservice>=3.0.1
azure-mgmt-containerregistry>=1.0.1
azure-mgmt-rdbms>=0.2.0rc1,<0.3.0
azure-mgmt-containerinstance==0.4.0 azure-mgmt-containerinstance==0.4.0
azure-mgmt-containerregistry==2.0.0
azure-mgmt-containerservice==3.0.1
azure-mgmt-dns==1.2.0
azure-mgmt-keyvault==0.40.0
azure-mgmt-network==1.7.1
azure-mgmt-nspkg==2.0.0
azure-mgmt-rdbms==0.2.0rc1
azure-mgmt-resource==1.2.2
azure-mgmt-sql==0.7.1
azure-mgmt-storage==1.5.0
azure-mgmt-web==0.32.0
azure-nspkg==2.0.0
azure-storage==0.35.1
msrest==0.4.29
msrestazure==0.4.31

View file

@ -1,19 +1,23 @@
packaging packaging
requests[security] requests[security]
azure-mgmt-compute>=2.0.0,<3 azure-cli-core==2.0.35
azure-mgmt-network>=1.3.0,<2 azure-cli-nspkg==3.0.2
azure-mgmt-storage>=1.5.0,<2 azure-common==1.1.11
azure-mgmt-resource>=1.1.0,<2 azure-mgmt-batch==4.1.0
azure-storage>=0.35.1,<0.36 azure-mgmt-compute==2.1.0
azure-cli-core>=2.0.12,<3
msrest!=0.4.15
msrestazure>=0.4.11,<0.5
azure-mgmt-dns>=1.0.1,<2
azure-mgmt-keyvault>=0.40.0,<0.41
azure-mgmt-batch>=4.1.0,<5
azure-mgmt-sql>=0.7.1,<0.8
azure-mgmt-web>=0.32.0,<0.33
azure-mgmt-containerservice>=3.0.1
azure-mgmt-containerregistry>=1.0.1
azure-mgmt-rdbms>=0.2.0rc1,<0.3.0
azure-mgmt-containerinstance==0.4.0 azure-mgmt-containerinstance==0.4.0
azure-mgmt-containerregistry==2.0.0
azure-mgmt-containerservice==3.0.1
azure-mgmt-dns==1.2.0
azure-mgmt-keyvault==0.40.0
azure-mgmt-network==1.7.1
azure-mgmt-nspkg==2.0.0
azure-mgmt-rdbms==0.2.0rc1
azure-mgmt-resource==1.2.2
azure-mgmt-sql==0.7.1
azure-mgmt-storage==1.5.0
azure-mgmt-web==0.32.0
azure-nspkg==2.0.0
azure-storage==0.35.1
msrest==0.4.29
msrestazure==0.4.31