You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Everett Toews <no...@github.com> on 2014/06/19 22:19:36 UTC
[jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
You can merge this Pull Request by running:
git pull https://github.com/rackspace/jclouds jclouds-558
Or you can view, comment on it, or merge it online at:
https://github.com/jclouds/jclouds/pull/414
-- Commit Summary --
* Fix for JSON parse error on createNodesInGroup (JCLOUDS-558)
-- File Changes --
M apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/config/NovaParserModule.java (27)
M apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/Server.java (4)
A apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/parse/ParseServerWithoutImageTest.java (99)
A apis/openstack-nova/src/test/resources/server_details_without_image.json (74)
-- Patch Links --
https://github.com/jclouds/jclouds/pull/414.patch
https://github.com/jclouds/jclouds/pull/414.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
Closed #414.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#event-134739126
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
Reopened #414.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#event-134739056
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Andrew Phillips <no...@github.com>.
> @@ -151,5 +160,22 @@ protected ServerInternal(String id, @Nullable String name, java.util.Set<Link> l
> super(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig);
> }
> }
> +
> + public Server apply(ServerInternalWithoutImage in) {
> + return in.toBuilder().build();
> + }
> +
> + private static class ServerInternalWithoutImage extends Server {
Sorry, probably another stupid question here: I can see why we might need ServerInternalWithoutImage as it has different constructor/deserialization params from Server. But what is the need for ServerInteral? Looks the same as Server?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414/files#r14141053
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1261](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1261/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46725725
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
Sigh.
Looks like the node went offline during the build. Check the slave log for the details.
FATAL: channel is already closed
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46854436
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Ignasi Barrera <no...@github.com>.
> +import org.jclouds.openstack.nova.v2_0.domain.Server;
> +import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
> +import org.jclouds.openstack.v2_0.domain.Link;
> +import org.jclouds.openstack.v2_0.domain.Link.Relation;
> +import org.jclouds.openstack.v2_0.domain.Resource;
> +import org.jclouds.rest.annotations.SelectJson;
> +import org.testng.annotations.Test;
> +
> +import javax.ws.rs.Consumes;
> +import javax.ws.rs.core.MediaType;
> +import java.net.URI;
> +
> +import static org.jclouds.openstack.nova.v2_0.domain.Address.createV4;
> +import static org.jclouds.openstack.nova.v2_0.domain.Address.createV6;
> +
> +@Test(groups = "unit", testName = "ParseServerTest")
Change to `ParseServerWithoutImageTest`.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414/files#r14009785
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #910](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/910/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46614146
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Ignasi Barrera <no...@github.com>.
> @@ -122,7 +122,15 @@ public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type,
> @Override
> public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
> throws JsonParseException {
> - Server serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class));
> + Server serverBase = null;
> +
> + if (jsonElement.getAsJsonObject().get("image").isJsonObject()) {
Worth adding a comment explaining why we're doing this, with a link to the JIRA issue?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414/files#r14009758
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
> @@ -122,7 +122,15 @@ public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type,
> @Override
> public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
> throws JsonParseException {
> - Server serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class));
> + Server serverBase = null;
> +
> + if (jsonElement.getAsJsonObject().get("image").isJsonObject()) {
Added a comment because this is definitely "out of the norm". I don't think it's necessary to link it to the JIRA issue, otherwise the code base would be littered with links to JIRA issue. ;)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414/files#r14035503
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Ignasi Barrera <no...@github.com>.
Changes LGTM. Thanks @everett-toews!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46653446
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
Reopened #414.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#event-134122726
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
Closed #414.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#event-134234296
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1381](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1381/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46614413
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
Another transient failure on the UNSTABLE. Going with best 2 out of 3.
Merged to master and 1.7.x
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46884909
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
> @@ -151,5 +160,22 @@ protected ServerInternal(String id, @Nullable String name, java.util.Set<Link> l
> super(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig);
> }
> }
> +
> + public Server apply(ServerInternalWithoutImage in) {
Nice catch. That works!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414/files#r14152367
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #924](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/924/) UNSTABLE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46859034
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
> +import org.jclouds.openstack.nova.v2_0.domain.Server;
> +import org.jclouds.openstack.nova.v2_0.domain.Server.Status;
> +import org.jclouds.openstack.v2_0.domain.Link;
> +import org.jclouds.openstack.v2_0.domain.Link.Relation;
> +import org.jclouds.openstack.v2_0.domain.Resource;
> +import org.jclouds.rest.annotations.SelectJson;
> +import org.testng.annotations.Test;
> +
> +import javax.ws.rs.Consumes;
> +import javax.ws.rs.core.MediaType;
> +import java.net.URI;
> +
> +import static org.jclouds.openstack.nova.v2_0.domain.Address.createV4;
> +import static org.jclouds.openstack.nova.v2_0.domain.Address.createV6;
> +
> +@Test(groups = "unit", testName = "ParseServerTest")
Done.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414/files#r14035508
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
Closed #414.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#event-134122601
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #932](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/932/) FAILURE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-47026483
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Andrew Phillips <no...@github.com>.
> @@ -151,5 +160,22 @@ protected ServerInternal(String id, @Nullable String name, java.util.Set<Link> l
> super(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig);
> }
> }
> +
> + public Server apply(ServerInternalWithoutImage in) {
> + return in.toBuilder().build();
> + }
> +
> + private static class ServerInternalWithoutImage extends Server {
> This caused a lovely StackOverflowError apparently because of the way the Gson deserializationContext works
Wow! Fun. Then let's keep as-is. Thanks for trying that out.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414/files#r14152968
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1271](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1271/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46869699
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-pull-requests #918](https://jclouds.ci.cloudbees.com/job/jclouds-pull-requests/918/) FAILURE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46715953
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Andrew Phillips <no...@github.com>.
> @@ -151,5 +160,22 @@ protected ServerInternal(String id, @Nullable String name, java.util.Set<Link> l
> super(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig);
> }
> }
> +
> + public Server apply(ServerInternalWithoutImage in) {
Stupid question, perhaps...but why do we have two `apply` methods with a different input parameter type but the same implementation? Would
```
public Server apply(Server in) {
return in.toBuilder().build();
}
```
break here?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414/files#r14140609
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1395](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1395/) SUCCESS
This pull request looks good
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46860923
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1389](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1389/) FAILURE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46715950
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by CloudBees pull request builder plugin <no...@github.com>.
[jclouds-java-7-pull-requests #1403](https://jclouds.ci.cloudbees.com/job/jclouds-java-7-pull-requests/1403/) FAILURE
Looks like there's a problem with this pull request
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-47026373
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Andrew Phillips <no...@github.com>.
> @@ -122,7 +122,16 @@ public ServerWithSecurityGroups deserialize(JsonElement jsonElement, Type type,
> @Override
> public Server deserialize(JsonElement jsonElement, Type type, JsonDeserializationContext context)
> throws JsonParseException {
> - Server serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class));
> + Server serverBase = null;
> +
> + // Servers can be created without an image so test if an image object is returned
> + if (jsonElement.getAsJsonObject().get("image").isJsonObject()) {
> + serverBase = apply((ServerInternal) context.deserialize(jsonElement, ServerInternal.class));
> + }
> + else {
[minor[ `} else {` on one line?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414/files#r14120826
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by Everett Toews <no...@github.com>.
> @@ -151,5 +160,22 @@ protected ServerInternal(String id, @Nullable String name, java.util.Set<Link> l
> super(id, name, links, uuid, tenantId, userId, updated, created, hostId, accessIPv4, accessIPv6, status, image, flavor, keyName, configDrive, addresses, metadata, extendedStatus, extendedAttributes, diskConfig);
> }
> }
> +
> + public Server apply(ServerInternalWithoutImage in) {
> + return in.toBuilder().build();
> + }
> +
> + private static class ServerInternalWithoutImage extends Server {
You're right, they are exactly the same. So I tried removing ServerInternal and had the following code.
serverBase = apply((Server) context.deserialize(jsonElement, Server.class));
This caused a lovely StackOverflowError apparently because of the way the Gson deserializationContext works. I didn't bother digging to deep into it as it's the original code and not part of this change. I suspect the original author ran into the the StackOverflowError and ServerInternal was their way around it.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414/files#r14152582
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1251](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1251/) SUCCESS
This pull request looks good
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-46617141
Re: [jclouds] Fix for JSON parse error on createNodesInGroup
(JCLOUDS-558) (#414)
Posted by BuildHive <no...@github.com>.
[jclouds » jclouds #1281](https://buildhive.cloudbees.com/job/jclouds/job/jclouds/1281/) FAILURE
Looks like there's a problem with this pull request
[(what's this?)](https://www.cloudbees.com/what-is-buildhive)
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/414#issuecomment-47032679