Change 'image' for 'volume' when getting tags

The AWS docs say that: "Currently, the resource types that support
tagging on creation are instance and volume." Calling `create_volume`
and passing `image` as the resource type in tag specifications causes
an `InvalidParameterValue` error.
This commit is contained in:
grahamlyons 2018-01-26 11:12:50 +00:00
parent 4520cd930f
commit 3ce57644cd
2 changed files with 2 additions and 2 deletions

View File

@ -33,7 +33,7 @@ class ElasticBlockStore(BaseResponse):
zone = self._get_param('AvailabilityZone') zone = self._get_param('AvailabilityZone')
snapshot_id = self._get_param('SnapshotId') snapshot_id = self._get_param('SnapshotId')
tags = self._parse_tag_specification("TagSpecification") tags = self._parse_tag_specification("TagSpecification")
volume_tags = tags.get('image', {}) volume_tags = tags.get('volume', {})
encrypted = self._get_param('Encrypted', if_none=False) encrypted = self._get_param('Encrypted', if_none=False)
if self.is_not_dryrun('CreateVolume'): if self.is_not_dryrun('CreateVolume'):
volume = self.ec2_backend.create_volume( volume = self.ec2_backend.create_volume(

View File

@ -397,7 +397,7 @@ def test_create_volume_with_tags():
Size=40, Size=40,
TagSpecifications=[ TagSpecifications=[
{ {
'ResourceType': 'image', 'ResourceType': 'volume',
'Tags': [ 'Tags': [
{ {
'Key': 'TEST_TAG', 'Key': 'TEST_TAG',