updated slicehost to current style of credential management

This commit is contained in:
Adrian Cole 2011-12-21 03:12:27 -08:00
parent 2aadb21b03
commit 83ca5dd931
7 changed files with 101 additions and 100 deletions

View File

@ -36,9 +36,7 @@ import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder; import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.compute.domain.NodeState; import org.jclouds.compute.domain.NodeState;
import org.jclouds.compute.domain.OperatingSystem; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.slicehost.domain.Slice; import org.jclouds.slicehost.domain.Slice;
@ -56,7 +54,6 @@ public class SliceToNodeMetadata implements Function<Slice, NodeMetadata> {
protected final Map<Slice.Status, NodeState> sliceToNodeState; protected final Map<Slice.Status, NodeState> sliceToNodeState;
protected final Supplier<Set<? extends Image>> images; protected final Supplier<Set<? extends Image>> images;
protected final Supplier<Set<? extends Hardware>> hardwares; protected final Supplier<Set<? extends Hardware>> hardwares;
protected final Map<String, Credentials> credentialStore;
@Resource @Resource
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
@ -88,11 +85,10 @@ public class SliceToNodeMetadata implements Function<Slice, NodeMetadata> {
} }
@Inject @Inject
SliceToNodeMetadata(Map<Slice.Status, NodeState> sliceStateToNodeState, Map<String, Credentials> credentialStore, SliceToNodeMetadata(Map<Slice.Status, NodeState> sliceStateToNodeState,
@Memoized Supplier<Set<? extends Image>> images, Supplier<Location> location, @Memoized Supplier<Set<? extends Image>> images, Supplier<Location> location,
@Memoized Supplier<Set<? extends Hardware>> hardwares) { @Memoized Supplier<Set<? extends Hardware>> hardwares) {
this.sliceToNodeState = checkNotNull(sliceStateToNodeState, "sliceStateToNodeState"); this.sliceToNodeState = checkNotNull(sliceStateToNodeState, "sliceStateToNodeState");
this.credentialStore = checkNotNull(credentialStore, "credentialStore");
this.images = checkNotNull(images, "images"); this.images = checkNotNull(images, "images");
this.location = checkNotNull(location, "location"); this.location = checkNotNull(location, "location");
this.hardwares = checkNotNull(hardwares, "hardwares"); this.hardwares = checkNotNull(hardwares, "hardwares");
@ -126,7 +122,6 @@ public class SliceToNodeMetadata implements Function<Slice, NodeMetadata> {
} }
})); }));
builder.credentials(LoginCredentials.fromCredentials(credentialStore.get("node#" + from.getId())));
return builder.build(); return builder.build();
} }

View File

@ -24,7 +24,6 @@ import javax.inject.Singleton;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.domain.ImageBuilder; import org.jclouds.compute.domain.ImageBuilder;
import org.jclouds.compute.domain.OperatingSystem; import org.jclouds.compute.domain.OperatingSystem;
import org.jclouds.domain.LoginCredentials;
import com.google.common.base.Function; import com.google.common.base.Function;
@ -47,7 +46,6 @@ public class SlicehostImageToImage implements Function<org.jclouds.slicehost.dom
builder.name(from.getName()); builder.name(from.getName());
builder.description(from.getName()); builder.description(from.getName());
builder.operatingSystem(imageToOs.apply(from)); builder.operatingSystem(imageToOs.apply(from));
builder.defaultCredentials(LoginCredentials.builder().user("root").build());
Image image = builder.build(); Image image = builder.build();
return image; return image;
} }

View File

