Merge pull request #254 from grkvlt/master

Issue 779: Fix password/privateKey override issues with providers
This commit is contained in:
Adrian Cole 2011-12-18 13:37:09 -08:00
commit e942d58fa7
10 changed files with 195 additions and 104 deletions

View File

@ -163,7 +163,7 @@ public class EC2TemplateBuilderTest {
final Image image = new ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location) final Image image = new ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location)
.operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "hvm", "ubuntu", true)) .operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "hvm", "ubuntu", true))
.description("description").version("1.0").defaultCredentials(new LoginCredentials("root", null, null, false)) .description("description").version("1.0").defaultCredentials(new LoginCredentials("root", false))
.build(); .build();
Map<RegionAndName, Image> imageMap = ImmutableMap.of( Map<RegionAndName, Image> imageMap = ImmutableMap.of(
new RegionAndName(image.getLocation().getId(), image.getProviderId()), image); new RegionAndName(image.getLocation().getId(), image.getProviderId()), image);
@ -187,11 +187,11 @@ public class EC2TemplateBuilderTest {
final Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of( final Supplier<Set<? extends Image>> images = Suppliers.<Set<? extends Image>> ofInstance(ImmutableSet.<Image> of(
new ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location) new ImageBuilder().providerId("cc-image").name("image").id("us-east-1/cc-image").location(location)
.operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "hvm", "ubuntu", true)) .operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "hvm", "ubuntu", true))
.description("description").version("1.0").defaultCredentials(new LoginCredentials("root", null, null, false)) .description("description").version("1.0").defaultCredentials(new LoginCredentials("root", false))
.build(), .build(),
new ImageBuilder().providerId("normal-image").name("image").id("us-east-1/normal-image").location(location) new ImageBuilder().providerId("normal-image").name("image").id("us-east-1/normal-image").location(location)
.operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "paravirtual", "ubuntu", true)) .operatingSystem(new OperatingSystem(OsFamily.UBUNTU, null, "1.0", "paravirtual", "ubuntu", true))
.description("description").version("1.0").defaultCredentials(new LoginCredentials("root", null, null, false)) .description("description").version("1.0").defaultCredentials(new LoginCredentials("root", false))
.build())); .build()));
// weird compilation error means have to cast this - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365818 // weird compilation error means have to cast this - see https://bugs.eclipse.org/bugs/show_bug.cgi?id=365818

View File

@ -61,14 +61,14 @@ public class EC2ImageParserTest {
assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem( assertEquals(Iterables.get(result, 0), new ImageBuilder().operatingSystem(
new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).arch("paravirtual").version("").description( new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).arch("paravirtual").version("").description(
"137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build()).description("Amazon") "137112412989/amzn-ami-0.9.7-beta.i386-ebs").is64Bit(false).build()).description("Amazon")
.defaultCredentials(new LoginCredentials("ec2-user", null, null, false)).id("us-east-1/ami-82e4b5c7").providerId( .defaultCredentials(new LoginCredentials("ec2-user", false)).id("us-east-1/ami-82e4b5c7").providerId(
"ami-82e4b5c7").location(defaultLocation).userMetadata( "ami-82e4b5c7").location(defaultLocation).userMetadata(
ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).build()); ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).build());
assertEquals(Iterables.get(result, 3), new ImageBuilder().operatingSystem( assertEquals(Iterables.get(result, 3), new ImageBuilder().operatingSystem(
new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).arch("paravirtual").version("").description( new OperatingSystem.Builder().family(OsFamily.UNRECOGNIZED).arch("paravirtual").version("").description(
"amzn-ami-us-west-1/amzn-ami-0.9.7-beta.x86_64.manifest.xml").is64Bit(true).build()) "amzn-ami-us-west-1/amzn-ami-0.9.7-beta.x86_64.manifest.xml").is64Bit(true).build())
.description("Amazon Linux AMI x86_64 S3").defaultCredentials(new LoginCredentials("ec2-user", null, null, false)).id( .description("Amazon Linux AMI x86_64 S3").defaultCredentials(new LoginCredentials("ec2-user", false)).id(
"us-east-1/ami-f2e4b5b7").providerId("ami-f2e4b5b7").location(defaultLocation).userMetadata( "us-east-1/ami-f2e4b5b7").providerId("ami-f2e4b5b7").location(defaultLocation).userMetadata(
ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).build()); ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).build());
} }

