Repository: ambari Updated Branches: refs/heads/branch-2.0.0 0435e4444 -> debec6710 refs/heads/trunk e1b2a0fe9 -> 6ed6784c3
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/6ed6784c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/6ed6784c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/6ed6784c Branch: refs/heads/trunk Commit: 6ed6784c366d5a28d36f413d6d2207686a9bfa4f Parents: e1b2a0f Author: Andrew Onishuk <[email protected]> Authored: Fri Feb 27 15:28:49 2015 +0200 Committer: Andrew Onishuk <[email protected]> Committed: Fri Feb 27 15:28:49 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/6ed6784c/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/6ed6784c/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/6ed6784c/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/6ed6784c/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
