diff --git a/moto/ec2/models.py b/moto/ec2/models.py index df89be4ce..4684e02b3 100644 --- a/moto/ec2/models.py +++ b/moto/ec2/models.py @@ -109,7 +109,7 @@ class StateReason(object): class TaggedEC2Resource(object): def get_tags(self, *args, **kwargs): - tags = self.ec2_backend.describe_tags(filters={'resource-id': [self.id]}) + tags = ec2_backend.describe_tags(filters={'resource-id': [self.id]}) return tags def get_filter_value(self, filter_name): @@ -383,10 +383,6 @@ class Instance(BotoInstance, TaggedEC2Resource): self._reason = "" self._state_reason = StateReason() - def get_tags(self): - tags = self.ec2_backend.describe_tags(filters={'resource-id': [self.id]}) - return tags - @property def dynamic_group_list(self): if self.nics: @@ -1227,7 +1223,7 @@ class VolumeAttachment(object): return attachment -class Volume(object): +class Volume(TaggedEC2Resource): def __init__(self, volume_id, size, zone): self.id = volume_id self.size = size @@ -1255,12 +1251,8 @@ class Volume(object): else: return 'available' - def get_tags(self): - tags = ec2_backend.describe_tags(filters={'resource-id': [self.id]}) - return tags - -class Snapshot(object): +class Snapshot(TaggedEC2Resource): def __init__(self, snapshot_id, volume, description): self.id = snapshot_id self.volume = volume diff --git a/moto/ec2/responses/elastic_block_store.py b/moto/ec2/responses/elastic_block_store.py index 93009294b..69a4cb9e8 100644 --- a/moto/ec2/responses/elastic_block_store.py +++ b/moto/ec2/responses/elastic_block_store.py @@ -197,6 +197,14 @@ DESCRIBE_SNAPSHOTS_RESPONSE = """