mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fix webapp test (#47546)
This commit is contained in:
parent
b4a9b29ab2
commit
1587bb9f65
4 changed files with 40 additions and 9 deletions
|
@ -355,6 +355,38 @@ def get_sku_name(tier):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
def appserviceplan_to_dict(plan):
|
||||||
|
return dict(
|
||||||
|
id=plan.id,
|
||||||
|
name=plan.name,
|
||||||
|
kind=plan.kind,
|
||||||
|
location=plan.location,
|
||||||
|
reserved=plan.reserved,
|
||||||
|
is_linux=plan.reserved,
|
||||||
|
provisioning_state=plan.provisioning_state,
|
||||||
|
tags=plan.tags if plan.tags else None
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
def webapp_to_dict(webapp):
|
||||||
|
return dict(
|
||||||
|
id=webapp.id,
|
||||||
|
name=webapp.name,
|
||||||
|
location=webapp.location,
|
||||||
|
client_cert_enabled=webapp.client_cert_enabled,
|
||||||
|
enabled=webapp.enabled,
|
||||||
|
reserved=webapp.reserved,
|
||||||
|
client_affinity_enabled=webapp.client_affinity_enabled,
|
||||||
|
server_farm_id=webapp.server_farm_id,
|
||||||
|
host_names_disabled=webapp.host_names_disabled,
|
||||||
|
https_only=webapp.https_only if hasattr(webapp, 'https_only') else None,
|
||||||
|
skip_custom_domain_verification=webapp.skip_custom_domain_verification if hasattr(webapp, 'skip_custom_domain_verification') else None,
|
||||||
|
ttl_in_seconds=webapp.ttl_in_seconds if hasattr(webapp, 'ttl_in_seconds') else None,
|
||||||
|
state=webapp.state,
|
||||||
|
tags=webapp.tags if webapp.tags else None
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class Actions:
|
class Actions:
|
||||||
NoAction, CreateOrUpdate, UpdateAppSettings, Delete = range(4)
|
NoAction, CreateOrUpdate, UpdateAppSettings, Delete = range(4)
|
||||||
|
|
||||||
|
@ -631,8 +663,8 @@ class AzureRMWebApps(AzureRMModuleBase):
|
||||||
self.site.server_farm_id = old_plan['id']
|
self.site.server_farm_id = old_plan['id']
|
||||||
|
|
||||||
# if linux, setup startup_file
|
# if linux, setup startup_file
|
||||||
if old_plan.get('is_linux'):
|
if old_plan['is_linux']:
|
||||||
if self.startup_file:
|
if hasattr(self, 'startup_file'):
|
||||||
self.site_config['app_command_line'] = self.startup_file
|
self.site_config['app_command_line'] = self.startup_file
|
||||||
|
|
||||||
# set app setting
|
# set app setting
|
||||||
|
@ -803,7 +835,7 @@ class AzureRMWebApps(AzureRMModuleBase):
|
||||||
self.log('Error attempting to create the Web App instance.')
|
self.log('Error attempting to create the Web App instance.')
|
||||||
self.fail(
|
self.fail(
|
||||||
"Error creating the Web App instance: {0}".format(str(exc)))
|
"Error creating the Web App instance: {0}".format(str(exc)))
|
||||||
return response.as_dict()
|
return webapp_to_dict(response)
|
||||||
|
|
||||||
def delete_webapp(self):
|
def delete_webapp(self):
|
||||||
'''
|
'''
|
||||||
|
@ -839,7 +871,7 @@ class AzureRMWebApps(AzureRMModuleBase):
|
||||||
|
|
||||||
self.log("Response : {0}".format(response))
|
self.log("Response : {0}".format(response))
|
||||||
self.log("Web App instance : {0} found".format(response.name))
|
self.log("Web App instance : {0} found".format(response.name))
|
||||||
return response.as_dict()
|
return webapp_to_dict(response)
|
||||||
|
|
||||||
except CloudError as ex:
|
except CloudError as ex:
|
||||||
self.log("Didn't find web app {0} in resource group {1}".format(
|
self.log("Didn't find web app {0} in resource group {1}".format(
|
||||||
|
@ -860,7 +892,7 @@ class AzureRMWebApps(AzureRMModuleBase):
|
||||||
self.log("Response : {0}".format(response))
|
self.log("Response : {0}".format(response))
|
||||||
self.log("App Service Plan : {0} found".format(response.name))
|
self.log("App Service Plan : {0} found".format(response.name))
|
||||||
|
|
||||||
return response.as_dict()
|
return appserviceplan_to_dict(response)
|
||||||
except CloudError as ex:
|
except CloudError as ex:
|
||||||
self.log("Didn't find app service plan {0} in resource group {1}".format(
|
self.log("Didn't find app service plan {0} in resource group {1}".format(
|
||||||
self.plan['name'], self.plan['resource_group']))
|
self.plan['name'], self.plan['resource_group']))
|
||||||
|
@ -891,7 +923,7 @@ class AzureRMWebApps(AzureRMModuleBase):
|
||||||
|
|
||||||
self.log("Response : {0}".format(response))
|
self.log("Response : {0}".format(response))
|
||||||
|
|
||||||
return response.as_dict()
|
return appserviceplan_to_dict(response)
|
||||||
except CloudError as ex:
|
except CloudError as ex:
|
||||||
self.fail("Failed to create app service plan {0} in resource group {1}: {2}".format(
|
self.fail("Failed to create app service plan {0} in resource group {1}: {2}".format(
|
||||||
self.plan['name'], self.plan['resource_group'], str(ex)))
|
self.plan['name'], self.plan['resource_group'], str(ex)))
|
||||||
|
|
|
@ -4,7 +4,7 @@ azure-cli-core==2.0.35
|
||||||
azure-cli-nspkg==3.0.2
|
azure-cli-nspkg==3.0.2
|
||||||
azure-common==1.1.11
|
azure-common==1.1.11
|
||||||
azure-mgmt-batch==4.1.0
|
azure-mgmt-batch==4.1.0
|
||||||
azure.mgmt.cdn==3.0.0
|
azure-mgmt-cdn==3.0.0
|
||||||
azure-mgmt-compute==3.0.0
|
azure-mgmt-compute==3.0.0
|
||||||
azure-mgmt-containerinstance==0.4.0
|
azure-mgmt-containerinstance==0.4.0
|
||||||
azure-mgmt-containerregistry==2.0.0
|
azure-mgmt-containerregistry==2.0.0
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
cloud/azure
|
cloud/azure
|
||||||
shippable/azure/group4
|
shippable/azure/group4
|
||||||
destructive
|
destructive
|
||||||
unstable
|
|
||||||
azure_rm_webapp_facts
|
azure_rm_webapp_facts
|
||||||
|
|
|
@ -4,7 +4,7 @@ azure-cli-core==2.0.35
|
||||||
azure-cli-nspkg==3.0.2
|
azure-cli-nspkg==3.0.2
|
||||||
azure-common==1.1.11
|
azure-common==1.1.11
|
||||||
azure-mgmt-batch==4.1.0
|
azure-mgmt-batch==4.1.0
|
||||||
azure.mgmt.cdn==3.0.0
|
azure-mgmt-cdn==3.0.0
|
||||||
azure-mgmt-compute==3.0.0
|
azure-mgmt-compute==3.0.0
|
||||||
azure-mgmt-containerinstance==0.4.0
|
azure-mgmt-containerinstance==0.4.0
|
||||||
azure-mgmt-containerregistry==2.0.0
|
azure-mgmt-containerregistry==2.0.0
|
||||||
|
|
Loading…
Reference in a new issue