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

Bump dependency versions to avoid conflicts (#54443)

* Bump dependency versions to avoid conflicts

* Fix module code to support newer SDK packages

* Fix keyvault module are upgrading deps
This commit is contained in:
Jordan Borean 2019-04-03 05:40:52 +10:00 committed by GitHub
parent ea2fa07e23
commit 8b1b22ddc7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 78 additions and 57 deletions

View file

@ -67,7 +67,7 @@ AZURE_API_PROFILES = {
'NetworkManagementClient': '2018-08-01',
'ResourceManagementClient': '2017-05-10',
'StorageManagementClient': '2017-10-01',
'WebsiteManagementClient': '2016-08-01',
'WebSiteManagementClient': '2018-02-01',
'PostgreSQLManagementClient': '2017-12-01',
'MySQLManagementClient': '2017-12-01',
'MariaDBManagementClient': '2019-03-01'
@ -235,7 +235,7 @@ AZURE_PKG_VERSIONS = {
},
'WebSiteManagementClient': {
'package_name': 'web',
'expected_version': '0.32.0'
'expected_version': '0.41.0'
},
'TrafficManagerManagementClient': {
'package_name': 'trafficmanager',
@ -870,7 +870,7 @@ class AzureRMModuleBase(object):
if not self._web_client:
self._web_client = self.get_mgmt_svc_client(WebSiteManagementClient,
base_url=self._cloud_environment.endpoints.resource_manager,
api_version='2016-08-01')
api_version='2018-02-01')
return self._web_client
@property

View file

@ -192,7 +192,8 @@ class AzureRMFunctionApp(AzureRMModuleBase):
resource_group_name=self.resource_group,
name=self.name
)
exists = True
# Newer SDK versions (0.40.0+) seem to return None if it doesn't exist instead of raising CloudError
exists = function_app is not None
except CloudError as exc:
exists = False

View file

@ -190,8 +190,8 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from azure.mgmt.keyvault import KeyVaultManagementClient
from msrest.polling import LROPoller
from msrest.serialization import Model
except ImportError:
# This is handled in azure_rm_common
@ -325,7 +325,8 @@ class AzureRMVaults(AzureRMModuleBase):
response = None
self.mgmt_client = self.get_mgmt_svc_client(KeyVaultManagementClient,
base_url=self._cloud_environment.endpoints.resource_manager)
base_url=self._cloud_environment.endpoints.resource_manager,
api_version="2018-02-14")
resource_group = self.get_resource_group(self.resource_group)
@ -448,7 +449,7 @@ class AzureRMVaults(AzureRMModuleBase):
response = self.mgmt_client.vaults.create_or_update(resource_group_name=self.resource_group,
vault_name=self.vault_name,
parameters=self.parameters)
if isinstance(response, AzureOperationPoller):
if isinstance(response, LROPoller):
response = self.get_poller_result(response)
except CloudError as exc:

View file

