Repository: zeppelin
Updated Branches:
  refs/heads/branch-0.6 db7c11d3b -> 7d3ee991e


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

(cherry picked from commit 922364f36e50fff8d52d3158281dd9e303bf7c3b)
Signed-off-by: Prabhjyot Singh <prabhjyotsi...@gmail.com>


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

Branch: refs/heads/branch-0.6
Commit: 7d3ee991e99a339fc00de5c53ea6070b0ea94158
Parents: db7c11d
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:58 2016 +0530

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


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/7d3ee991/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 23ba68d..04bdfc8 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