From 51e24096fe361a825ab3e31d0e22cce7c9d85d0c Mon Sep 17 00:00:00 2001 From: David Ribeiro Alves Date: Tue, 28 Feb 2012 19:39:32 +0000 Subject: [PATCH] refactored image from yaml creation --- .../config/VirtualBoxComputeServiceContextModule.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java index e62440f41a..c469626564 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java @@ -80,6 +80,7 @@ import com.google.common.cache.CacheBuilder; import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Iterables; import com.google.inject.Injector; import com.google.inject.Provides; import com.google.inject.TypeLiteral; @@ -188,8 +189,11 @@ public class VirtualBoxComputeServiceContextModule extends @Override protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) { - injector.getInstance(Supplier.class); - return template.osFamily(OsFamily.UBUNTU).osVersionMatches("11.04"); + Supplier> imagesSupplier = injector.getInstance(Supplier.class); + // get the first image from the supplier + Image image = Iterables.getFirst(imagesSupplier.get().keySet(), null); + template.fromImage(image); + return template; } @Provides