You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Reijhanniel Jearl Campos <no...@github.com> on 2016/01/19 12:48:11 UTC

[jclouds] JCLOUDS-1053: Fallback to -1 when sshj exit status returns null (#900)

[JIRA Ticket](https://issues.apache.org/jira/browse/JCLOUDS-1053).

Change: Returns -1, in case the sshj driver returns a null exit status.
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds/pull/900

-- Commit Summary --

  * JCLOUDS-1053: Fallback to -1 when sshj exit status returns null

-- File Changes --

    M drivers/sshj/src/main/java/org/jclouds/sshj/SshjSshClient.java (2)

-- Patch Links --

https://github.com/jclouds/jclouds/pull/900.patch
https://github.com/jclouds/jclouds/pull/900.diff

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/900

Re: [jclouds] JCLOUDS-1053: Fallback to -1 when sshj exit status returns null (#900)

Posted by Ignasi Barrera <no...@github.com>.
Pushed to master as [a4b8a737](http://git-wip-us.apache.org/repos/asf/jclouds/commit/a4b8a737). Thanks @devcsrj!

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/900#issuecomment-173902075

Re: [jclouds] JCLOUDS-1053: Fallback to -1 when sshj exit status returns null (#900)

Posted by Ignasi Barrera <no...@github.com>.
Closed #900.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/900#event-522864711

Re: [jclouds] JCLOUDS-1053: Fallback to -1 when sshj exit status returns null (#900)

Posted by Ignasi Barrera <no...@github.com>.
> @@ -460,7 +460,7 @@ public ExecResponse create() throws Exception {
>              Command output = session.exec(checkNotNull(command, "command"));
>              String outputString = IOUtils.readFully(output.getInputStream()).toString();
>              output.join(sshClientConnection.getSessionTimeout(), TimeUnit.MILLISECONDS);
> -            int errorStatus = output.getExitStatus();
> +            int errorStatus = output.getExitStatus() != null ? output.getExitStatus() : -1;

Move the logic to the [ExecResponse constructor](https://github.com/devcsrj/jclouds/blob/master/compute/src/main/java/org/jclouds/compute/domain/ExecResponse.java#L29-L33)? This way the approach would be ssh driver agnostic.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/900/files#r50103997

Re: [jclouds] JCLOUDS-1053: Fallback to -1 when sshj exit status returns null (#900)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
Added mock test. Also, updated `ssh_test.clj` for it seemed like clojure always casts "numbers" to `long`. Throws this exception without the explicit cast:
```
1) ClassCastException on node 9:
java.lang.ClassCastException: java.lang.Long cannot be cast to java.lang.Integer
	at org.jclouds.ssh_test.NoOpClient.exec(ssh_test.clj:63)
	at org.jclouds.compute.callables.RunScriptOnNodeUsingSsh.runCommand(RunScriptOnNodeUsingSsh.java:107)
	at org.jclouds.compute.callables.RunScriptOnNodeUsingSsh.call(RunScriptOnNodeUsingSsh.java:80)
...omitted..
```

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/900#issuecomment-173543697

Re: [jclouds] JCLOUDS-1053: Fallback to -1 when sshj exit status returns null (#900)

Posted by Ignasi Barrera <no...@github.com>.
Thanks @devcsrj!
I'd also add a constant in the ExecResponse class itself for the -1 value, and try to unit test this using mocks.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/900#issuecomment-172835497