This is an automated email from the ASF dual-hosted git repository.

dimuthuupe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/develop by this push:
     new 55747ca  Printing the description of fetched credential
55747ca is described below

commit 55747caf5f11ebfb2507d96e83f61a9938ceb857
Author: dimuthu <[email protected]>
AuthorDate: Tue Apr 3 16:14:11 2018 -0400

    Printing the description of fetched credential
---
 .../org/apache/airavata/helix/agent/ssh/SshAgentAdaptor.java  | 11 +++++++++++
 .../helix/agent/storage/StorageResourceAdaptorImpl.java       |  5 +++++
 2 files changed, 16 insertions(+)

diff --git 
a/modules/airavata-helix/agent-impl/ssh-agent/src/main/java/org/apache/airavata/helix/agent/ssh/SshAgentAdaptor.java
 
b/modules/airavata-helix/agent-impl/ssh-agent/src/main/java/org/apache/airavata/helix/agent/ssh/SshAgentAdaptor.java
index 53d80a1..20fc4a3 100644
--- 
a/modules/airavata-helix/agent-impl/ssh-agent/src/main/java/org/apache/airavata/helix/agent/ssh/SshAgentAdaptor.java
+++ 
b/modules/airavata-helix/agent-impl/ssh-agent/src/main/java/org/apache/airavata/helix/agent/ssh/SshAgentAdaptor.java
@@ -32,6 +32,8 @@ import org.apache.airavata.model.appcatalog.computeresource.*;
 import 
org.apache.airavata.registry.core.experiment.catalog.impl.RegistryFactory;
 import org.apache.airavata.registry.cpi.AppCatalog;
 import org.apache.airavata.registry.cpi.AppCatalogException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 import java.io.*;
 import java.util.Arrays;
@@ -49,6 +51,8 @@ import static 
jdk.nashorn.internal.runtime.regexp.joni.Config.log;
  */
 public class SshAgentAdaptor implements AgentAdaptor {
 
+    private final static Logger logger = 
LoggerFactory.getLogger(SshAgentAdaptor.class);
+
     private Session session = null;
     private AppCatalog appCatalog;
     private ComputeResourceDescription computeResourceDescription;
@@ -111,7 +115,14 @@ public class SshAgentAdaptor implements AgentAdaptor {
             String jdbcPass = ServerSettings.getCredentialStoreDBPassword();
             String driver = ServerSettings.getCredentialStoreDBDriver();
             CredentialReaderImpl credentialReader = new 
CredentialReaderImpl(new DBUtil(jdbcUrl, jdbcUsr, jdbcPass, driver));
+
+            logger.info("Fetching credentials for cred store token " + token);
+
             Credential credential = credentialReader.getCredential(gatewayId, 
token);
+            if (credential == null) {
+                throw new AgentException("Null credential for token " + token);
+            }
+            logger.info("Description for token : " + token + " : " + 
credential.getDescription());
 
             if (credential instanceof SSHCredential) {
                 SSHCredential sshCredential = 
SSHCredential.class.cast(credential);
diff --git 
a/modules/airavata-helix/agent-impl/ssh-agent/src/main/java/org/apache/airavata/helix/agent/storage/StorageResourceAdaptorImpl.java
 
b/modules/airavata-helix/agent-impl/ssh-agent/src/main/java/org/apache/airavata/helix/agent/storage/StorageResourceAdaptorImpl.java
index 4dc0cee..0027f97 100644
--- 
a/modules/airavata-helix/agent-impl/ssh-agent/src/main/java/org/apache/airavata/helix/agent/storage/StorageResourceAdaptorImpl.java
+++ 
b/modules/airavata-helix/agent-impl/ssh-agent/src/main/java/org/apache/airavata/helix/agent/storage/StorageResourceAdaptorImpl.java
@@ -66,6 +66,11 @@ public class StorageResourceAdaptorImpl extends 
SshAgentAdaptor implements Stora
 
             Credential credential = credentialReader.getCredential(gatewayId, 
token);
 
+            if (credential == null) {
+                throw new AgentException("Null credential for token " + token);
+            }
+            logger.info("Description for token : " + token + " : " + 
credential.getDescription());
+
             if (credential instanceof SSHCredential) {
                 SSHCredential sshCredential = 
SSHCredential.class.cast(credential);
                 SshAdaptorParams adaptorParams = new SshAdaptorParams();

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to