View File

@ -661,10 +661,20 @@ public class BaseComputeService implements ComputeService {
Builder builder = LoginCredentials.builder(node.getCredentials()); Builder builder = LoginCredentials.builder(node.getCredentials());
if (options.getLoginUser() != null) if (options.getLoginUser() != null)
builder.user(options.getLoginUser()); builder.user(options.getLoginUser());
if (options.getLoginPassword() != null) if (options.hasLoginPasswordOption()) {
if (options.hasLoginPassword()) {
builder.password(options.getLoginPassword()); builder.password(options.getLoginPassword());
if (options.getLoginPrivateKey() != null) } else {
builder.noPassword();
}
}
if (options.hasLoginPrivateKeyOption()) {
if (options.hasLoginPrivateKey()) {
builder.privateKey(options.getLoginPrivateKey()); builder.privateKey(options.getLoginPrivateKey());
} else {
builder.noPrivateKey();
}
}
if (options.shouldAuthenticateSudo() != null) if (options.shouldAuthenticateSudo() != null)
builder.authenticateSudo(true); builder.authenticateSudo(true);
return NodeMetadataBuilder.fromNodeMetadata(node).credentials(builder.build()).build(); return NodeMetadataBuilder.fromNodeMetadata(node).credentials(builder.build()).build();

View File

@ -21,6 +21,7 @@ package org.jclouds.compute.options;
import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.base.Optional;
import org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials; import org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
@ -38,7 +39,7 @@ public class RunScriptOptions {
* Default options. The default settings are: * Default options. The default settings are:
* <ul> * <ul>
* <li>override the credentials with ones supplied in call to * <li>override the credentials with ones supplied in call to
* {@link org.jclouds.compute.ComputeService#runScriptOnNodesWithTag}</li> * {@link org.jclouds.compute.ComputeService#runScriptOnNodesMatching}</li>
* <li>run the script as root (versus running with current privileges)</li> * <li>run the script as root (versus running with current privileges)</li>
* </ul> * </ul>
*/ */
@ -185,8 +186,8 @@ public class RunScriptOptions {
protected String loginUser; protected String loginUser;
protected Boolean authenticateSudo; protected Boolean authenticateSudo;
protected String loginPassword; protected Optional<String> loginPassword;
protected String loginPrivateKey; protected Optional<String> loginPrivateKey;
@Deprecated @Deprecated
public RunScriptOptions overrideCredentialsWith(Credentials overridingCredentials) { public RunScriptOptions overrideCredentialsWith(Credentials overridingCredentials) {
@ -196,8 +197,8 @@ public class RunScriptOptions {
public RunScriptOptions overrideLoginCredentials(LoginCredentials overridingCredentials) { public RunScriptOptions overrideLoginCredentials(LoginCredentials overridingCredentials) {
checkNotNull(overridingCredentials, "overridingCredentials"); checkNotNull(overridingCredentials, "overridingCredentials");
this.loginUser = overridingCredentials.getUser(); this.loginUser = overridingCredentials.getUser();
this.loginPassword = overridingCredentials.getPassword(); this.loginPassword = overridingCredentials.getOptionalPassword();
this.loginPrivateKey = overridingCredentials.getPrivateKey(); this.loginPrivateKey = overridingCredentials.getOptionalPrivateKey();
this.authenticateSudo = overridingCredentials.shouldAuthenticateSudo() ? true : null; this.authenticateSudo = overridingCredentials.shouldAuthenticateSudo() ? true : null;
return this; return this;
} }
@ -217,22 +218,24 @@ public class RunScriptOptions {
public RunScriptOptions overrideLoginCredentialWith(String loginCredential) { public RunScriptOptions overrideLoginCredentialWith(String loginCredential) {
checkNotNull(loginCredential, "loginCredential"); checkNotNull(loginCredential, "loginCredential");
if (CredentialUtils.isPrivateKeyCredential(loginCredential)) { if (CredentialUtils.isPrivateKeyCredential(loginCredential)) {
this.loginPrivateKey = loginCredential; this.loginPrivateKey = Optional.of(loginCredential);
this.loginPassword = Optional.absent();
} else { } else {
this.loginPassword = loginCredential; this.loginPrivateKey = Optional.absent();
this.loginPassword = Optional.of(loginCredential);
} }
return this; return this;
} }
public RunScriptOptions overrideLoginPassword(String password) { public RunScriptOptions overrideLoginPassword(String password) {
checkNotNull(password, "password"); checkNotNull(password, "password");
this.loginPassword = password; this.loginPassword = Optional.of(password);
return this; return this;
} }
public RunScriptOptions overrideLoginPrivateKey(String privateKey) { public RunScriptOptions overrideLoginPrivateKey(String privateKey) {
checkNotNull(privateKey, "privateKey"); checkNotNull(privateKey, "privateKey");
this.loginPrivateKey = privateKey; this.loginPrivateKey = Optional.of(privateKey);
return this; return this;
} }
@ -339,8 +342,21 @@ public class RunScriptOptions {
*/ */
@Deprecated @Deprecated
public Credentials getOverridingCredentials() { public Credentials getOverridingCredentials() {
return DefaultCredentialsFromImageOrOverridingCredentials.overrideDefaultCredentialsWithOptionsIfPresent(null, return DefaultCredentialsFromImageOrOverridingCredentials.overrideDefaultCredentialsWithOptionsIfPresent(null, this);
this); }
/**
* @return true if the login password has been configured
*/
public boolean hasLoginPasswordOption() {
return loginPassword != null;
}
/**
* @return true if the login password is set
*/
public boolean hasLoginPassword() {
return hasLoginPasswordOption() && loginPassword.isPresent();
} }
/** /**
@ -351,7 +367,21 @@ public class RunScriptOptions {
*/ */
@Nullable @Nullable
public String getLoginPassword() { public String getLoginPassword() {
return loginPassword; return hasLoginPassword() ? loginPassword.get() : null;
}
/**
* @return true if the login ssh key has been configured
*/
public boolean hasLoginPrivateKeyOption() {
return loginPrivateKey != null;
}
/**
* @return true if the login ssh key is set
*/
public boolean hasLoginPrivateKey() {
return hasLoginPrivateKeyOption() && loginPrivateKey.isPresent();
} }
/** /**
@ -362,7 +392,7 @@ public class RunScriptOptions {
*/ */
@Nullable @Nullable
public String getLoginPrivateKey() { public String getLoginPrivateKey() {
return loginPrivateKey; return hasLoginPrivateKey() ? loginPrivateKey.get() : null;
} }
/** /**

View File

@ -286,7 +286,7 @@ public abstract class BaseComputeServiceLiveTest extends BaseVersionedServiceLiv
runningInGroup(group), runningInGroup(group),
"echo I put a bad password", "echo I put a bad password",
wrapInInitScript(false).runAsRoot(false).overrideLoginCredentials( wrapInInitScript(false).runAsRoot(false).overrideLoginCredentials(
LoginCredentials.builder().user(good.identity).credential(null).privateKey(null).password("romeo") LoginCredentials.builder().user(good.identity).noPrivateKey().password("romeo")
.build())); .build()));
assert responses.size() == 0 : "shouldn't pass with a bad password\n" + responses; assert responses.size() == 0 : "shouldn't pass with a bad password\n" + responses;
} catch (AssertionError e) { } catch (AssertionError e) {

View File

@ -23,6 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.List;
import com.google.common.base.Objects;
import org.jclouds.util.Strings2; import org.jclouds.util.Strings2;
import com.google.common.base.Splitter; import com.google.common.base.Splitter;
@ -81,35 +82,27 @@ public class Credentials {
return new Builder<Credentials>().identity(identity).credential(credential); return new Builder<Credentials>().identity(identity).credential(credential);
} }
@Override
public String toString() {
return "[identity=" + identity + ", credential=" + credential + "]";
}
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 31; return Objects.hashCode(identity, credential);
int result = 1;
result = prime * result + ((credential == null) ? 0 : credential.hashCode());
result = prime * result + ((identity == null) ? 0 : identity.hashCode());
return result;
} }
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) if (this == obj)
return true; return true;
if (obj == null)
return false;
if (!(obj instanceof Credentials)) if (!(obj instanceof Credentials))
return false; return false;
Credentials other = (Credentials) obj; Credentials other = (Credentials) obj;
if (credential == null) { if (!Objects.equal(identity, other.identity))
if (other.credential != null)
return false; return false;
} else if (!credential.equals(other.credential)) if (!Objects.equal(credential, other.credential))
return false;
if (identity == null) {
if (other.identity != null)
return false;
} else if (!identity.equals(other.identity))
return false; return false;
return true; return true;
} }
} }

View File

@ -18,6 +18,8 @@
*/ */
package org.jclouds.domain; package org.jclouds.domain;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.util.CredentialUtils; import org.jclouds.util.CredentialUtils;
@ -25,7 +27,6 @@ import org.jclouds.util.CredentialUtils;
* @author Adrian Cole * @author Adrian Cole
*/ */
public class LoginCredentials extends Credentials { public class LoginCredentials extends Credentials {
public static Builder builder(Credentials creds) { public static Builder builder(Credentials creds) {
if (creds == null) if (creds == null)
return builder(); return builder();
@ -40,10 +41,9 @@ public class LoginCredentials extends Credentials {
} }
public static class Builder extends Credentials.Builder<LoginCredentials> { public static class Builder extends Credentials.Builder<LoginCredentials> {
private boolean authenticateSudo; private boolean authenticateSudo;
private String password; private Optional<String> password;
private String privateKey; private Optional<String> privateKey;
public Builder identity(String identity) { public Builder identity(String identity) {
return Builder.class.cast(super.identity(identity)); return Builder.class.cast(super.identity(identity));
@ -54,20 +54,30 @@ public class LoginCredentials extends Credentials {
} }
public Builder password(String password) { public Builder password(String password) {
this.password = password; this.password = Optional.fromNullable(password);
return this;
}
public Builder noPassword() {
this.password = Optional.absent();
return this; return this;
} }
public Builder privateKey(String privateKey) { public Builder privateKey(String privateKey) {
this.privateKey = privateKey; this.privateKey = Optional.fromNullable(privateKey);
return this;
}
public Builder noPrivateKey() {
this.privateKey = Optional.absent();
return this; return this;
} }
public Builder credential(String credential) { public Builder credential(String credential) {
if (CredentialUtils.isPrivateKeyCredential(credential)) if (CredentialUtils.isPrivateKeyCredential(credential))
return privateKey(credential); return noPassword().privateKey(credential);
else if (credential != null) else if (credential != null)
return password(credential); return password(credential).noPrivateKey();
return this; return this;
} }
@ -84,12 +94,21 @@ public class LoginCredentials extends Credentials {
} }
private final boolean authenticateSudo; private final boolean authenticateSudo;
private final String password; private final Optional<String> password;
private final String privateKey; private final Optional<String> privateKey;
public LoginCredentials(String username, @Nullable String password, @Nullable String privateKey, public LoginCredentials(String username, boolean authenticateSudo) {
boolean authenticateSudo) { this(username, Optional.<String>absent(), Optional.<String>absent(), authenticateSudo);
super(username, CredentialUtils.isPrivateKeyCredential(privateKey) ? privateKey : password); }
public LoginCredentials(String username, @Nullable String password, @Nullable String privateKey, boolean authenticateSudo) {
this(username, Optional.fromNullable(password), Optional.fromNullable(privateKey), authenticateSudo);
}
public LoginCredentials(String username, @Nullable Optional<String> password, @Nullable Optional<String> privateKey, boolean authenticateSudo) {
super(username, privateKey != null && privateKey.isPresent() && CredentialUtils.isPrivateKeyCredential(privateKey.get())
? privateKey.get()
: (password != null && password.isPresent() ? password.get() : null));
this.authenticateSudo = authenticateSudo; this.authenticateSudo = authenticateSudo;
this.password = password; this.password = password;
this.privateKey = privateKey; this.privateKey = privateKey;
@ -102,19 +121,63 @@ public class LoginCredentials extends Credentials {
return identity; return identity;
} }
/**
* @return true if a password is available
*/
public boolean hasPassword() {
return password != null && password.isPresent();
}
/**
* @return true if a password was set
*/
public boolean hasPasswordOption() {
return password != null;
}
/** /**
* @return the password of the login user or null * @return the password of the login user or null
*/ */
@Nullable @Nullable
public String getPassword() { public String getPassword() {
return hasPassword() ? password.get() : null;
}
/**
* @return the optional password of the user or null
*/
@Nullable
public Optional<String> getOptionalPassword() {
return password; return password;
} }
/**
* @return true if a private key is available
*/
public boolean hasPrivateKey() {
return privateKey != null && privateKey.isPresent();
}
/**
* @return true if a password was set
*/
public boolean hasPrivateKeyOption() {
return privateKey != null;
}
/** /**
* @return the private ssh key of the user or null * @return the private ssh key of the user or null
*/ */
@Nullable @Nullable
public String getPrivateKey() { public String getPrivateKey() {
return hasPrivateKey() ? privateKey.get() : null;
}
/**
* @return the optional private ssh key of the user or null
*/
@Nullable
public Optional<String> getOptionalPrivateKey() {
return privateKey; return privateKey;
} }
@ -132,47 +195,27 @@ public class LoginCredentials extends Credentials {
@Override @Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().user(identity).password(password).privateKey(privateKey).authenticateSudo(authenticateSudo); Builder builder = new Builder().user(identity).authenticateSudo(authenticateSudo);
if (password != null) {
if (password.isPresent()) {
builder = builder.password(password.get());
} else {
builder = builder.noPassword();
} }
}
@Override if (privateKey != null) {
public int hashCode() { if (privateKey.isPresent()) {
final int prime = 31; builder = builder.privateKey(privateKey.get());
int result = super.hashCode(); } else {
result = prime * result + (authenticateSudo ? 1231 : 1237); builder = builder.noPrivateKey();
result = prime * result + ((password == null) ? 0 : password.hashCode()); }
result = prime * result + ((privateKey == null) ? 0 : privateKey.hashCode()); }
return result; return builder;
} }
@Override @Override
public String toString() { public String toString() {
return "[user=" + getUser() + ", passwordPresent=" + (password != null) + ", privateKeyPresent=" return "[user=" + getUser() + ", passwordPresent=" + hasPassword() + ", privateKeyPresent="
+ (privateKey != null) + ", shouldAuthenticateSudo=" + authenticateSudo + "]"; + hasPrivateKey() + ", shouldAuthenticateSudo=" + authenticateSudo + "]";
} }
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (!super.equals(obj))
return false;
if (getClass() != obj.getClass())
return false;
LoginCredentials other = (LoginCredentials) obj;
if (authenticateSudo != other.authenticateSudo)
return false;
if (password == null) {
if (other.password != null)
return false;
} else if (!password.equals(other.password))
return false;
if (privateKey == null) {
if (other.privateKey != null)
return false;
} else if (!privateKey.equals(other.privateKey))
return false;
return true;
}
} }

View File

@ -19,6 +19,8 @@
package org.jclouds.rest; package org.jclouds.rest;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.IOException; import java.io.IOException;
@ -26,6 +28,7 @@ import java.io.InputStream;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import com.google.common.base.Joiner;
import org.jclouds.crypto.PemsTest; import org.jclouds.crypto.PemsTest;
import org.jclouds.domain.Credentials; import org.jclouds.domain.Credentials;
import org.jclouds.domain.LoginCredentials; import org.jclouds.domain.LoginCredentials;
@ -53,8 +56,12 @@ public class CredentialStoreModuleTest {
@DataProvider(name = "credentials") @DataProvider(name = "credentials")
public Object[][] createData() { public Object[][] createData() {
return new Object[][] { { "root", PemsTest.PRIVATE_KEY }, { "identity", "Base64==" }, return new Object[][] {
{ "user@domain", "pa$sw@rd" }, { "user", "unic₪de" } }; { "root", PemsTest.PRIVATE_KEY },
{ "identity", "Base64==" },
{ "user@domain", "pa$sw@rd" },
{ "user", "unic₪de" }
};
} }
@Test(dataProvider = "credentials") @Test(dataProvider = "credentials")
@ -172,6 +179,10 @@ public class CredentialStoreModuleTest {
Credentials creds, String expected) throws IOException { Credentials creds, String expected) throws IOException {
assertEquals(store.size(), 1); assertEquals(store.size(), 1);
assertEquals(map.size(), 1); assertEquals(map.size(), 1);
assertTrue(store.containsKey(key));
//System.out.println("YYYYYY " + store.get(key));
//System.err.println("YYYYYY " + store.get(key));
assertTrue(store.containsValue(creds));
// checkRepeatedRead // checkRepeatedRead
assertEquals(store.get(key), creds); assertEquals(store.get(key), creds);
assertEquals(store.get(key), creds); assertEquals(store.get(key), creds);
@ -187,6 +198,10 @@ public class CredentialStoreModuleTest {
protected void put(Map<String, InputStream> map, Map<String, Credentials> store, String key, Credentials creds) { protected void put(Map<String, InputStream> map, Map<String, Credentials> store, String key, Credentials creds) {
assertEquals(store.size(), 0); assertEquals(store.size(), 0);
assertEquals(map.size(), 0); assertEquals(map.size(), 0);
assertFalse(store.containsKey(key));
assertFalse(store.containsValue(creds));
store.put(key, creds); store.put(key, creds);
//System.err.printf("XXXXXXXXXX\n\nStore has %n: %s\n\nXXXXXXXXXX\n", store.size(), Joiner.on(", ").withKeyValueSeparator("=").useForNull("<<EMPTY>>").join(store));
//System.out.printf("XXXXXXXXXX\n\nStore has %n: %s\n\nXXXXXXXXXX\n", store.size(), Joiner.on(", ").withKeyValueSeparator("=").useForNull("<<EMPTY>>").join(store));
} }
} }

View File

@ -66,7 +66,7 @@ public class AWSEC2ImageParserTest {
.description("ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml") .description("ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml")
.is64Bit(false).build()) .is64Bit(false).build())
.description("ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml") .description("ubuntu-images-us/ubuntu-hardy-8.04-i386-server-20091130.manifest.xml")
.defaultCredentials(new LoginCredentials("ubuntu", null, null, false)).id("us-east-1/ami-7e28ca17") .defaultCredentials(new LoginCredentials("ubuntu", false)).id("us-east-1/ami-7e28ca17")
.providerId("ami-7e28ca17").location(defaultLocation).version("20091130") .providerId("ami-7e28ca17").location(defaultLocation).version("20091130")
.userMetadata(ImmutableMap.of("owner", "099720109477", "rootDeviceType", "instance-store")).build()); .userMetadata(ImmutableMap.of("owner", "099720109477", "rootDeviceType", "instance-store")).build());
@ -77,7 +77,7 @@ public class AWSEC2ImageParserTest {
new OperatingSystem.Builder().family(OsFamily.UBUNTU).arch("paravirtual").version("8.04") new OperatingSystem.Builder().family(OsFamily.UBUNTU).arch("paravirtual").version("8.04")
.description("alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml").is64Bit(false) .description("alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml").is64Bit(false)
.build()).description("alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml") .build()).description("alestic/ubuntu-8.04-hardy-base-20080905.manifest.xml")
.defaultCredentials(new LoginCredentials("ubuntu", null, null, false)).id("us-east-1/ami-c0fa1ea9") .defaultCredentials(new LoginCredentials("ubuntu", false)).id("us-east-1/ami-c0fa1ea9")
.providerId("ami-c0fa1ea9").location(defaultLocation).version("20080905") .providerId("ami-c0fa1ea9").location(defaultLocation).version("20080905")
.userMetadata(ImmutableMap.of("owner", "063491364108", "rootDeviceType", "instance-store")).build()); .userMetadata(ImmutableMap.of("owner", "063491364108", "rootDeviceType", "instance-store")).build());
@ -89,7 +89,7 @@ public class AWSEC2ImageParserTest {
.description("099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827") .description("099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827")
.is64Bit(false).build()) .is64Bit(false).build())
.description("099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827") .description("099720109477/ebs/ubuntu-images/ubuntu-lucid-10.04-i386-server-20100827")
.defaultCredentials(new LoginCredentials("ubuntu", null, null, false)).id("us-east-1/ami-10f3a255") .defaultCredentials(new LoginCredentials("ubuntu", false)).id("us-east-1/ami-10f3a255")
.providerId("ami-10f3a255").location(defaultLocation).version("20100827") .providerId("ami-10f3a255").location(defaultLocation).version("20100827")
.userMetadata(ImmutableMap.of("owner", "099720109477", "rootDeviceType", "ebs")).build()); .userMetadata(ImmutableMap.of("owner", "099720109477", "rootDeviceType", "ebs")).build());
@ -107,7 +107,7 @@ public class AWSEC2ImageParserTest {
.description("vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml") .description("vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml")
.is64Bit(false).build()) .is64Bit(false).build())
.description("vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml") .description("vostok-builds/vostok-0.95-5622/vostok-0.95-5622.manifest.xml")
.defaultCredentials(new LoginCredentials("root", null, null, false)).id("us-east-1/ami-870de2ee") .defaultCredentials(new LoginCredentials("root", false)).id("us-east-1/ami-870de2ee")
.providerId("ami-870de2ee").location(defaultLocation).version("5622") .providerId("ami-870de2ee").location(defaultLocation).version("5622")
.userMetadata(ImmutableMap.of("owner", "133804938231", "rootDeviceType", "instance-store")).build()); .userMetadata(ImmutableMap.of("owner", "133804938231", "rootDeviceType", "instance-store")).build());
@ -124,7 +124,7 @@ public class AWSEC2ImageParserTest {
new OperatingSystem.Builder().family(OsFamily.CENTOS).arch("hvm").version("5.4") new OperatingSystem.Builder().family(OsFamily.CENTOS).arch("hvm").version("5.4")
.description("amazon/EC2 CentOS 5.4 HVM AMI").is64Bit(true).build()) .description("amazon/EC2 CentOS 5.4 HVM AMI").is64Bit(true).build())
.description("EC2 CentOS 5.4 HVM AMI") .description("EC2 CentOS 5.4 HVM AMI")
.defaultCredentials(new LoginCredentials("root", null, null, false)).id("us-east-1/ami-7ea24a17") .defaultCredentials(new LoginCredentials("root", false)).id("us-east-1/ami-7ea24a17")
.providerId("ami-7ea24a17").location(defaultLocation) .providerId("ami-7ea24a17").location(defaultLocation)
.userMetadata(ImmutableMap.of("owner", "206029621532", "rootDeviceType", "ebs")).build()); .userMetadata(ImmutableMap.of("owner", "206029621532", "rootDeviceType", "ebs")).build());
@ -141,7 +141,7 @@ public class AWSEC2ImageParserTest {
new OperatingSystem.Builder().family(OsFamily.CENTOS).arch("paravirtual").version("5.4") new OperatingSystem.Builder().family(OsFamily.CENTOS).arch("paravirtual").version("5.4")
.description("rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml").is64Bit(true) .description("rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml").is64Bit(true)
.build()).description("rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml") .build()).description("rightscale-us-east/CentOS_5.4_x64_v4.4.10.manifest.xml")
.defaultCredentials(new LoginCredentials("root", null, null, false)).id("us-east-1/ami-ccb35ea5") .defaultCredentials(new LoginCredentials("root", false)).id("us-east-1/ami-ccb35ea5")
.providerId("ami-ccb35ea5").location(defaultLocation).version("4.4.10") .providerId("ami-ccb35ea5").location(defaultLocation).version("4.4.10")
.userMetadata(ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store")).build()); .userMetadata(ImmutableMap.of("owner", "admin", "rootDeviceType", "instance-store")).build());
@ -165,7 +165,7 @@ public class AWSEC2ImageParserTest {
new OperatingSystem.Builder().family(OsFamily.AMZN_LINUX).arch("paravirtual") new OperatingSystem.Builder().family(OsFamily.AMZN_LINUX).arch("paravirtual")
.version("0.9.7-beta").description("137112412989/amzn-ami-0.9.7-beta.i386-ebs") .version("0.9.7-beta").description("137112412989/amzn-ami-0.9.7-beta.i386-ebs")
.is64Bit(false).build()).description("Amazon") .is64Bit(false).build()).description("Amazon")
.defaultCredentials(new LoginCredentials("ec2-user", null, null, false)).id("us-east-1/ami-82e4b5c7") .defaultCredentials(new LoginCredentials("ec2-user", false)).id("us-east-1/ami-82e4b5c7")
.providerId("ami-82e4b5c7").location(defaultLocation).version("0.9.7-beta") .providerId("ami-82e4b5c7").location(defaultLocation).version("0.9.7-beta")
.userMetadata(ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).build()); .userMetadata(ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).build());
@ -177,7 +177,7 @@ public class AWSEC2ImageParserTest {
.version("0.9.7-beta") .version("0.9.7-beta")
.description("amzn-ami-us-west-1/amzn-ami-0.9.7-beta.x86_64.manifest.xml").is64Bit(true) .description("amzn-ami-us-west-1/amzn-ami-0.9.7-beta.x86_64.manifest.xml").is64Bit(true)
.build()).description("Amazon Linux AMI x86_64 S3") .build()).description("Amazon Linux AMI x86_64 S3")
.defaultCredentials(new LoginCredentials("ec2-user", null, null, false)).id("us-east-1/ami-f2e4b5b7") .defaultCredentials(new LoginCredentials("ec2-user", false)).id("us-east-1/ami-f2e4b5b7")
.providerId("ami-f2e4b5b7").location(defaultLocation).version("0.9.7-beta") .providerId("ami-f2e4b5b7").location(defaultLocation).version("0.9.7-beta")
.userMetadata(ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).build()); .userMetadata(ImmutableMap.of("owner", "137112412989", "rootDeviceType", "ebs")).build());
} }

