Fix ec2 tags in instance create. Closes #938.
This commit is contained in:
parent
0fe824277b
commit
97b920f6cf
4 changed files with 80 additions and 1 deletions
|
|
@ -1,4 +1,6 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from collections import defaultdict
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
|
|
@ -330,6 +332,26 @@ class BaseResponse(_TemplateEnvironmentMixin):
|
|||
|
||||
return results
|
||||
|
||||
def _parse_tag_specification(self, param_prefix):
|
||||
tags = self._get_list_prefix(param_prefix)
|
||||
|
||||
results = defaultdict(dict)
|
||||
for tag in tags:
|
||||
resource_type = tag.pop("resource_type")
|
||||
|
||||
param_index = 1
|
||||
while True:
|
||||
key_name = 'tag.{0}._key'.format(param_index)
|
||||
value_name = 'tag.{0}._value'.format(param_index)
|
||||
|
||||
try:
|
||||
results[resource_type][tag[key_name]] = tag[value_name]
|
||||
except KeyError:
|
||||
break
|
||||
param_index += 1
|
||||
|
||||
return results
|
||||
|
||||
@property
|
||||
def request_json(self):
|
||||
return 'JSON' in self.querystring.get('ContentType', [])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue