implemented as discussed on mailing list.  jira is unavailable but i will 
create an issue when i can.  description below.

---

I'd like to tie in to jclouds's TemplateBuilder so that I can use its 
filtering/matching capabilities but then use custom logic to determine which of 
the matching images is "best" (for my custom value of best, i.e. 
preferred). 

The driving use case is that I want a portable way to say "any recent 
ubuntu or centos".  Normally this is the default of course but it 
doesn't always do the right thing when other options are specified -- 
broken ubuntu "alpha" images in AWS being the worst offender (asking 
for 16gb RAM in us-west-1 gives back an awful ubuntu 8.04 alpha, for 
instance!).  It would also handle use cases where someone wants to say 
"Ubuntu 11 or 12, or CentOS 6.x, is best. failing that, Ubuntu 10 or 
CentOS 5.x. (and never any alpha images!)".

I'm thinking allowing to set an `imageSorter(Ordering)`. This fits with how
the TemplateBuilderImpl currently works (it already uses an Ordering, you just 
can't change it; and it stays in line with the naming convention of 
`Sorter` as in `Ordering hardwareSorter()`.)

You can merge this Pull Request by running:

  git pull https://github.com/ahgittin/jclouds 
feature/templatebuilder-images-ordering

Or you can view, comment on it, or merge it online at:

  https://github.com/jclouds/jclouds/pull/166

-- Commit Summary --

  * support specifying an imageSorter(Ordering<Image>) for the case when 
multiple images match

-- File Changes --

    M compute/src/main/java/org/jclouds/compute/domain/TemplateBuilder.java (8)
    M 
compute/src/main/java/org/jclouds/compute/domain/internal/TemplateBuilderImpl.java
 (32)
    M 
compute/src/test/java/org/jclouds/compute/domain/internal/TemplateBuilderImplTest.java
 (95)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/166.patch
https://github.com/jclouds/jclouds/pull/166.diff

Reply via email to