Fixing volume.attachment is None

This commit is contained in:
mickeypash 2017-11-13 19:58:21 +00:00
parent 15a1bc43a9
commit d5b841fb6c

View File

@ -1812,9 +1812,8 @@ class EBSBackend(object):
def delete_volume(self, volume_id): def delete_volume(self, volume_id):
if volume_id in self.volumes: if volume_id in self.volumes:
volume = self.volumes[volume_id] volume = self.volumes[volume_id]
instance_id = volume.attachment.instance.id
if volume.attachment is not None: if volume.attachment is not None:
raise VolumeInUseError(volume_id, instance_id) raise VolumeInUseError(volume_id, volume.attachment.instance.id)
return self.volumes.pop(volume_id) return self.volumes.pop(volume_id)
raise InvalidVolumeIdError(volume_id) raise InvalidVolumeIdError(volume_id)