mirror of https://github.com/apache/jclouds.git
Issue 692:CloudSigma ssh password support
This commit is contained in:
parent
3f25efa69c
commit
d039fe7d96
|
@ -18,9 +18,6 @@
|
|||
*/
|
||||
package org.jclouds.cloudsigma.compute.config;
|
||||
|
||||
import static org.jclouds.compute.domain.OsFamily.UBUNTU;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
@ -58,7 +55,9 @@ import com.google.common.base.Function;
|
|||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Predicates;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.TypeLiteral;
|
||||
|
@ -77,7 +76,11 @@ public class CloudSigmaComputeServiceContextModule
|
|||
|
||||
@Override
|
||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
||||
return template.osFamily(UBUNTU).osVersionMatches("1[10].[10][04]").os64Bit(true).minRam(1024);
|
||||
// until there is a way to query by drive info that can suggest which
|
||||
// drives are ssh boot
|
||||
return template.imageId("a3011b07-3f04-467e-9390-f9a85d859de1").minRam(1024);
|
||||
// return
|
||||
// template.osFamily(UBUNTU).osVersionMatches("1[10].[10][04]").os64Bit(true).minRam(1024);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
|
@ -108,12 +111,12 @@ public class CloudSigmaComputeServiceContextModule
|
|||
|
||||
@Provides
|
||||
@Singleton
|
||||
protected Map<String, DriveInfo> cache(GetDrive getDrive) {
|
||||
return new MapMaker().makeComputingMap(getDrive);
|
||||
protected Cache<String, DriveInfo> cache(GetDrive getDrive) {
|
||||
return CacheBuilder.newBuilder().build(getDrive);
|
||||
}
|
||||
|
||||
@Singleton
|
||||
public static class GetDrive implements Function<String, DriveInfo> {
|
||||
public static class GetDrive extends CacheLoader<String, DriveInfo> {
|
||||
private final CloudSigmaClient client;
|
||||
|
||||
@Inject
|
||||
|
@ -122,7 +125,7 @@ public class CloudSigmaComputeServiceContextModule
|
|||
}
|
||||
|
||||
@Override
|
||||
public DriveInfo apply(String input) {
|
||||
public DriveInfo load(String input) {
|
||||
return client.getDriveInfo(input);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,8 @@ public class ParseOsFamilyVersion64BitFromImageName implements Function<String,
|
|||
}
|
||||
|
||||
// ex CentOS 5.5 Linux 64bit Preinstalled System with AppFirst Monitoring
|
||||
public static final Pattern PATTERN = Pattern.compile("([^ ]+)[^0-9]([0-9.]+) .*");
|
||||
// ex. Centos-5.6-20110917 pub
|
||||
public static final Pattern PATTERN = Pattern.compile("([^ -]+)[^0-9]([0-9.]+)[ -].*");
|
||||
|
||||
@Override
|
||||
public OsFamilyVersion64Bit apply(String input) {
|
||||
|
|
|
@ -56,8 +56,9 @@ public class PreinstalledDiskToImage implements Function<DriveInfo, Image> {
|
|||
String description = drive.getDescription() != null ? drive.getDescription() : drive.getName();
|
||||
Builder builder = OperatingSystem.builder();
|
||||
OsFamilyVersion64Bit parsed = imageParser.apply(drive.getName());
|
||||
builder.name(drive.getName()).description(description).is64Bit(parsed.is64Bit).version(parsed.version).family(
|
||||
parsed.family);
|
||||
builder.name(drive.getName()).description(description)
|
||||
.is64Bit(drive.getBits() != null ? drive.getBits() == 64 : parsed.is64Bit).version(parsed.version)
|
||||
.family(parsed.family);
|
||||
return new ImageBuilder().ids(drive.getUuid()).adminPassword("cloudsigma").userMetadata(
|
||||
ImmutableMap.<String, String> of("size", drive.getSize() / 1024 / 1024 / 1024 + "")).defaultCredentials(
|
||||
new Credentials("cloudsigma", "cloudsigma")).location(locationSupplier.get()).name(drive.getName())
|
||||
|
|
|
@ -52,16 +52,18 @@ public class CloudSigmaTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTe
|
|||
public boolean apply(OsFamilyVersion64Bit input) {
|
||||
switch (input.family) {
|
||||
case UBUNTU:
|
||||
return !input.version.equals("11.10")
|
||||
&& ((input.version.equals("") || input.version.equals("10.04")) || !(input.version
|
||||
.matches("^[89].*"))
|
||||
&& input.is64Bit);
|
||||
return input.version.equals("11.04") || (input.version.equals("11.04") && !input.is64Bit)
|
||||
|| !input.version.equals("11.10")
|
||||
&& (input.version.equals("") || !(input.version.matches("^[89].*")) && input.is64Bit);
|
||||
case SOLARIS:
|
||||
return !input.is64Bit;
|
||||
case DEBIAN:
|
||||
return input.is64Bit;
|
||||
case CENTOS:
|
||||
return (input.version.equals("") || input.version.matches("5.[05]")) && input.is64Bit;
|
||||
return input.version.equals("5.0") || input.version.equals("")
|
||||
|| (input.version.matches("5.[5]") && input.is64Bit);
|
||||
case WINDOWS:
|
||||
return (input.version.equals("2008 R2") && input.is64Bit)
|
||||
return input.version.equals("2008 R2")
|
||||
|| (input.version.equals("2008") && !input.is64Bit) || input.version.equals("")
|
||||
|| (input.version.equals("2003"));
|
||||
default:
|
||||
|
|
|
@ -1,4 +1,27 @@
|
|||
{
|
||||
"Ubuntu-10.04-20110917 pub": {
|
||||
"family": "UBUNTU",
|
||||
"version": "10.04",
|
||||
"is64Bit": true
|
||||
},
|
||||
|
||||
"Ubuntu-11.04-20110917 pub": {
|
||||
"family": "UBUNTU",
|
||||
"version": "11.04",
|
||||
"is64Bit": true
|
||||
},
|
||||
|
||||
"Centos-6.0-20110917 pub": {
|
||||
"family": "CENTOS",
|
||||
"version": "6.0",
|
||||
"is64Bit": true
|
||||
},
|
||||
|
||||
"Centos-5.6-20110917 pub": {
|
||||
"family": "CENTOS",
|
||||
"version": "5.6",
|
||||
"is64Bit": true
|
||||
},
|
||||
|
||||
"Ubuntu 10.04.1 LTS Desktop Edition 32bit Preinstalled System": {
|
||||
"family": "UBUNTU",
|
||||
|
|
Loading…
Reference in New Issue