From 522c080a4a29dc0c333c9917760f225cb26a7eab Mon Sep 17 00:00:00 2001 From: Huy TA Date: Fri, 24 Apr 2015 16:57:33 +1000 Subject: [PATCH] Use ssh agent if privatekey and password are not set --- .../src/main/java/org/jclouds/ssh/jsch/SessionConnection.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/SessionConnection.java b/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/SessionConnection.java index 987d8b91d3..fca26a0494 100644 --- a/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/SessionConnection.java +++ b/drivers/jsch/src/main/java/org/jclouds/ssh/jsch/SessionConnection.java @@ -169,7 +169,7 @@ public final class SessionConnection implements Connection { .getSession(loginCredentials.getUser(), hostAndPort.getHostText(), hostAndPort.getPortOrDefault(22)); if (sessionTimeout != 0) session.setTimeout(sessionTimeout); - if (!loginCredentials.getOptionalPrivateKey().isPresent()) { + if (loginCredentials.getOptionalPassword().isPresent()) { session.setPassword(loginCredentials.getOptionalPassword().orNull()); } else if (loginCredentials.hasUnencryptedPrivateKey()) { byte[] privateKey = loginCredentials.getOptionalPrivateKey().get().getBytes();