@ -19,16 +19,20 @@
package org.jclouds.slicehost.compute.strategy; package org.jclouds.slicehost.compute.strategy;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Preconditions.checkState;
import java.util.Map; import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.Template; import org.jclouds.compute.domain.Template;
import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName; import org.jclouds.compute.strategy.CreateNodeWithGroupEncodedIntoName;
import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.slicehost.SlicehostClient; import org.jclouds.slicehost.SlicehostClient;
import org.jclouds.slicehost.domain.Slice; import org.jclouds.slicehost.domain.Slice;
@ -40,23 +44,41 @@ import com.google.common.base.Function;
*/ */
@Singleton @Singleton
public class SlicehostCreateNodeWithGroupEncodedIntoName implements CreateNodeWithGroupEncodedIntoName { public class SlicehostCreateNodeWithGroupEncodedIntoName implements CreateNodeWithGroupEncodedIntoName {
protected final SlicehostClient client; protected final SlicehostClient client;
protected final Map<String, Credentials> credentialStore; protected final Map<String, Credentials> credentialStore;
protected final PrioritizeCredentialsFromTemplate prioritizeCredentialsFromTemplate;
protected final Function<Slice, NodeMetadata> sliceToNodeMetadata; protected final Function<Slice, NodeMetadata> sliceToNodeMetadata;
@Inject @Inject
protected SlicehostCreateNodeWithGroupEncodedIntoName(SlicehostClient client, Map<String, Credentials> credentialStore, protected SlicehostCreateNodeWithGroupEncodedIntoName(SlicehostClient client,
Map<String, Credentials> credentialStore,
PrioritizeCredentialsFromTemplate prioritizeCredentialsFromTemplate,
Function<Slice, NodeMetadata> sliceToNodeMetadata) { Function<Slice, NodeMetadata> sliceToNodeMetadata) {
this.client = checkNotNull(client, "client"); this.client = checkNotNull(client, "client");
this.credentialStore = checkNotNull(credentialStore, "credentialStore"); this.credentialStore = checkNotNull(credentialStore, "credentialStore");
this.sliceToNodeMetadata = checkNotNull(sliceToNodeMetadata, "sliceToNodeMetadata"); this.sliceToNodeMetadata = checkNotNull(sliceToNodeMetadata, "sliceToNodeMetadata");
this.prioritizeCredentialsFromTemplate = checkNotNull(prioritizeCredentialsFromTemplate,
"prioritizeCredentialsFromTemplate");
} }
@Override @Override
public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) { public NodeMetadata createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
Slice from = client.createSlice(name, Integer.parseInt(template.getImage().getProviderId()), checkState(group != null, "group (that which groups identical nodes together) must be specified");
Integer.parseInt(template.getHardware().getProviderId())); checkState(name != null && name.indexOf(group) != -1, "name should have %s encoded into it", group);
credentialStore.put("node#" + from.getId(), new Credentials("root", from.getRootPassword())); checkState(template != null, "template must be specified");
return sliceToNodeMetadata.apply(from);
Slice slice = client.createSlice(name, Integer.parseInt(template.getImage().getProviderId()), Integer
.parseInt(template.getHardware().getProviderId()));
NodeAndInitialCredentials<Slice> from = new NodeAndInitialCredentials<Slice>(slice, slice.getId() + "",
LoginCredentials.builder().password(slice.getRootPassword()).build());
LoginCredentials fromNode = from.getCredentials();
LoginCredentials creds = prioritizeCredentialsFromTemplate.apply(template, fromNode);
if (creds != null)
credentialStore.put("node#" + from.getNodeId(), creds);
NodeMetadata node = sliceToNodeMetadata.apply(from.getNode());
return node;
} }
} }

View File

