You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by pr...@apache.org on 2018/09/26 15:42:50 UTC
[8/9] ranger git commit: RANGER-1415:The ranger can be opened when
the user enters http://localhost:6080/ in the browser address bar. But
request policy from hadoop to ranger will failed after installing hdfs plugin
if we set POLICY_MGR_URL equal to http
RANGER-1415:The ranger can be opened when the user enters http://localhost:6080/ in the browser address bar. But request policy from hadoop to ranger will failed after installing hdfs plugin if we set POLICY_MGR_URL equal to http://localhost:6080/.
Signed-off-by: zhangqiang2 <zh...@zte.com.cn>
Project: http://git-wip-us.apache.org/repos/asf/ranger/repo
Commit: http://git-wip-us.apache.org/repos/asf/ranger/commit/637f01a6
Tree: http://git-wip-us.apache.org/repos/asf/ranger/tree/637f01a6
Diff: http://git-wip-us.apache.org/repos/asf/ranger/diff/637f01a6
Branch: refs/heads/ranger-0.7
Commit: 637f01a6c12ac53c6b3bee811d4538bdea1c5598
Parents: a3be239
Author: peng.jianhua <pe...@zte.com.cn>
Authored: Thu Mar 16 03:44:09 2017 -0400
Committer: Pradeep <pr...@apache.org>
Committed: Wed Sep 26 20:56:18 2018 +0530
----------------------------------------------------------------------
.../apache/ranger/admin/client/RangerAdminRESTClient.java | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ranger/blob/637f01a6/agents-common/src/main/java/org/apache/ranger/admin/client/RangerAdminRESTClient.java
----------------------------------------------------------------------
diff --git a/agents-common/src/main/java/org/apache/ranger/admin/client/RangerAdminRESTClient.java b/agents-common/src/main/java/org/apache/ranger/admin/client/RangerAdminRESTClient.java
index a32db46..9746347 100644
--- a/agents-common/src/main/java/org/apache/ranger/admin/client/RangerAdminRESTClient.java
+++ b/agents-common/src/main/java/org/apache/ranger/admin/client/RangerAdminRESTClient.java
@@ -31,6 +31,7 @@ import org.apache.hadoop.security.UserGroupInformation;
import org.apache.ranger.admin.client.datatype.RESTResponse;
import org.apache.ranger.audit.provider.MiscUtil;
import org.apache.ranger.authorization.hadoop.config.RangerConfiguration;
+import org.apache.ranger.authorization.utils.StringUtil;
import org.apache.ranger.plugin.util.GrantRevokeRequest;
import org.apache.ranger.plugin.util.RangerRESTClient;
import org.apache.ranger.plugin.util.RangerRESTUtils;
@@ -80,11 +81,18 @@ public class RangerAdminRESTClient implements RangerAdminClient {
this.serviceName = serviceName;
this.pluginId = restUtils.getPluginId(serviceName, appId);
- String url = RangerConfiguration.getInstance().get(propertyPrefix + ".policy.rest.url");
+ String url = "";
+ String tmpUrl = RangerConfiguration.getInstance().get(propertyPrefix + ".policy.rest.url");
String sslConfigFileName = RangerConfiguration.getInstance().get(propertyPrefix + ".policy.rest.ssl.config.file");
clusterName = RangerConfiguration.getInstance().get(propertyPrefix + ".ambari.cluster.name", "");
int restClientConnTimeOutMs = RangerConfiguration.getInstance().getInt(propertyPrefix + ".policy.rest.client.connection.timeoutMs", 120 * 1000);
int restClientReadTimeOutMs = RangerConfiguration.getInstance().getInt(propertyPrefix + ".policy.rest.client.read.timeoutMs", 30 * 1000);
+ if (!StringUtil.isEmpty(tmpUrl)) {
+ url = tmpUrl.trim();
+ }
+ if (url.endsWith("/")) {
+ url = url.substring(0, url.length() - 1);
+ }
init(url, sslConfigFileName, restClientConnTimeOutMs , restClientReadTimeOutMs);
}