ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [1/2] ambari git commit: AMBARI-21286. WebHDF request doesn't require user.name argument on secured clusters (aonishuk)
Date Tue, 20 Jun 2017 14:35:41 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 22e4b482a -> 0ef583699
  refs/heads/trunk 242d79b8f -> d693273dd


AMBARI-21286. WebHDF request doesn't require user.name argument on secured clusters (aonishuk)


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

Branch: refs/heads/trunk
Commit: d693273dd2ddaa0532dccbf5b709d377122a209d
Parents: 242d79b
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Tue Jun 20 17:35:29 2017 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Tue Jun 20 17:35:29 2017 +0300

----------------------------------------------------------------------
 .../libraries/providers/hdfs_resource.py                    | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d693273d/ambari-common/src/main/python/resource_management/libraries/providers/hdfs_resource.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/providers/hdfs_resource.py
b/ambari-common/src/main/python/resource_management/libraries/providers/hdfs_resource.py
index 69cc7cd..efca23d 100644
--- a/ambari-common/src/main/python/resource_management/libraries/providers/hdfs_resource.py
+++ b/ambari-common/src/main/python/resource_management/libraries/providers/hdfs_resource.py
@@ -160,9 +160,14 @@ class WebHDFSUtil:
     depending on if query was successful or not, we can assert this for them
     """
     target = HdfsResourceProvider.parse_path(target)
+
+    url = format("{address}/webhdfs/v1{target}?op={operation}", address=self.address)
+    request_args = kwargs
+
+    if not self.security_enabled:
+      request_args['user.name'] = self.run_user
     
-    url = format("{address}/webhdfs/v1{target}?op={operation}&user.name={run_user}",
address=self.address, run_user=self.run_user)
-    for k,v in kwargs.iteritems():
+    for k,v in request_args.iteritems():
       url = format("{url}&{k}={v}")
     
     cmd = ["curl", "-sS","-L", "-w", "%{http_code}", "-X", method]


Mime
View raw message