Issue 592:templateBuilder.fromTemplate loses location when more narrow than region

This commit is contained in:
Adrian Cole 2011-06-02 13:47:57 -07:00
parent a0692e737f
commit ac56adc2e1
3 changed files with 8 additions and 1 deletions

View File

@ -509,6 +509,6 @@ public class EC2TemplateOptions extends TemplateOptions implements Cloneable {
@Override
public String toString() {
return "[groupIds=" + groupIds + ", keyPair=" + keyPair + ", noKeyPair=" + noKeyPair + ", userData="
+ Arrays.toString(userData) + ", blockDeviceMappings=" + blockDeviceMappings + "]";
+ Arrays.toString(userData) + ", blockDeviceMappings=" + blockDeviceMappings.build() + "]";
}
}

View File

@ -416,6 +416,7 @@ public class TemplateBuilderImpl implements TemplateBuilder {
*/
@Override
public TemplateBuilder fromTemplate(Template template) {
location = template.getLocation();
fromHardware(template.getHardware());
fromImage(template.getImage());
options(template.getOptions());

View File

@ -101,6 +101,12 @@ public abstract class BaseTemplateBuilderLiveTest {
assert getCores(fastest) >= getCores(smallest) : String.format("%s ! >= %s", fastest, smallest);
}
public void testFromTemplate() {
Template defaultTemplate = context.getComputeService().templateBuilder().build();
assertEquals(context.getComputeService().templateBuilder().fromTemplate(defaultTemplate).build().toString(),
defaultTemplate.toString());
}
protected Properties setupProperties() {
Properties overrides = new Properties();
overrides.setProperty(Constants.PROPERTY_TRUST_ALL_CERTS, "true");