Mercurial > public > mercurial-scm > hg
comparison contrib/automation/hgautomation/aws.py @ 42275:730edbd836d8
automation: only iterate over our AMIs
We can't delete AMIs that we don't own. Iterating over other
AMIs won't work and slows down execution.
Differential Revision: https://phab.mercurial-scm.org/D6283
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 19 Apr 2019 05:07:44 -0700 |
parents | 0e9066db5e44 |
children | fcb97cb91ff8 |
comparison
equal
deleted
inserted
replaced
42274:8a0e03f7baf4 | 42275:730edbd836d8 |
---|---|
488 ec2resource = c.ec2resource | 488 ec2resource = c.ec2resource |
489 iamresource = c.iamresource | 489 iamresource = c.iamresource |
490 | 490 |
491 terminate_ec2_instances(ec2resource, prefix=prefix) | 491 terminate_ec2_instances(ec2resource, prefix=prefix) |
492 | 492 |
493 for image in ec2resource.images.all(): | 493 for image in ec2resource.images.filter(Owners=['self']): |
494 if image.name.startswith(prefix): | 494 if image.name.startswith(prefix): |
495 remove_ami(ec2resource, image) | 495 remove_ami(ec2resource, image) |
496 | 496 |
497 for group in ec2resource.security_groups.all(): | 497 for group in ec2resource.security_groups.all(): |
498 if group.group_name.startswith(prefix): | 498 if group.group_name.startswith(prefix): |