Re: SSH Client not working, but RunScriptOnNodes working

2013-08-01 Thread Andrew Phillips

Thanks a lot for letting us know the resolution!


Indeed! Glad to hear you got it working.

ap


Re: SSH Client not working, but RunScriptOnNodes working

2013-08-01 Thread Everett Toews
Thanks a lot for letting us know the resolution!

Everett

On Aug 1, 2013, at 2:15 AM, Varad Meru wrote:

Thanks Andrew.

Got it working. It was due to the path parameter. The assumption that absolute 
paths are allowed - failed. The paths changed from absolute to relative paths 
(for user) worked.

Output
--
New ssh overridingCredentials - [user=varad, passwordPresent=false, 
privateKeyPresent=true, shouldAuthenticateSudo=true]
EdgeNodeId- DFW/instanceid
New ssh client - 
haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@HOSTNAME:22
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
Client got connected
echo "getting server output" > ~/temp.out
Success ...
Client Disconnected
--

-

On 01-Aug-2013, at 12:31 PM, Varad Meru 
mailto:va...@orzota.com>> wrote:

Thanks for the Reply.

I am able to run command via exec and do SFTP with the same private key

Exec
Code Snippet

client.connect();
System.out.println("Client got connected");
client.exec("echo \"getting server output\" > ~/temp.out");

Checking on the box -

[varad@dev-varad2 ~]$ cat temp.out
getting server output


SFTP

static-40:work varadmeru$ sftp -i temp/pvt.key varad@HOSTNAME:.
Connected to 166.78.178.195.
Changing to: /home/varad/.
sftp> put temp/testfile
Uploading temp/testfile to /home/varad/testfile
temp/testfile 100% 1675 1.6KB/s 
  00:00
sftp>


Regards,
Varad

-
Varad Meru
Software Development Engineer,
Orzota, Inc. (www.orzota.com)

On 01-Aug-2013, at 4:30 AM, Andrew Phillips 
mailto:andr...@apache.org>> wrote:

I am able to run scripts using compute.runScriptOnNode(node.getId(),  script, 
runScriptOptions) but I am not able to do ssh using SshClient.

Are you able to run commands (via exec), or does this fail too? Are you able to 
upload files using SFTP from the command line using the same private key?

Regards

ap





Re: SSH Client not working, but RunScriptOnNodes working

2013-08-01 Thread Varad Meru
Thanks Andrew. 

Got it working. It was due to the path parameter. The assumption that absolute 
paths are allowed - failed. The paths changed from absolute to relative paths 
(for user) worked.

Output
--
New ssh overridingCredentials - [user=varad, passwordPresent=false, 
privateKeyPresent=true, shouldAuthenticateSudo=true]
EdgeNodeId- DFW/instanceid
New ssh client - 
haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@HOSTNAME:22
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
Client got connected
echo "getting server output" > ~/temp.out
Success ...
Client Disconnected
--

-

On 01-Aug-2013, at 12:31 PM, Varad Meru  wrote:

Thanks for the Reply.

I am able to run command via exec and do SFTP with the same private key

Exec
Code Snippet

client.connect();
System.out.println("Client got connected");
client.exec("echo \"getting server output\" > ~/temp.out");

Checking on the box -

[varad@dev-varad2 ~]$ cat temp.out 
getting server output


SFTP

static-40:work varadmeru$ sftp -i temp/pvt.key varad@HOSTNAME:.
Connected to 166.78.178.195.
Changing to: /home/varad/.
sftp> put temp/testfile
Uploading temp/testfile to /home/varad/testfile
temp/testfile 100% 1675 1.6KB/s 
  00:00
sftp>


Regards,
Varad

-
Varad Meru
Software Development Engineer,
Orzota, Inc. (www.orzota.com)

On 01-Aug-2013, at 4:30 AM, Andrew Phillips  wrote:

> I am able to run scripts using compute.runScriptOnNode(node.getId(),  script, 
> runScriptOptions) but I am not able to do ssh using SshClient.

Are you able to run commands (via exec), or does this fail too? Are you able to 
upload files using SFTP from the command line using the same private key?

Regards

ap




Re: SSH Client not working, but RunScriptOnNodes working

2013-08-01 Thread Varad Meru
Thanks for the Reply.

I am able to run command via exec and do SFTP with the same private key

Exec
Code Snippet

client.connect();
System.out.println("Client got connected");
client.exec("echo \"getting server output\" > ~/temp.out");

Checking on the box -

[varad@dev-varad2 ~]$ cat temp.out 
getting server output


SFTP

static-40:work varadmeru$ sftp -i temp/pvt.key varad@HOSTNAME:.
Connected to 166.78.178.195.
Changing to: /home/varad/.
sftp> put temp/testfile
Uploading temp/testfile to /home/varad/testfile
temp/testfile 100% 1675 1.6KB/s 
  00:00
sftp>


Regards,
Varad

-
Varad Meru
Software Development Engineer,
Orzota, Inc. (www.orzota.com)

On 01-Aug-2013, at 4:30 AM, Andrew Phillips  wrote:

> I am able to run scripts using compute.runScriptOnNode(node.getId(),  script, 
> runScriptOptions) but I am not able to do ssh using SshClient.

Are you able to run commands (via exec), or does this fail too? Are you able to 
upload files using SFTP from the command line using the same private key?

Regards

ap



