Repository: zeppelin
Updated Branches:
  refs/heads/master fe3dbdb1c -> 922364f36


ZEPPELIN-1319 Use absolute path for ssl truststore and keystore when available

### What is this PR for?
Use absolute path for ssl truststore and keystore when available

### What type of PR is it?
Improvement

### Todos
* [ ] - Task

### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-1319

### How should this be tested?
Config `zeppelin.ssl.truststore.path`, `zeppelin.ssl.keystore.path` and verify 
whether the absolute path or the path relative to conf is used.

### Screenshots (if appropriate)

### Questions:
* Does the licenses files need update? n/a
* Is there breaking changes for older versions? n/a
* Does this needs documentation? n/a

Author: Renjith Kamath <renjith.kam...@gmail.com>

Closes #1319 from r-kamath/ZEPPELIN-1319 and squashes the following commits:

5587d5a [Renjith Kamath] ZEPPELIN-1319 add check for Windows path
fc2ac9f [Renjith Kamath] ZEPPELIN-1319 Use absolute path for ssl truststore and 
keystore when available


Project: http://git-wip-us.apache.org/repos/asf/zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/zeppelin/commit/922364f3
Tree: http://git-wip-us.apache.org/repos/asf/zeppelin/tree/922364f3
Diff: http://git-wip-us.apache.org/repos/asf/zeppelin/diff/922364f3

Branch: refs/heads/master
Commit: 922364f36e50fff8d52d3158281dd9e303bf7c3b
Parents: fe3dbdb
Author: Renjith Kamath <renjith.kam...@gmail.com>
Authored: Thu Aug 25 17:06:53 2016 +0530
Committer: Prabhjyot Singh <prabhjyotsi...@gmail.com>
Committed: Fri Sep 2 09:50:37 2016 +0530

----------------------------------------------------------------------
 .../zeppelin/conf/ZeppelinConfiguration.java    | 22 +++++++++++++-------
 1 file changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/922364f3/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
----------------------------------------------------------------------
diff --git 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
index d4f3186..864b149 100644
--- 
a/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
+++ 
b/zeppelin-zengine/src/main/java/org/apache/zeppelin/conf/ZeppelinConfiguration.java
@@ -272,10 +272,15 @@ public class ZeppelinConfiguration extends 
XMLConfiguration {
   }
 
   public String getKeyStorePath() {
-    return getRelativeDir(
-            String.format("%s/%s",
-                    getConfDir(),
-                    getString(ConfVars.ZEPPELIN_SSL_KEYSTORE_PATH)));
+    String path = getString(ConfVars.ZEPPELIN_SSL_KEYSTORE_PATH);
+    if (path != null && path.startsWith("/") || isWindowsPath(path)) {
+      return path;
+    } else {
+      return getRelativeDir(
+          String.format("%s/%s",
+              getConfDir(),
+              getString(path)));
+    }
   }
 
   public String getKeyStoreType() {
@@ -297,10 +302,13 @@ public class ZeppelinConfiguration extends 
XMLConfiguration {
 
   public String getTrustStorePath() {
     String path = getString(ConfVars.ZEPPELIN_SSL_TRUSTSTORE_PATH);
-    if (path == null) {
-      return getKeyStorePath();
+    if (path != null && path.startsWith("/") || isWindowsPath(path)) {
+      return path;
     } else {
-      return getRelativeDir(path);
+      return getRelativeDir(
+          String.format("%s/%s",
+              getConfDir(),
+              getString(path)));
     }
   }
 

Reply via email to