fix tag deletion

This commit is contained in:
Steve Pulec 2013-02-25 23:37:01 -05:00
parent 156c9ba4c4
commit 935e6bd95d
3 changed files with 11 additions and 2 deletions

View File

@ -15,7 +15,8 @@ class TagResponse(object):
return CREATE_RESPONSE
def delete_tags(self):
ec2_backend.delete_tag()
for resource_id, tag in self.resource_ids.iteritems():
ec2_backend.delete_tag(resource_id, tag[0])
template = Template(DELETE_RESPONSE)
return template.render(reservations=ec2_backend.all_reservations())

View File

@ -48,7 +48,12 @@ def resource_ids_from_querystring(querystring_dict):
if prefix in key:
resource_index = key.replace(prefix + ".", "")
tag_key = querystring_dict.get("Tag.{}.Key".format(resource_index))[0]
tag_value = querystring_dict.get("Tag.{}.Value".format(resource_index))[0]
tag_value_key = "Tag.{}.Value".format(resource_index)
if tag_value_key in querystring_dict:
tag_value = querystring_dict.get(tag_value_key)[0]
else:
tag_value = None
response_values[value[0]] = (tag_key, tag_value)
return response_values

View File

@ -16,3 +16,6 @@ def test_instance_launch_and_terminate():
tag = tags[0]
tag.name.should.equal("a key")
tag.value.should.equal("some value")
instance.remove_tag("a key")
conn.get_all_tags().should.have.length_of(0)