You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2015/02/27 14:29:10 UTC
[2/2] ambari git commit: AMBARI-9829. Ranger usersync process needs
to be run as root (aonishuk)
AMBARI-9829. Ranger usersync process needs to be run as root (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/debec671
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/debec671
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/debec671
Branch: refs/heads/branch-2.0.0
Commit: debec6710c380347be40a5098dd3b482a90580a3
Parents: 0435e44
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Feb 27 15:28:51 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Feb 27 15:28:51 2015 +0200
----------------------------------------------------------------------
ambari-common/src/main/python/resource_management/core/shell.py | 2 +-
.../RANGER/0.4.0/package/scripts/ranger_service.py | 5 +++--
.../RANGER/0.4.0/package/scripts/ranger_usersync.py | 2 +-
.../src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py | 2 +-
4 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/debec671/ambari-common/src/main/python/resource_management/core/shell.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/shell.py b/ambari-common/src/main/python/resource_management/core/shell.py
index a58102f..b1ab0bc 100644
--- a/ambari-common/src/main/python/resource_management/core/shell.py
+++ b/ambari-common/src/main/python/resource_management/core/shell.py
@@ -138,7 +138,7 @@ def _call(command, logoutput=None, throw_on_failure=True,
command = command.replace(placeholder, replacement.format(env_str=env_str))
master_fd, slave_fd = pty.openpty()
- Logger.info(command) # TODO: remove this before commit
+
# --noprofile is used to preserve PATH set for ambari-agent
subprocess_command = ["/bin/bash","--login","--noprofile","-c", command]
proc = subprocess.Popen(subprocess_command, bufsize=1, stdout=slave_fd, stderr=subprocess.STDOUT,
http://git-wip-us.apache.org/repos/asf/ambari/blob/debec671/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 ac0c05c..2bc32aa 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,7 +27,8 @@ 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')
- Execute(params.usersync_start,
+ # Usersync requires to be run as root.
+ Execute((params.usersync_start,),
not_if=no_op_test,
- user=params.unix_user,
+ sudo=True,
)
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/debec671/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
index d2ca35e..afb86c1 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_usersync.py
@@ -40,7 +40,7 @@ class RangerUsersync(Script):
import params
env.set_params(params)
- Execute(format('{params.usersync_stop}'))
+ Execute((params.usersync_stop,), sudo=True)
def pre_rolling_restart(self, env):
import params
http://git-wip-us.apache.org/repos/asf/ambari/blob/debec671/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py b/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
index 2269d3c..74f9ce8 100644
--- a/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
+++ b/ambari-server/src/test/python/stacks/2.2/RANGER/test_ranger_usersync.py
@@ -43,5 +43,5 @@ class TestRangerUserSync(RMFTestCase):
target = RMFTestCase.TARGET_COMMON_SERVICES)
self.assertTrue(setup_usersync_mock.called)
- self.assertResourceCalled("Execute", "/usr/bin/ranger-usersync-stop")
+ self.assertResourceCalled("Execute", ("/usr/bin/ranger-usersync-stop",), sudo=True)
self.assertResourceCalled("Execute", "hdp-select set ranger-usersync 2.2.2.0-2399")
\ No newline at end of file