mirror of https://github.com/apache/jclouds.git
fixed template builder problem where imageDescription wasn't matching
This commit is contained in:
parent
fc1782b536
commit
12d944692e
|
@ -74,6 +74,32 @@ public class EC2TemplateBuilderLiveTest {
|
|||
return overrides;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTemplateBuilderM1SMALLWithDescription() {
|
||||
ComputeServiceContext newContext = null;
|
||||
try {
|
||||
newContext = new ComputeServiceContextFactory().createContext(provider, ImmutableSet
|
||||
.<Module> of(new Log4JLoggingModule()), setupProperties());
|
||||
|
||||
Template template = newContext.getComputeService().templateBuilder().hardwareId(InstanceType.M1_SMALL)
|
||||
.osVersionMatches("10.04").imageDescriptionMatches("ubuntu-images").osFamily(OsFamily.UBUNTU).build();
|
||||
|
||||
System.out.println(template.getHardware());
|
||||
assert (template.getImage().getProviderId().startsWith("ami-")) : template;
|
||||
assertEquals(template.getImage().getOperatingSystem().getVersion(), "10.04");
|
||||
assertEquals(template.getImage().getOperatingSystem().is64Bit(), false);
|
||||
assertEquals(template.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
|
||||
assertEquals(template.getImage().getVersion(), "20100921");
|
||||
assertEquals(template.getImage().getUserMetadata().get("rootDeviceType"), "instance-store");
|
||||
assertEquals(template.getLocation().getId(), "us-east-1");
|
||||
assertEquals(getCores(template.getHardware()), 1.0d);
|
||||
assertEquals(template.getHardware().getId(), InstanceType.M1_SMALL);
|
||||
} finally {
|
||||
if (newContext != null)
|
||||
newContext.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTemplateBuilderCanUseImageIdAndhardwareId() {
|
||||
ComputeServiceContext newContext = null;
|
||||
|
|
|
@ -320,7 +320,7 @@ public class TemplateBuilderImpl implements TemplateBuilder {
|
|||
public boolean apply(Image input) {
|
||||
boolean returnVal = true;
|
||||
if (imageDescription != null) {
|
||||
if (input.getName() == null)
|
||||
if (input.getDescription() == null)
|
||||
returnVal = false;
|
||||
else
|
||||
returnVal = input.getDescription().equals(imageDescription)
|
||||
|
|
Loading…
Reference in New Issue