Merge lp:~allenap/launchpad/update-ec2-image into lp:launchpad
| Status: | Merged |
|---|---|
| Approved by: | Aaron Bentley on 2010-11-22 |
| Approved revision: | no longer in the source branch. |
| Merged at revision: | 11961 |
| Proposed branch: | lp:~allenap/launchpad/update-ec2-image |
| Merge into: | lp:launchpad |
| Diff against target: |
221 lines (+80/-58) 2 files modified
lib/devscripts/ec2test/account.py (+45/-48) lib/devscripts/ec2test/builtins.py (+35/-10) |
| To merge this branch: | bzr merge lp:~allenap/launchpad/update-ec2-image |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Aaron Bentley (community) | 2010-11-22 | Approve on 2010-11-22 | |
|
Review via email:
|
|||
Commit Message
[r=abentley]
Description of the Change
Add a new command to display all the usable test images for bin/ec2:
{{{
$ bin/ec2 help images
Purpose: Display all available images.
Usage: ec2 images
Options:
--usage Show usage message and options.
-v, --verbose Display more information.
-q, --quiet Only display errors and warnings.
-h, --help Show help message.
Description:
The first in the list is the default image.
$ bin/ec2 images
Rev AMI Owner ID Owner
499 ami-0288626b 366009196755 salgado
120 ami-217f9448 038531743404 jelmer
119 ami-2d8e6044 366009196755 salgado
117 ami-a9749bc0 036590675370 jml
116 ami-5d1df134 366009196755 salgado
114 ami-35806c5c 889698597288 henninge
113 ami-a909e4c0 200337130613 mwhudson
112 ami-9212f0fb 200337130613 mwhudson
111 ami-d228cabb 200337130613 mwhudson
102 ami-748f6d1d 255383312499 gary
100 ami-22a1424b 200337130613 mwhudson
}}}
It also adds me to VALID_AMI_OWNERS.

VALID_AMI_OWNERS should come after EC2Account in the __all__.
It looks as if it would be simpler to use dict.setdefault rather than sorting, groupby, etc.
e.g. instead of
search_ results. append( (revision, image)), make search_results a dict and results. setdefault( revision, []).append(image).
do
search_
And then instead of results. sort(key= get_revision, reverse=True) search_ results, get_revision):
# Sort and group by revision.
get_revision = itemgetter(0)
search_
for revision, group in groupby(
yield revision, [image for (revision, image) in group]
do
return sorted( search_ results. items() )