@ -286,7 +286,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from msrest.polling import LROPoller
from msrest.serialization import Model
from azure.mgmt.web.models import (
site_config, app_service_plan, Site,
@ -671,7 +671,7 @@ class AzureRMWebApps(AzureRMModuleBase):
if self.app_settings:
app_settings = []
for key in self.app_settings.keys():
app_settings.append(NameValuePair(key, self.app_settings[key]))
app_settings.append(NameValuePair(name=key, value=self.app_settings[key]))
self.site_config['app_settings'] = app_settings
else:
@ -707,7 +707,7 @@ class AzureRMWebApps(AzureRMModuleBase):
# purge existing app_settings:
if self.purge_app_settings:
to_be_updated = True
self.app_settings_strDic.properties = dict()
self.app_settings_strDic = dict()
self.to_do.append(Actions.UpdateAppSettings)
# check if app settings changed
@ -717,7 +717,7 @@ class AzureRMWebApps(AzureRMModuleBase):
if self.app_settings:
for key in self.app_settings.keys():
self.app_settings_strDic.properties[key] = self.app_settings[key]
self.app_settings_strDic[key] = self.app_settings[key]
elif self.state == 'absent':
if old_response:
@ -772,7 +772,8 @@ class AzureRMWebApps(AzureRMModuleBase):
# compare existing web app with input, determine weather it's update operation
def is_updatable_property_changed(self, existing_webapp):
for property_name in self.updatable_properties:
if hasattr(self, property_name) and getattr(self, property_name) != existing_webapp.get(property_name, None):
if hasattr(self, property_name) and getattr(self, property_name) is not None and \
getattr(self, property_name) != existing_webapp.get(property_name, None):
return True
return False
@ -790,9 +791,9 @@ class AzureRMWebApps(AzureRMModuleBase):
# comparing existing app setting with input, determine whether it's changed
def is_app_settings_changed(self):
if self.app_settings:
if self.app_settings_strDic.properties:
if self.app_settings_strDic:
for key in self.app_settings.keys():
if self.app_settings[key] != self.app_settings_strDic.properties.get(key, None):
if self.app_settings[key] != self.app_settings_strDic.get(key, None):
return True
else:
return True
@ -831,7 +832,7 @@ class AzureRMWebApps(AzureRMModuleBase):
skip_custom_domain_verification=self.skip_custom_domain_verification,
force_dns_registration=force_dns_registration,
ttl_in_seconds=self.ttl_in_seconds)
if isinstance(response, AzureOperationPoller):
if isinstance(response, LROPoller):
response = self.get_poller_result(response)
except CloudError as exc:
@ -872,13 +873,17 @@ class AzureRMWebApps(AzureRMModuleBase):
response = self.web_client.web_apps.get(resource_group_name=self.resource_group,
name=self.name)
self.log("Response : {0}".format(response))
self.log("Web App instance : {0} found".format(response.name))
return webapp_to_dict(response)
# Newer SDK versions (0.40.0+) seem to return None if it doesn't exist instead of raising CloudError
if response is not None:
self.log("Response : {0}".format(response))
self.log("Web App instance : {0} found".format(response.name))
return webapp_to_dict(response)
except CloudError as ex:
self.log("Didn't find web app {0} in resource group {1}".format(
self.name, self.resource_group))
pass
self.log("Didn't find web app {0} in resource group {1}".format(
self.name, self.resource_group))
return False
@ -891,14 +896,20 @@ class AzureRMWebApps(AzureRMModuleBase):
try:
response = self.web_client.app_service_plans.get(
self.plan['resource_group'], self.plan['name'])
self.log("Response : {0}".format(response))
self.log("App Service Plan : {0} found".format(response.name))
resource_group_name=self.plan['resource_group'],
name=self.plan['name'])
return appserviceplan_to_dict(response)
# Newer SDK versions (0.40.0+) seem to return None if it doesn't exist instead of raising CloudError
if response is not None:
self.log("Response : {0}".format(response))
self.log("App Service Plan : {0} found".format(response.name))
return appserviceplan_to_dict(response)
except CloudError as ex:
self.log("Didn't find app service plan {0} in resource group {1}".format(
self.plan['name'], self.plan['resource_group']))
pass
self.log("Didn't find app service plan {0} in resource group {1}".format(
self.plan['name'], self.plan['resource_group']))
return False
@ -921,7 +932,7 @@ class AzureRMWebApps(AzureRMModuleBase):
poller = self.web_client.app_service_plans.create_or_update(
self.plan['resource_group'], self.plan['name'], plan_def)
if isinstance(poller, AzureOperationPoller):
if isinstance(poller, LROPoller):
response = self.get_poller_result(poller)
self.log("Response : {0}".format(response))
@ -944,7 +955,7 @@ class AzureRMWebApps(AzureRMModuleBase):
resource_group_name=self.resource_group, name=self.name)
self.log("Response : {0}".format(response))
return response
return response.properties
except CloudError as ex:
self.fail("Failed to list application settings for web app {0} in resource group {1}: {2}".format(
self.name, self.resource_group, str(ex)))
@ -958,7 +969,7 @@ class AzureRMWebApps(AzureRMModuleBase):
try:
response = self.web_client.web_apps.update_application_settings(
resource_group_name=self.resource_group, name=self.name, app_settings=self.app_settings_strDic)
resource_group_name=self.resource_group, name=self.name, properties=self.app_settings_strDic)
self.log("Response : {0}".format(response))
return response

