Patchwork D6283: automation: only iterate over our AMIs

login
register
mail settings
Submitter phabricator
Date April 19, 2019, 12:20 p.m.
Message ID <differential-rev-PHID-DREV-rdek5gljgkjae5tdvpli-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/39762/
State Superseded
Headers show

Comments

phabricator - April 19, 2019, 12:20 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  We can't delete AMIs that we don't own. Iterating over other
  AMIs won't work and slows down execution.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D6283

AFFECTED FILES
  contrib/automation/hgautomation/aws.py

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/automation/hgautomation/aws.py b/contrib/automation/hgautomation/aws.py
--- a/contrib/automation/hgautomation/aws.py
+++ b/contrib/automation/hgautomation/aws.py
@@ -490,7 +490,7 @@ 
 
     terminate_ec2_instances(ec2resource, prefix=prefix)
 
-    for image in ec2resource.images.all():
+    for image in ec2resource.images.filter(Owners=['self']):
         if image.name.startswith(prefix):
             remove_ami(ec2resource, image)