Specify AMI type when delete
authorRail Aliiev <rail@mozilla.com>
Mon, 01 Dec 2014 04:37:30 -0500
changeset 578 01b34efd06724c9f5e0785b3f38a1ff67ad02342
parent 577 0442d92d16a5ec156bc516ce2ce3847facf53676
child 579 5119bd3dd595086a6a25eac8bccd3f2661d74f55
push id569
push userraliiev@mozilla.com
push dateMon, 01 Dec 2014 09:37:37 +0000
Specify AMI type when delete
cloudtools/aws/ami.py
--- a/cloudtools/aws/ami.py
+++ b/cloudtools/aws/ami.py
@@ -107,34 +107,34 @@ def get_spot_amis(region, tags, name_glo
         filters["root-device-type"] = root_device_type
     avail_amis = conn.get_all_images(owners=["self"], filters=filters)
     return sorted(avail_amis, key=lambda ami: ami.tags.get("moz-created"))
 
 
 def delete_ebs_ami(ami):
     snap_id = ami.block_device_mapping[ami.root_device_name].snapshot_id
     snap = ami.connection.get_all_snapshots(snapshot_ids=[snap_id])[0]
-    log.warn("Deleting %s (%s)", ami, ami.tags.get("Name"))
+    log.warn("Deleting EBS-backed AMI %s (%s)", ami, ami.tags.get("Name"))
     ami.deregister()
     log.warn("Deleting %s (%s)", snap, snap.description)
     snap.delete()
 
 
 def delete_instance_store_ami(ami):
     bucket, location = ami.location.split("/", 1)
     folder = os.path.dirname(location)
     conn = get_s3_connection()
     bucket = conn.get_bucket(bucket)
     key = bucket.get_key(location)
     manifest = key.get_contents_as_string()
     dom = xml.dom.minidom.parseString(manifest)
     files = [f.firstChild.nodeValue for f in
              dom.getElementsByTagName("filename")]
     to_delete = [os.path.join(folder, f) for f in files] + [location]
-    log.warn("Deleting %s (%s)", ami, ami.tags.get("Name"))
+    log.warn("Deleting S3-backed %s (%s)", ami, ami.tags.get("Name"))
     ami.deregister()
     log.warn("Deleting files from S3: %s", to_delete)
     bucket.delete_keys(to_delete)
 
 
 def delete_ami(ami, dry_run=False):
     if dry_run:
         log.warn("Dry run: would delete %s", ami)