@ -18,15 +18,23 @@
*/ */
package org.jclouds.slicehost.compute.strategy; package org.jclouds.slicehost.compute.strategy;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Map;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.compute.domain.NodeMetadata; import org.jclouds.compute.domain.NodeMetadata;
import org.jclouds.compute.domain.NodeMetadataBuilder;
import org.jclouds.compute.strategy.GetNodeMetadataStrategy; import org.jclouds.compute.strategy.GetNodeMetadataStrategy;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.slicehost.SlicehostClient; import org.jclouds.slicehost.SlicehostClient;
import org.jclouds.slicehost.domain.Slice; import org.jclouds.slicehost.domain.Slice;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Functions;
/** /**
* *
@ -36,18 +44,37 @@ import com.google.common.base.Function;
public class SlicehostGetNodeMetadataStrategy implements GetNodeMetadataStrategy { public class SlicehostGetNodeMetadataStrategy implements GetNodeMetadataStrategy {
private final SlicehostClient client; private final SlicehostClient client;
private final Function<Slice, NodeMetadata> sliceToNodeMetadata; private final Map<String, Credentials> credentialStore;
private final Function<Slice, NodeMetadata> nodeMetadataAdapter;
@Inject @Inject
protected SlicehostGetNodeMetadataStrategy(SlicehostClient client, Function<Slice, NodeMetadata> sliceToNodeMetadata) { protected SlicehostGetNodeMetadataStrategy(SlicehostClient client, Map<String, Credentials> credentialStore,
Function<Slice, NodeMetadata> nodeMetadataAdapter) {
this.client = client; this.client = client;
this.sliceToNodeMetadata = sliceToNodeMetadata; this.credentialStore = credentialStore;
this.nodeMetadataAdapter = Functions.compose(addLoginCredentials, checkNotNull(nodeMetadataAdapter,
"nodeMetadataAdapter"));
} }
private final Function<NodeMetadata, NodeMetadata> addLoginCredentials = new Function<NodeMetadata, NodeMetadata>() {
@Override
public NodeMetadata apply(NodeMetadata arg0) {
return credentialStore.containsKey("node#" + arg0.getId()) ? NodeMetadataBuilder.fromNodeMetadata(arg0)
.credentials(LoginCredentials.fromCredentials(credentialStore.get("node#" + arg0.getId()))).build()
: arg0;
}
@Override
public String toString() {
return "addLoginCredentialsFromCredentialStore()";
}
};
@Override @Override
public NodeMetadata getNode(String id) { public NodeMetadata getNode(String id) {
int sliceId = Integer.parseInt(id); int sliceId = Integer.parseInt(id);
Slice slice = client.getSlice(sliceId); Slice slice = client.getSlice(sliceId);
return slice == null ? null : sliceToNodeMetadata.apply(slice); return slice == null ? null : nodeMetadataAdapter.apply(slice);
} }
} }

View File

@ -25,12 +25,14 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.inject.Singleton; import javax.inject.Singleton;
import org.jclouds.compute.config.ComputeServiceAdapterContextModule.AddDefaultCredentialsToImage;
import org.jclouds.compute.domain.Image; import org.jclouds.compute.domain.Image;
import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.logging.Logger; import org.jclouds.logging.Logger;
import org.jclouds.slicehost.SlicehostClient; import org.jclouds.slicehost.SlicehostClient;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.common.base.Functions;
import com.google.common.base.Supplier; import com.google.common.base.Supplier;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -47,22 +49,25 @@ public class SlicehostImageSupplier implements Supplier<Set<? extends Image>> {
protected Logger logger = Logger.NULL; protected Logger logger = Logger.NULL;
protected final SlicehostClient sync; protected final SlicehostClient sync;
protected final Function<org.jclouds.slicehost.domain.Image, Image> slicehostImageToImage; protected final Function<org.jclouds.slicehost.domain.Image, Image> cloudServersImageToImage;
protected final AddDefaultCredentialsToImage addDefaultCredentialsToImage;
@Inject @Inject
SlicehostImageSupplier(SlicehostClient sync, SlicehostImageSupplier(SlicehostClient sync,
Function<org.jclouds.slicehost.domain.Image, Image> slicehostImageToImage) { Function<org.jclouds.slicehost.domain.Image, Image> cloudServersImageToImage,
AddDefaultCredentialsToImage addDefaultCredentialsToImage) {
this.sync = sync; this.sync = sync;
this.slicehostImageToImage = slicehostImageToImage; this.cloudServersImageToImage = cloudServersImageToImage;
this.addDefaultCredentialsToImage = addDefaultCredentialsToImage;
} }
@Override @Override
public Set<? extends Image> get() { public Set<? extends Image> get() {
Set<Image> images; Set<Image> images;
logger.debug(">> providing images"); logger.debug(">> providing images");
images = Sets.newLinkedHashSet(Iterables.transform(sync.listImages(), slicehostImageToImage)); images = Sets.<Image> newLinkedHashSet(Iterables.transform(sync.listImages(), Functions.compose(
addDefaultCredentialsToImage, cloudServersImageToImage)));
logger.debug("<< images(%d)", images.size()); logger.debug("<< images(%d)", images.size());
return images; return images;
} }
} }

View File

@ -35,11 +35,9 @@ import org.jclouds.compute.domain.OsFamily;
import org.jclouds.compute.domain.Processor; import org.jclouds.compute.domain.Processor;
import org.jclouds.compute.domain.Volume; import org.jclouds.compute.domain.Volume;
import org.jclouds.compute.domain.VolumeBuilder; import org.jclouds.compute.domain.VolumeBuilder;
import org.jclouds.domain.Credentials;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.domain.LocationBuilder; import org.jclouds.domain.LocationBuilder;
import org.jclouds.domain.LocationScope; import org.jclouds.domain.LocationScope;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.slicehost.compute.config.SlicehostComputeServiceDependenciesModule; import org.jclouds.slicehost.compute.config.SlicehostComputeServiceDependenciesModule;
import org.jclouds.slicehost.domain.Slice; import org.jclouds.slicehost.domain.Slice;
import org.jclouds.slicehost.xml.SliceHandlerTest; import org.jclouds.slicehost.xml.SliceHandlerTest;
@ -57,28 +55,6 @@ import com.google.common.collect.ImmutableSet;
public class SliceToNodeMetadataTest { public class SliceToNodeMetadataTest {
Location provider = new LocationBuilder().scope(LocationScope.ZONE).id("dallas").description("description").build(); Location provider = new LocationBuilder().scope(LocationScope.ZONE).id("dallas").description("description").build();
@Test
public void testApplyWhereImageAndHardwareNotFoundButCredentialsFound() throws UnknownHostException {
LoginCredentials creds = LoginCredentials.builder().user("root").password("abdce").build();
Map<Slice.Status, NodeState> sliceStateToNodeState = SlicehostComputeServiceDependenciesModule.sliceStatusToNodeState;
Set<org.jclouds.compute.domain.Image> images = ImmutableSet.of();
Set<org.jclouds.compute.domain.Hardware> hardwares = ImmutableSet.of();
Slice slice = SliceHandlerTest.parseSlice();
SliceToNodeMetadata parser = new SliceToNodeMetadata(sliceStateToNodeState, ImmutableMap
.<String, Credentials> of("node#1", creds), Suppliers.<Set<? extends Image>> ofInstance(images), Suppliers
.ofInstance(provider), Suppliers.<Set<? extends Hardware>> ofInstance(hardwares));
NodeMetadata metadata = parser.apply(slice);
assertEquals(
metadata,
new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(ImmutableSet.of("174.143.212.229"))
.privateAddresses(ImmutableSet.of("10.176.164.199")).group("jclouds").imageId("2").id("1")
.providerId("1").name("jclouds-foo").hostname("jclouds-foo").location(provider).credentials(creds)
.userMetadata(ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build());
}
@Test @Test
public void testApplyWhereImageAndHardwareNotFound() throws UnknownHostException { public void testApplyWhereImageAndHardwareNotFound() throws UnknownHostException {
Map<Slice.Status, NodeState> sliceStateToNodeState = SlicehostComputeServiceDependenciesModule.sliceStatusToNodeState; Map<Slice.Status, NodeState> sliceStateToNodeState = SlicehostComputeServiceDependenciesModule.sliceStatusToNodeState;
@ -86,17 +62,15 @@ public class SliceToNodeMetadataTest {
Set<org.jclouds.compute.domain.Hardware> hardwares = ImmutableSet.of(); Set<org.jclouds.compute.domain.Hardware> hardwares = ImmutableSet.of();
Slice slice = SliceHandlerTest.parseSlice(); Slice slice = SliceHandlerTest.parseSlice();
SliceToNodeMetadata parser = new SliceToNodeMetadata(sliceStateToNodeState, ImmutableMap SliceToNodeMetadata parser = new SliceToNodeMetadata(sliceStateToNodeState, Suppliers
.<String, Credentials> of(), Suppliers.<Set<? extends Image>> ofInstance(images), Suppliers .<Set<? extends Image>> ofInstance(images), Suppliers.ofInstance(provider), Suppliers
.ofInstance(provider), Suppliers.<Set<? extends Hardware>> ofInstance(hardwares)); .<Set<? extends Hardware>> ofInstance(hardwares));
NodeMetadata metadata = parser.apply(slice); NodeMetadata metadata = parser.apply(slice);
assertEquals( assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(
metadata, ImmutableSet.of("174.143.212.229")).privateAddresses(ImmutableSet.of("10.176.164.199")).group("jclouds")
new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(ImmutableSet.of("174.143.212.229")) .imageId("2").id("1").providerId("1").name("jclouds-foo").hostname("jclouds-foo").location(provider)
.privateAddresses(ImmutableSet.of("10.176.164.199")).group("jclouds").imageId("2").id("1")
.providerId("1").name("jclouds-foo").hostname("jclouds-foo").location(provider)
.userMetadata(ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build()); .userMetadata(ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build());
} }
@ -108,24 +82,18 @@ public class SliceToNodeMetadataTest {
Set<org.jclouds.compute.domain.Hardware> hardwares = ImmutableSet.of(); Set<org.jclouds.compute.domain.Hardware> hardwares = ImmutableSet.of();
Slice slice = SliceHandlerTest.parseSlice(); Slice slice = SliceHandlerTest.parseSlice();
SliceToNodeMetadata parser = new SliceToNodeMetadata(sliceStateToNodeState, ImmutableMap SliceToNodeMetadata parser = new SliceToNodeMetadata(sliceStateToNodeState, Suppliers
.<String, Credentials> of(), Suppliers.<Set<? extends Image>> ofInstance(images), Suppliers .<Set<? extends Image>> ofInstance(images), Suppliers.ofInstance(provider), Suppliers
.ofInstance(provider), Suppliers.<Set<? extends Hardware>> ofInstance(hardwares)); .<Set<? extends Hardware>> ofInstance(hardwares));
NodeMetadata metadata = parser.apply(slice); NodeMetadata metadata = parser.apply(slice);
assertEquals( assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(
metadata, ImmutableSet.of("174.143.212.229")).privateAddresses(ImmutableSet.of("10.176.164.199")).group("jclouds")
new NodeMetadataBuilder() .imageId("2").operatingSystem(
.state(NodeState.PENDING)
.publicAddresses(ImmutableSet.of("174.143.212.229"))
.privateAddresses(ImmutableSet.of("10.176.164.199"))
.group("jclouds")
.imageId("2")
.operatingSystem(
new OperatingSystem.Builder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2") new OperatingSystem.Builder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2")
.is64Bit(true).build()).id("1").providerId("1").name("jclouds-foo") .is64Bit(true).build()).id("1").providerId("1").name("jclouds-foo").hostname(
.hostname("jclouds-foo").location(provider) "jclouds-foo").location(provider).userMetadata(
.userMetadata(ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build()); ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build());
} }
@Test @Test
@ -135,32 +103,21 @@ public class SliceToNodeMetadataTest {
Set<org.jclouds.compute.domain.Hardware> hardwares = ImmutableSet.of(FlavorToHardwareTest.convertFlavor()); Set<org.jclouds.compute.domain.Hardware> hardwares = ImmutableSet.of(FlavorToHardwareTest.convertFlavor());
Slice slice = SliceHandlerTest.parseSlice(); Slice slice = SliceHandlerTest.parseSlice();
SliceToNodeMetadata parser = new SliceToNodeMetadata(sliceStateToNodeState, ImmutableMap SliceToNodeMetadata parser = new SliceToNodeMetadata(sliceStateToNodeState, Suppliers
.<String, Credentials> of(), Suppliers.<Set<? extends Image>> ofInstance(images), Suppliers .<Set<? extends Image>> ofInstance(images), Suppliers.ofInstance(provider), Suppliers
.ofInstance(provider), Suppliers.<Set<? extends Hardware>> ofInstance(hardwares)); .<Set<? extends Hardware>> ofInstance(hardwares));
NodeMetadata metadata = parser.apply(slice); NodeMetadata metadata = parser.apply(slice);
assertEquals( assertEquals(metadata, new NodeMetadataBuilder().state(NodeState.PENDING).publicAddresses(
metadata, ImmutableSet.of("174.143.212.229")).privateAddresses(ImmutableSet.of("10.176.164.199")).group("jclouds")
new NodeMetadataBuilder() .imageId("2").hardware(
.state(NodeState.PENDING) new HardwareBuilder().ids("1").name("256 slice").processors(
.publicAddresses(ImmutableSet.of("174.143.212.229")) ImmutableList.of(new Processor(0.25, 1.0))).ram(256).volumes(
.privateAddresses(ImmutableSet.of("10.176.164.199")) ImmutableList.of(new VolumeBuilder().type(Volume.Type.LOCAL).size(1.0f).durable(true)
.group("jclouds") .bootDevice(true).build())).build()).operatingSystem(
.imageId("2")
.hardware(
new HardwareBuilder()
.ids("1")
.name("256 slice")
.processors(ImmutableList.of(new Processor(0.25, 1.0)))
.ram(256)
.volumes(
ImmutableList.of(new VolumeBuilder().type(Volume.Type.LOCAL).size(1.0f)
.durable(true).bootDevice(true).build())).build())
.operatingSystem(
new OperatingSystem.Builder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2") new OperatingSystem.Builder().family(OsFamily.CENTOS).description("CentOS 5.2").version("5.2")
.is64Bit(true).build()).id("1").providerId("1").name("jclouds-foo") .is64Bit(true).build()).id("1").providerId("1").name("jclouds-foo").hostname(
.hostname("jclouds-foo").location(provider) "jclouds-foo").location(provider).userMetadata(
.userMetadata(ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build()); ImmutableMap.of("Server Label", "Web Head 1", "Image Version", "2.1")).build());
} }
} }

View File

@ -31,7 +31,6 @@ import org.jclouds.compute.reference.ComputeServiceConstants;
import org.jclouds.domain.Location; import org.jclouds.domain.Location;
import org.jclouds.domain.LocationBuilder; import org.jclouds.domain.LocationBuilder;
import org.jclouds.domain.LocationScope; import org.jclouds.domain.LocationScope;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.json.Json; import org.jclouds.json.Json;
import org.jclouds.json.config.GsonModule; import org.jclouds.json.config.GsonModule;
import org.jclouds.slicehost.xml.ImageHandlerTest; import org.jclouds.slicehost.xml.ImageHandlerTest;
@ -54,8 +53,7 @@ public class SlicehostImageToImageTest {
.name("CentOS 5.2") .name("CentOS 5.2")
.operatingSystem( .operatingSystem(
new OperatingSystem.Builder().family(OsFamily.CENTOS).version("5.2").description("CentOS 5.2") new OperatingSystem.Builder().family(OsFamily.CENTOS).version("5.2").description("CentOS 5.2")
.is64Bit(true).build()).description("CentOS 5.2") .is64Bit(true).build()).description("CentOS 5.2").ids("2").build());
.defaultCredentials(LoginCredentials.builder().user("root").build()).ids("2").build());
} }
@Test @Test
@ -67,8 +65,7 @@ public class SlicehostImageToImageTest {
.operatingSystem( .operatingSystem(
new OperatingSystem.Builder().family(OsFamily.UBUNTU).version("10.10") new OperatingSystem.Builder().family(OsFamily.UBUNTU).version("10.10")
.description("Ubuntu 10.10 (maverick) 32-bit").build()) .description("Ubuntu 10.10 (maverick) 32-bit").build())
.description("Ubuntu 10.10 (maverick) 32-bit") .description("Ubuntu 10.10 (maverick) 32-bit").ids("70").build());
.defaultCredentials(LoginCredentials.builder().user("root").build()).ids("70").build());
} }
public static Image convertImage() { public static Image convertImage() {