ranger-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mad...@apache.org
Subject [5/6] incubator-ranger git commit: RANGER-500 - Change URL to Solr for audit
Date Thu, 21 May 2015 22:56:19 GMT
RANGER-500 - Change URL to Solr for audit


Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/b8d5bb27
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/b8d5bb27
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/b8d5bb27

Branch: refs/heads/tag-policy
Commit: b8d5bb27f57f6df7be4b527352a1ae70b3bdd495
Parents: ea7f715
Author: Don Bosco Durai <bosco@apache.org>
Authored: Thu May 21 01:02:47 2015 -0700
Committer: Madhan Neethiraj <madhan@apache.org>
Committed: Thu May 21 15:50:16 2015 -0700

----------------------------------------------------------------------
 .../java/org/apache/ranger/solr/SolrMgr.java    | 25 ++++++++++++++------
 1 file changed, 18 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/b8d5bb27/security-admin/src/main/java/org/apache/ranger/solr/SolrMgr.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/org/apache/ranger/solr/SolrMgr.java b/security-admin/src/main/java/org/apache/ranger/solr/SolrMgr.java
index 599f1df..ee52992 100644
--- a/security-admin/src/main/java/org/apache/ranger/solr/SolrMgr.java
+++ b/security-admin/src/main/java/org/apache/ranger/solr/SolrMgr.java
@@ -58,8 +58,15 @@ public class SolrMgr {
 				if (!initDone) {
 					if (rangerBizUtil.getAuditDBType().equalsIgnoreCase("solr")) {
 						String solrURL = PropertiesUtil
-								.getProperty("ranger.solr.url");
-						if (solrURL == null || solrURL.isEmpty()) {
+								.getProperty("ranger.audit.solr.urls");
+
+						if (solrURL == null) {
+							//Let's try older property name
+							solrURL = PropertiesUtil
+									.getProperty("ranger.solr.url");
+						}
+						if (solrURL == null || solrURL.isEmpty()
+								|| solrURL.equalsIgnoreCase("none")) {
 							logger.fatal("Solr URL for Audit is empty");
 						} else {
 							try {
@@ -70,18 +77,22 @@ public class SolrMgr {
 								} else {
 									if (solrClient instanceof HttpSolrClient) {
 										HttpSolrClient httpSolrClient = (HttpSolrClient) solrClient;
-										httpSolrClient.setAllowCompression(true);
-										httpSolrClient.setConnectionTimeout(1000);
+										httpSolrClient
+												.setAllowCompression(true);
+										httpSolrClient
+												.setConnectionTimeout(1000);
 										// httpSolrClient.setSoTimeout(10000);
 										httpSolrClient.setMaxRetries(1);
-										httpSolrClient.setRequestWriter(new BinaryRequestWriter());
+										httpSolrClient
+												.setRequestWriter(new BinaryRequestWriter());
 									}
 									initDone = true;
 								}
 
 							} catch (Throwable t) {
-								logger.fatal("Can't connect to Solr server. URL="
-										+ solrURL, t);
+								logger.fatal(
+										"Can't connect to Solr server. URL="
+												+ solrURL, t);
 							}
 						}
 					}


Mime
View raw message