View file

@ -149,7 +149,7 @@ webapps:
'''
try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from msrest.polling import LROPoller
from azure.common import AzureMissingResourceHttpError, AzureHttpError
except Exception:
# This is handled in azure_rm_common
@ -277,7 +277,7 @@ class AzureRMWebAppFacts(AzureRMModuleBase):
self.log('Get web app {0} publish credentials'.format(name))
try:
poller = self.web_client.web_apps.list_publishing_credentials(resource_group, name)
if isinstance(poller, AzureOperationPoller):
if isinstance(poller, LROPoller):
response = self.get_poller_result(poller)
except CloudError as ex:
request_id = ex.request_id if ex.request_id else ''

View file

@ -224,7 +224,7 @@ from ansible.module_utils.azure_rm_common import AzureRMModuleBase
try:
from msrestazure.azure_exceptions import CloudError
from msrestazure.azure_operation import AzureOperationPoller
from msrest.polling import LROPoller
from msrest.serialization import Model
from azure.mgmt.web.models import (
site_config, app_service_plan, Site,
@ -563,7 +563,7 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
if self.app_settings:
app_settings = []
for key in self.app_settings.keys():
app_settings.append(NameValuePair(key, self.app_settings[key]))
app_settings.append(NameValuePair(name=key, value=self.app_settings[key]))
self.site_config['app_settings'] = app_settings
@ -595,7 +595,7 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
if self.purge_app_settings:
to_be_updated = True
self.to_do = Actions.UpdateAppSettings
self.app_settings_strDic.properties = dict()
self.app_settings_strDic = dict()
# check if app settings changed
if self.purge_app_settings or self.is_app_settings_changed():
@ -604,7 +604,7 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
if self.app_settings:
for key in self.app_settings.keys():
self.app_settings_strDic.properties[key] = self.app_settings[key]
self.app_settings_strDic[key] = self.app_settings[key]
elif self.state == 'absent':
if old_response:
@ -682,10 +682,10 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
# comparing existing app setting with input, determine whether it's changed
def is_app_settings_changed(self):
if self.app_settings:
if len(self.app_settings_strDic.properties) != len(self.app_settings):
if len(self.app_settings_strDic) != len(self.app_settings):
return True
if self.app_settings_strDic.properties != self.app_settings:
if self.app_settings_strDic != self.app_settings:
return True
return False
@ -716,7 +716,7 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
slot=self.name,
name=self.webapp_name,
site_envelope=self.site)
if isinstance(response, AzureOperationPoller):
if isinstance(response, LROPoller):
response = self.get_poller_result(response)
except CloudError as exc:
@ -757,13 +757,17 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
response = self.web_client.web_apps.get(resource_group_name=self.resource_group,
name=self.webapp_name)
self.log("Response : {0}".format(response))
self.log("Web App instance : {0} found".format(response.name))
return webapp_to_dict(response)
# Newer SDK versions (0.40.0+) seem to return None if it doesn't exist instead of raising CloudError
if response is not None:
self.log("Response : {0}".format(response))
self.log("Web App instance : {0} found".format(response.name))
return webapp_to_dict(response)
except CloudError as ex:
self.log("Didn't find web app {0} in resource group {1}".format(
self.webapp_name, self.resource_group))
pass
self.log("Didn't find web app {0} in resource group {1}".format(
self.webapp_name, self.resource_group))
return False
@ -783,12 +787,16 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
name=self.webapp_name,
slot=self.name)
self.log("Response : {0}".format(response))
self.log("Web App slot: {0} found".format(response.name))
return slot_to_dict(response)
# Newer SDK versions (0.40.0+) seem to return None if it doesn't exist instead of raising CloudError
if response is not None:
self.log("Response : {0}".format(response))
self.log("Web App slot: {0} found".format(response.name))
return slot_to_dict(response)
except CloudError as ex:
self.log("Does not find web app slot {0} in resource group {1}".format(self.name, self.resource_group))
pass
self.log("Does not find web app slot {0} in resource group {1}".format(self.name, self.resource_group))
return False
@ -805,7 +813,7 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
resource_group_name=self.resource_group, name=self.webapp_name)
self.log("Response : {0}".format(response))
return response
return response.properties
except CloudError as ex:
self.fail("Failed to list application settings for web app {0} in resource group {1}: {2}".format(
self.name, self.resource_group, str(ex)))
@ -823,7 +831,7 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
resource_group_name=self.resource_group, name=self.webapp_name, slot=slot_name)
self.log("Response : {0}".format(response))
return response
return response.properties
except CloudError as ex:
self.fail("Failed to list application settings for web app slot {0} in resource group {1}: {2}".format(
self.name, self.resource_group, str(ex)))
@ -844,7 +852,7 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
name=self.webapp_name,
slot=slot_name,
kind=None,
app_settings=app_settings)
properties=app_settings)
self.log("Response : {0}".format(response))
return response.as_dict()
@ -1028,7 +1036,7 @@ class AzureRMWebAppSlots(AzureRMModuleBase):
app_setting_clone_from = self.list_app_settings_slot(src_slot)
if self.app_settings:
app_setting_clone_from.properties.update(self.app_settings)
app_setting_clone_from.update(self.app_settings)
self.update_app_settings_slot(app_settings=app_setting_clone_from)

View file

@ -4,14 +4,14 @@ azure-cli-core==2.0.35
azure-cli-nspkg==3.0.2
azure-common==1.1.11
azure-mgmt-authorization==0.51.1
azure-mgmt-batch==4.1.0
azure-mgmt-batch==5.0.1
azure-mgmt-cdn==3.0.0
azure-mgmt-compute==4.4.0
azure-mgmt-containerinstance==1.4.0
azure-mgmt-containerregistry==2.0.0
azure-mgmt-containerservice==4.4.0
azure-mgmt-dns==2.1.0
azure-mgmt-keyvault==0.40.0
azure-mgmt-keyvault==1.1.0
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-monitor==0.5.2
azure-mgmt-network==2.3.0
@ -23,7 +23,7 @@ azure-mgmt-servicebus==0.5.3
azure-mgmt-sql==0.10.0
azure-mgmt-storage==3.1.0
azure-mgmt-trafficmanager==0.50.0
azure-mgmt-web==0.32.0
azure-mgmt-web==0.41.0
azure-nspkg==2.0.0
azure-storage==0.35.1
msrest==0.6.1

View file

@ -4,14 +4,14 @@ azure-cli-core==2.0.35
azure-cli-nspkg==3.0.2
azure-common==1.1.11
azure-mgmt-authorization==0.51.1
azure-mgmt-batch==4.1.0
azure-mgmt-batch==5.0.1
azure-mgmt-cdn==3.0.0
azure-mgmt-compute==4.4.0
azure-mgmt-containerinstance==1.4.0
azure-mgmt-containerregistry==2.0.0
azure-mgmt-containerservice==4.4.0
azure-mgmt-dns==2.1.0
azure-mgmt-keyvault==0.40.0
azure-mgmt-keyvault==1.1.0
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-monitor==0.5.2
azure-mgmt-network==2.3.0
@ -23,7 +23,7 @@ azure-mgmt-servicebus==0.5.3
azure-mgmt-sql==0.10.0
azure-mgmt-storage==3.1.0
azure-mgmt-trafficmanager==0.50.0
azure-mgmt-web==0.32.0
azure-mgmt-web==0.41.0
azure-nspkg==2.0.0
azure-storage==0.35.1
msrest==0.6.1