Issue 27: adjusted for incorrect 0.0.0.0 ips and inconsistent timestamp formats in eucalyptus

This commit is contained in:
Adrian Cole 2010-06-16 12:26:35 -04:00
parent 4b91eb6046
commit ca64722a0f
3 changed files with 54 additions and 4 deletions

View File

@ -132,6 +132,9 @@ public abstract class BaseReservationHandler<T> extends HandlerWithResult<T> {
amiLaunchIndex = currentOrNull();
} else if (qName.equals("dnsName")) {
dnsName = currentOrNull();
// Eucalyptus
if ("0.0.0.0".equals(dnsName))
dnsName = null;
} else if (qName.equals("imageId")) {
imageId = currentOrNull();
} else if (qName.equals("instanceId")) {
@ -147,7 +150,12 @@ public abstract class BaseReservationHandler<T> extends HandlerWithResult<T> {
} else if (qName.equals("keyName")) {
keyName = currentOrNull();
} else if (qName.equals("launchTime")) {
launchTime = dateService.iso8601DateParse(currentOrNull());
try {
launchTime = dateService.iso8601DateParse(currentOrNull());
} catch (RuntimeException e) {
// Eucalyptus
launchTime = dateService.iso8601SecondsDateParse(currentOrNull());
}
} else if (qName.equals("enabled")) {
monitoring = Boolean.parseBoolean(currentOrNull());
} else if (qName.equals("availabilityZone")) {
@ -156,6 +164,9 @@ public abstract class BaseReservationHandler<T> extends HandlerWithResult<T> {
platform = currentOrNull();
} else if (qName.equals("privateDnsName")) {
privateDnsName = currentOrNull();
// Eucalyptus
if ("0.0.0.0".equals(privateDnsName))
privateDnsName = null;
} else if (qName.equals("privateIpAddress")) {
privateIpAddress = currentOrNull();
} else if (qName.equals("ramdiskId")) {

View File

@ -133,9 +133,9 @@ public class DescribeInstancesResponseHandlerTest extends BaseEC2HandlerTest {
contents.add(new Reservation(defaultRegion, ImmutableSet.of("default"),
ImmutableSet.of(new RunningInstance(defaultRegion, ImmutableSet
.of("jclouds#euc"), "1", null, "emi-9ACB1363", "i-3FFA0762",
InstanceState.SHUTTING_DOWN, InstanceType.M1_LARGE,
"10.7.0.179", "eki-6CBD12F2", "jclouds#euc-17", dateService
.iso8601DateParse("2010-06-16T03:06:19.771Z"), false,
InstanceState.SHUTTING_DOWN, InstanceType.M1_LARGE, null,
"eki-6CBD12F2", "jclouds#euc-17", dateService
.iso8601DateParse("2010-06-16T03:06:19.000Z"), false,
"open", null, null, "10.7.0.179", ImmutableSet.<String> of(),
"eri-A97113E4", null, null, null,
RootDeviceType.INSTANCE_STORE, null, ImmutableMap

View File

@ -0,0 +1,39 @@
<DescribeInstancesResponse xmlns="http://ec2.amazonaws.com/doc/2009-11-30/">
<requestId>e323d0bd-48a2-401b-aeee-1cbf653bc6db</requestId>
<reservationSet>
<item>
<reservationId>r-4D2A08AD</reservationId>
<ownerId>jclouds</ownerId>
<groupSet>
<item>
<groupId>jclouds#euc</groupId>
</item>
</groupSet>
<instancesSet>
<item>
<instanceId>i-3FFA0762</instanceId>
<imageId>emi-9ACB1363</imageId>
<instanceState>
<code>32</code>
<name>shutting-down</name>
</instanceState>
<privateDnsName>10.7.0.179</privateDnsName>
<dnsName>0.0.0.0</dnsName>
<keyName>jclouds#euc-17</keyName>
<amiLaunchIndex>1</amiLaunchIndex>
<productCodes />
<instanceType>m1.large</instanceType>
<launchTime>2010-06-16T03:06:19Z</launchTime>
<placement>
<availabilityZone>open</availabilityZone>
</placement>
<kernelId>eki-6CBD12F2</kernelId>
<ramdiskId>eri-A97113E4</ramdiskId>
<monitoring>
<state>false</state>
</monitoring>
</item>
</instancesSet>
</item>
</reservationSet>
</DescribeInstancesResponse>