ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject ambari git commit: AMBARI-10416. Allow Ranger usersync process to be run as ranger (non-root user) (aonishuk)
Date Fri, 10 Apr 2015 09:29:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b8d2992e4 -> 860d0094a


AMBARI-10416. Allow Ranger usersync process to be run as ranger (non-root user) (aonishuk)


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

Branch: refs/heads/trunk
Commit: 860d0094a95474fc10690230b90e1a82682aef40
Parents: b8d2992
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Fri Apr 10 12:29:37 2015 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Fri Apr 10 12:29:37 2015 +0300

----------------------------------------------------------------------
 .../RANGER/0.4.0/package/scripts/params.py         |  3 +++
 .../RANGER/0.4.0/package/scripts/ranger_service.py | 17 ++++++++++++-----
 .../RANGER/0.4.0/package/scripts/setup_ranger.py   |  3 +++
 3 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/860d0094/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
index b4cc7f3..ac2bc0a 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py
@@ -32,6 +32,7 @@ stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
 hdp_stack_version = format_hdp_stack_version(stack_version_unformatted)
 
 stack_is_hdp22_or_further = hdp_stack_version != "" and compare_versions(hdp_stack_version,
'2.2') >= 0
+stack_is_hdp23_or_further = hdp_stack_version != "" and compare_versions(hdp_stack_version,
'2.3') >= 0
 
 if stack_is_hdp22_or_further:
   ranger_home    = '/usr/hdp/current/ranger-admin'
@@ -41,6 +42,8 @@ if stack_is_hdp22_or_further:
   usersync_home  = '/usr/hdp/current/ranger-usersync'
   usersync_start = '/usr/bin/ranger-usersync-start'
   usersync_stop  = '/usr/bin/ranger-usersync-stop'
+  
+usersync_services_file = "/usr/hdp/current/ranger-usersync/ranger-usersync-services.sh"
 
 java_home = config['hostLevelParams']['java_home']
 unix_user  = default("/configurations/ranger-env/ranger_user", "ranger")

http://git-wip-us.apache.org/repos/asf/ambari/blob/860d0094/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py
index 2bc32aa..f3b9603 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py
@@ -27,8 +27,15 @@ def ranger_service(name):
     Execute(format('{params.ranger_start}'), user=params.unix_user, not_if=no_op_test)
   elif name == 'ranger_usersync':
     no_op_test = format('ps -ef | grep proc_rangerusersync | grep -v grep')
-    # Usersync requires to be run as root.
-    Execute((params.usersync_start,), 
-            not_if=no_op_test,
-            sudo=True,
-    )
\ No newline at end of file
+    
+    if params.stack_is_hdp23_or_further:
+      Execute(params.usersync_start, 
+              not_if=no_op_test,
+              user=params.unix_user,
+      )
+    else:
+      # Usersync requires to be run as root for 2.2
+      Execute((params.usersync_start,), 
+              not_if=no_op_test,
+              sudo=True,
+      )
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/860d0094/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
index e2b81c8..c1f365c 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
@@ -115,6 +115,9 @@ def setup_usersync():
   Execute(('chown', params.unix_user, params.usersync_stop),
     sudo = True,
   )
+  File(params.usersync_services_file,
+    mode = 0755,
+  )
 
 def write_properties_to_file(file_path, value):
   for key in value:


Mime
View raw message