a bug fix for elastic pool name (#56820)

This commit is contained in:
MyronFanQiu 2019-07-29 17:13:56 +08:00 committed by Yunge Zhu
parent 336be58665
commit 373e887e7f

View file

@ -196,7 +196,7 @@ status:
'''
import time
from ansible.module_utils.azure_rm_common import AzureRMModuleBase
from ansible.module_utils.azure_rm_common import AzureRMModuleBase, format_resource_id
try:
from msrestazure.azure_exceptions import CloudError
@ -339,7 +339,7 @@ class AzureRMSqlDatabase(AzureRMModuleBase):
elif key == "max_size_bytes":
self.parameters["max_size_bytes"] = kwargs[key]
elif key == "elastic_pool_name":
self.parameters["elastic_pool_name"] = kwargs[key]
self.parameters["elastic_pool_id"] = kwargs[key]
elif key == "read_scale":
self.parameters["read_scale"] = 'Enabled' if kwargs[key] else 'Disabled'
elif key == "sample_name":
@ -358,6 +358,9 @@ class AzureRMSqlDatabase(AzureRMModuleBase):
if "location" not in self.parameters:
self.parameters["location"] = resource_group.location
if "elastic_pool_id" in self.parameters:
self.format_elastic_pool_id()
old_response = self.get_sqldatabase()
if not old_response:
@ -486,6 +489,14 @@ class AzureRMSqlDatabase(AzureRMModuleBase):
return False
def format_elastic_pool_id(self):
parrent_id = format_resource_id(val=self.server_name,
subscription_id=self.subscription_id,
namespace="Microsoft.Sql",
types="servers",
resource_group=self.resource_group)
self.parameters['elastic_pool_id'] = parrent_id + "/elasticPools/" + self.parameters['elastic_pool_id']
def _snake_to_camel(snake, capitalize_first=False):
if capitalize_first: