Issue 1070: show that template parsing fails on login user

This commit is contained in:
Adrian Cole 2012-08-22 10:11:38 -07:00
parent b6c7c51606
commit 0cbef26eae
3 changed files with 21 additions and 14 deletions

View File

@ -39,7 +39,7 @@
<test.ninefold-compute.build-version></test.ninefold-compute.build-version>
<test.ninefold-compute.identity>FIXME_IDENTITY</test.ninefold-compute.identity>
<test.ninefold-compute.credential>FIXME_CREDENTIAL</test.ninefold-compute.credential>
<test.ninefold-compute.template>imageId=1215,loginUser=user:Password01,authenticateSudo=true</test.ninefold-compute.template>
<test.ninefold-compute.template></test.ninefold-compute.template>
<jclouds.osgi.export>org.jclouds.ninefold.compute*;version="${project.version}"</jclouds.osgi.export>
<jclouds.osgi.import>
org.jclouds.compute.internal;version="${project.version}",

View File

@ -38,7 +38,8 @@ public class NinefoldComputeProviderMetadata extends BaseProviderMetadata {
public static Properties defaultProperties() {
Properties properties = new Properties();
properties.setProperty(TEMPLATE, "imageId=1215,loginUser=user:Password01,authenticateSudo=true");
// https://ninefold.com/support/display/SPT/Ubuntu+10.04+64+Bit+Micro+Server+with+CHEF
properties.setProperty(TEMPLATE, "imageNameMatches=.*Micro.*,osFamily=UBUNTU,osVersionMatches=1[012].[01][04],loginUser=user:Password01,authenticateSudo=true");
return properties;
}

View File

@ -52,16 +52,18 @@ public class NinefoldComputeTemplateBuilderLiveTest extends BaseTemplateBuilderL
@Override
public boolean apply(OsFamilyVersion64Bit input) {
switch (input.family) {
case UBUNTU:
return input.version.equals("") || input.version.equals("10.04");
case SUSE:
return (input.version.equals("") || input.version.equals("11")) && input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
case WINDOWS:
return input.version.equals("") || (input.version.equals("2008") && !input.is64Bit);
default:
return false;
case UBUNTU:
return input.version.equals("") || input.version.equals("10.04");
case SUSE:
return (input.version.equals("") || input.version.equals("11")) && input.is64Bit;
case DEBIAN:
return (input.version.equals("") || input.version.equals("6.0")) && !input.is64Bit;
case CENTOS:
return (input.version.equals("") || input.version.equals("5.5")) && input.is64Bit;
case WINDOWS:
return input.version.equals("") || (input.version.equals("2008") && !input.is64Bit);
default:
return false;
}
}
@ -72,14 +74,18 @@ public class NinefoldComputeTemplateBuilderLiveTest extends BaseTemplateBuilderL
public void testDefaultTemplateBuilder() throws IOException {
Template defaultTemplate = this.view.getComputeService().templateBuilder().build();
if (template == null) {
assert defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[012].[10][04]") : defaultTemplate
.getImage().getOperatingSystem().getVersion();
assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
assertEquals(defaultTemplate.getImage().getOperatingSystem().getVersion(), "10.04");
assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
assertEquals(defaultTemplate.getLocation().getId(), "1");
assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
assertEquals(defaultTemplate.getOptions().getLoginUser(), "user");
assertEquals(defaultTemplate.getOptions().getLoginPassword(), "Password01");
assertEquals(defaultTemplate.getOptions().shouldAuthenticateSudo(), Boolean.TRUE);
} else {
assertEquals(defaultTemplate.getImage(), this.view.getComputeService().templateBuilder().from(template)
.build().getImage());
.build().getImage());
}
}