Re: SSH Client not working, but RunScriptOnNodes working

2013-07-31 Thread Andrew Phillips
I am able to run scripts using compute.runScriptOnNode(node.getId(),  
 script, runScriptOptions) but I am not able to do ssh using  
SshClient.


Are you able to run commands (via exec), or does this fail too? Are  
you able to upload files using SFTP from the command line using the  
same private key?


Regards

ap


SSH Client not working, but RunScriptOnNodes working

2013-07-31 Thread Varad Meru
I am able to run scripts using compute.runScriptOnNode(node.getId(), script, 
runScriptOptions) but I am not able to do ssh using SshClient.

Any ideas?

Thanks in Advance,

Regards,
Varad


Code Snippet
--
SshClient client = context
.utils()
.sshForNode()

.apply(NodeMetadataBuilder.fromNodeMetadata(compute.getNodeMetadata(nodeId))
.credentials(overridingCredentials).build());
System.out.println("New ssh client - " + client);
try {
client.connect();
client.put("/home/USER/files/", Payloads.newFilePayload(new 
File("testfile")));
} catch (Exception e) {
e.printStackTrace();
} finally {
if (client != null)
client.disconnect();
System.out.println("Client Disconnected");
}
--

Error Stack

New ssh overridingCredentials - [user=USER, passwordPresent=false, 
privateKeyPresent=true, shouldAuthenticateSudo=true]

EdgeNodeId- DFW/X
nodeMetadata for EdgeNodeId- Hidden. But Correct.

New ssh client - 
haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@HostIP
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further 
details.
Jul 31, 2013 11:20:08 PM org.jclouds.logging.jdk.JDKLogger logInfo
INFO: << 
(haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@HOSTNAME:22)
 error acquiring Put(path=[/home/USER/jars/]) (attempt 1 of 7): Failure
Jul 31, 2013 11:20:27 PM org.jclouds.logging.jdk.JDKLogger logInfo
INFO: << 
(haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@HOSTNAME:22)
 error acquiring Put(path=[/home/USER/jars/]) (attempt 2 of 7): Failure
Jul 31, 2013 11:21:03 PM org.jclouds.logging.jdk.JDKLogger logInfo
INFO: << 
(haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@
 HOSTNAME:22) error acquiring Put(path=[/home/USER/jars/]) (attempt 3 of 7): 
Failure
Jul 31, 2013 11:21:32 PM org.jclouds.logging.jdk.JDKLogger logInfo
INFO: << 
(haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@
 HOSTNAME:22) error acquiring Put(path=[/home/USER/jars/]) (attempt 4 of 7): 
Failure
Jul 31, 2013 11:22:34 PM org.jclouds.logging.jdk.JDKLogger logInfo
INFO: << 
(haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@
 HOSTNAME:22) error acquiring {hostAndPort=166.78.178.195:22, loginUser=haas, 
ssh=null, connectTimeout=6, sessionTimeout=6} (attempt 1 of 7): connect 
timed out
Jul 31, 2013 11:23:22 PM org.jclouds.logging.jdk.JDKLogger logInfo
INFO: << 
(haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@HOSTNAME:22)
 error acquiring Put(path=[/home/USER/jars/]) (attempt 5 of 7): Failure
Jul 31, 2013 11:23:51 PM org.jclouds.logging.jdk.JDKLogger logInfo
INFO: << 
(haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@HOSTNAME:22)
 error acquiring Put(path=[/home/USER/jars/]) (attempt 6 of 7): Failure
Jul 31, 2013 11:24:23 PM org.jclouds.logging.jdk.JDKLogger logError
SEVERE: << 
(haas:rsa[fingerprint(af:4c:0d:20:dd:8c:22:dd:f3:fa:65:e9:ab:20:1e:3f),sha1(b4:3c:c8:c8:4c:d1:ec:1d:7c:3b:06:9b:24:96:e6:27:de:3a:e6:e7)]@HOSTNAME:22)
 error acquiring Put(path=[/home/USER/jars/]) (out of retries - max 7): Failure
net.schmizz.sshj.sftp.SFTPException: Failure
at net.schmizz.sshj.sftp.Response.error(Response.java:113)
at net.schmizz.sshj.sftp.Response.ensurePacketTypeIs(Response.java:91)
at net.schmizz.sshj.sftp.SFTPEngine.open(SFTPEngine.java:129)
at net.schmizz.sshj.sftp.SFTPEngine.open(SFTPEngine.java:137)
at 
net.schmizz.sshj.sftp.SFTPFileTransfer$Uploader.uploadFile(SFTPFileTransfer.java:204)
at 
net.schmizz.sshj.sftp.SFTPFileTransfer$Uploader.upload(SFTPFileTransfer.java:182)
at 
net.schmizz.sshj.sftp.SFTPFileTransfer$Uploader.access$100(SFTPFileTransfer.java:172)
at 
net.schmizz.sshj.sftp.SFTPFileTransfer.upload(SFTPFileTransfer.java:70)
at net.schmizz.sshj.sftp.SFTPClient.put(SFTPClient.java:248)
at 
org.jclouds.sshj.SshjSshClient$PutConnection.create(SshjSshClient.java:311)
at 
org.jclouds.sshj.SshjSshClient$PutConnection.create(SshjSshClient.java:287)
at org.jclouds.sshj.SshjSshClient.acquire(SshjSshCli