Fix CosmosDB parameter translation bug (#54212)

This commit is contained in:
Zim Kalinowski 2019-03-22 15:21:53 +08:00 committed by Yunge Zhu
parent 4056427411
commit 18d9715fb1
2 changed files with 11 additions and 1 deletions

View file

@ -324,7 +324,14 @@ class AzureRMCosmosDBAccount(AzureRMModuleBase):
elif kwargs[key] is not None: elif kwargs[key] is not None:
self.parameters[key] = kwargs[key] self.parameters[key] = kwargs[key]
dict_camelize(self.parameters, ['kind'], True) kind = self.parameters.get('kind')
if kind == 'global_document_db':
self.parameters['kind'] = 'GlobalDocumentDB'
elif kind == 'mongo_db':
self.parameters['kind'] = 'MongoDB'
elif kind == 'parse':
self.parameters['kind'] = 'Parse'
dict_camelize(self.parameters, ['consistency_policy', 'default_consistency_level'], True) dict_camelize(self.parameters, ['consistency_policy', 'default_consistency_level'], True)
dict_rename(self.parameters, ['geo_rep_locations', 'name'], 'location_name') dict_rename(self.parameters, ['geo_rep_locations', 'name'], 'location_name')
dict_rename(self.parameters, ['geo_rep_locations'], 'locations') dict_rename(self.parameters, ['geo_rep_locations'], 'locations')

View file

@ -44,6 +44,7 @@
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
name: "{{ dbname }}" name: "{{ dbname }}"
location: eastus location: eastus
kind: global_document_db
geo_rep_locations: geo_rep_locations:
- name: eastus - name: eastus
failover_priority: 0 failover_priority: 0
@ -68,6 +69,7 @@
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
name: "{{ dbname }}" name: "{{ dbname }}"
location: eastus location: eastus
kind: global_document_db
geo_rep_locations: geo_rep_locations:
- name: eastus - name: eastus
failover_priority: 0 failover_priority: 0
@ -92,6 +94,7 @@
resource_group: "{{ resource_group }}" resource_group: "{{ resource_group }}"
name: "{{ dbname }}" name: "{{ dbname }}"
location: eastus location: eastus
kind: global_document_db
geo_rep_locations: geo_rep_locations:
- name: eastus - name: eastus
failover_priority: 0 failover_priority: 0