Merge pull request #2096 from tay-bird/fix-describe-volumes-response-with-no-tags
Fix describe volumes response with no tags
This commit is contained in:
commit
fe42309534
@ -150,16 +150,18 @@ CREATE_VOLUME_RESPONSE = """<CreateVolumeResponse xmlns="http://ec2.amazonaws.co
|
|||||||
<availabilityZone>{{ volume.zone.name }}</availabilityZone>
|
<availabilityZone>{{ volume.zone.name }}</availabilityZone>
|
||||||
<status>creating</status>
|
<status>creating</status>
|
||||||
<createTime>{{ volume.create_time}}</createTime>
|
<createTime>{{ volume.create_time}}</createTime>
|
||||||
<tagSet>
|
{% if volume.get_tags() %}
|
||||||
{% for tag in volume.get_tags() %}
|
<tagSet>
|
||||||
<item>
|
{% for tag in volume.get_tags() %}
|
||||||
<resourceId>{{ tag.resource_id }}</resourceId>
|
<item>
|
||||||
<resourceType>{{ tag.resource_type }}</resourceType>
|
<resourceId>{{ tag.resource_id }}</resourceId>
|
||||||
<key>{{ tag.key }}</key>
|
<resourceType>{{ tag.resource_type }}</resourceType>
|
||||||
<value>{{ tag.value }}</value>
|
<key>{{ tag.key }}</key>
|
||||||
</item>
|
<value>{{ tag.value }}</value>
|
||||||
{% endfor %}
|
</item>
|
||||||
</tagSet>
|
{% endfor %}
|
||||||
|
</tagSet>
|
||||||
|
{% endif %}
|
||||||
<volumeType>standard</volumeType>
|
<volumeType>standard</volumeType>
|
||||||
</CreateVolumeResponse>"""
|
</CreateVolumeResponse>"""
|
||||||
|
|
||||||
@ -191,16 +193,18 @@ DESCRIBE_VOLUMES_RESPONSE = """<DescribeVolumesResponse xmlns="http://ec2.amazon
|
|||||||
</item>
|
</item>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</attachmentSet>
|
</attachmentSet>
|
||||||
<tagSet>
|
{% if volume.get_tags() %}
|
||||||
{% for tag in volume.get_tags() %}
|
<tagSet>
|
||||||
<item>
|
{% for tag in volume.get_tags() %}
|
||||||
<resourceId>{{ tag.resource_id }}</resourceId>
|
<item>
|
||||||
<resourceType>{{ tag.resource_type }}</resourceType>
|
<resourceId>{{ tag.resource_id }}</resourceId>
|
||||||
<key>{{ tag.key }}</key>
|
<resourceType>{{ tag.resource_type }}</resourceType>
|
||||||
<value>{{ tag.value }}</value>
|
<key>{{ tag.key }}</key>
|
||||||
</item>
|
<value>{{ tag.value }}</value>
|
||||||
{% endfor %}
|
</item>
|
||||||
</tagSet>
|
{% endfor %}
|
||||||
|
</tagSet>
|
||||||
|
{% endif %}
|
||||||
<volumeType>standard</volumeType>
|
<volumeType>standard</volumeType>
|
||||||
</item>
|
</item>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -589,6 +589,18 @@ def test_volume_tag_escaping():
|
|||||||
dict(snaps[0].tags).should.equal({'key': '</closed>'})
|
dict(snaps[0].tags).should.equal({'key': '</closed>'})
|
||||||
|
|
||||||
|
|
||||||
|
@mock_ec2
|
||||||
|
def test_volume_property_hidden_when_no_tags_exist():
|
||||||
|
ec2_client = boto3.client('ec2', region_name='us-east-1')
|
||||||
|
|
||||||
|
volume_response = ec2_client.create_volume(
|
||||||
|
Size=10,
|
||||||
|
AvailabilityZone='us-east-1a'
|
||||||
|
)
|
||||||
|
|
||||||
|
volume_response.get('Tags').should.equal(None)
|
||||||
|
|
||||||
|
|
||||||
@freeze_time
|
@freeze_time
|
||||||
@mock_ec2
|
@mock_ec2
|
||||||
def test_copy_snapshot():
|
def test_copy_snapshot():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user