View File

@ -68,7 +68,7 @@ public class EucalyptusPartnerCloudReviseParsedImageTest {
.description("debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml").is64Bit(true) .description("debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml").is64Bit(true)
.build()) .build())
.description("debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml") .description("debian-6.0-x86_64/debian.6-0.x86-64.img.manifest.xml")
.defaultCredentials(new LoginCredentials("root", null, null, false)) .defaultCredentials(new LoginCredentials("root", false))
.id("us-east-1/emi-892C130F") .id("us-east-1/emi-892C130F")
.providerId("emi-892C130F") .providerId("emi-892C130F")
.location(defaultLocation) .location(defaultLocation)
@ -84,7 +84,7 @@ public class EucalyptusPartnerCloudReviseParsedImageTest {
.description("centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml").is64Bit(true) .description("centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml").is64Bit(true)
.build()) .build())
.description("centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml") .description("centos-5.5-x86_64/centos.5-5.x86-64.img.manifest.xml")
.defaultCredentials(new LoginCredentials("root", null, null, false)) .defaultCredentials(new LoginCredentials("root", false))
.id("us-east-1/emi-9B751369") .id("us-east-1/emi-9B751369")
.providerId("emi-9B751369") .providerId("emi-9B751369")
.location(defaultLocation) .location(defaultLocation)
@ -100,7 +100,7 @@ public class EucalyptusPartnerCloudReviseParsedImageTest {
.description("ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml").is64Bit(true) .description("ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml").is64Bit(true)
.build()) .build())
.description("ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml") .description("ubuntu-10.04-x86_64/ubuntu.10-04.x86-64.img.manifest.xml")
.defaultCredentials(new LoginCredentials("root", null, null, false)) .defaultCredentials(new LoginCredentials("root", false))
.id("us-east-1/emi-E0641459") .id("us-east-1/emi-E0641459")
.providerId("emi-E0641459") .providerId("emi-E0641459")
.location(defaultLocation) .location(defaultLocation)