Fix a bug with map type not properly handling multiple entries
This commit is contained in:
		
							parent
							
								
									ed91b093cd
								
							
						
					
					
						commit
						5538b541a8
					
				| @ -576,9 +576,14 @@ def xml_to_json_response(service_spec, operation, xml, result_node=None): | |||||||
|                 if v is None: |                 if v is None: | ||||||
|                     od[k] = {} |                     od[k] = {} | ||||||
|                 else: |                 else: | ||||||
|                     key = from_str(v['entry']['key'], spec[k]['key']) |                     items = ([v['entry']] if not isinstance(v['entry'], list) else | ||||||
|                     val = from_str(v['entry']['value'], spec[k]['value']) |                              v['entry']) | ||||||
|                     od[k] = {key: val} |                     for item in items: | ||||||
|  |                         key = from_str(item['key'], spec[k]['key']) | ||||||
|  |                         val = from_str(item['value'], spec[k]['value']) | ||||||
|  |                         if k not in od: | ||||||
|  |                             od[k] = {} | ||||||
|  |                         od[k][key] = val | ||||||
|             else: |             else: | ||||||
|                 if v is None: |                 if v is None: | ||||||
|                     od[k] = None |                     od[k] = None | ||||||
|  | |||||||
| @ -43,6 +43,8 @@ def test_describe_cluster(): | |||||||
|             'Configurations.member.1.Classification': 'yarn-site', |             'Configurations.member.1.Classification': 'yarn-site', | ||||||
|             'Configurations.member.1.Properties.entry.1.key': 'someproperty', |             'Configurations.member.1.Properties.entry.1.key': 'someproperty', | ||||||
|             'Configurations.member.1.Properties.entry.1.value': 'somevalue', |             'Configurations.member.1.Properties.entry.1.value': 'somevalue', | ||||||
|  |             'Configurations.member.1.Properties.entry.2.key': 'someotherproperty', | ||||||
|  |             'Configurations.member.1.Properties.entry.2.value': 'someothervalue', | ||||||
|             'Instances.EmrManagedMasterSecurityGroup': 'master-security-group', |             'Instances.EmrManagedMasterSecurityGroup': 'master-security-group', | ||||||
|             'Instances.Ec2SubnetId': 'subnet-8be41cec', |             'Instances.Ec2SubnetId': 'subnet-8be41cec', | ||||||
|         }, |         }, | ||||||
|  | |||||||
| @ -60,7 +60,8 @@ def test_describe_cluster(): | |||||||
|     args['Applications'] = [{'Name': 'Spark', 'Version': '2.4.2'}] |     args['Applications'] = [{'Name': 'Spark', 'Version': '2.4.2'}] | ||||||
|     args['Configurations'] = [ |     args['Configurations'] = [ | ||||||
|         {'Classification': 'yarn-site', |         {'Classification': 'yarn-site', | ||||||
|          'Properties': {'someproperty': 'somevalue'}}] |          'Properties': {'someproperty': 'somevalue', | ||||||
|  |                         'someotherproperty': 'someothervalue'}}] | ||||||
|     args['Instances']['AdditionalMasterSecurityGroups'] = ['additional-master'] |     args['Instances']['AdditionalMasterSecurityGroups'] = ['additional-master'] | ||||||
|     args['Instances']['AdditionalSlaveSecurityGroups'] = ['additional-slave'] |     args['Instances']['AdditionalSlaveSecurityGroups'] = ['additional-slave'] | ||||||
|     args['Instances']['Ec2KeyName'] = 'mykey' |     args['Instances']['Ec2KeyName'] = 'mykey' | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user