mirror of
https://github.com/kevingruesser/bootstrap-vz.git
synced 2025-08-24 07:26:29 +00:00
19 lines
495 B
Python
19 lines
495 B
Python
import logging
|
|
log = logging.getLogger(__name__)
|
|
|
|
|
|
class AmazonMachineImage(object):
|
|
|
|
def __init__(self, image_id, ec2_connection):
|
|
self.ec2_connection = ec2_connection
|
|
self.ami = self.ec2_connection.get_image(image_id)
|
|
|
|
|
|
class EBSImage(AmazonMachineImage):
|
|
|
|
def destroy(self):
|
|
log.debug('Deleting AMI')
|
|
self.ami.deregister()
|
|
for device, block_device_type in self.ami.block_device_mapping.items():
|
|
self.ec2_connection.delete_snapshot(block_device_type.snapshot_id)
|
|
del self.ami
|