AMBARI-13672. HistoryServer fails to start due to permissions issue (umask 027) (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5985ef4e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5985ef4e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5985ef4e Branch: refs/heads/branch-2.1 Commit: 5985ef4e47789402edfbd65e9ddb3981d85dca80 Parents: 55c3948 Author: Andrew Onishuk <aonis...@hortonworks.com> Authored: Mon Nov 2 11:45:31 2015 +0200 Committer: Andrew Onishuk <aonis...@hortonworks.com> Committed: Mon Nov 2 11:45:31 2015 +0200 ---------------------------------------------------------------------- .../libraries/functions/copy_tarball.py | 2 +- .../libraries/functions/get_user_call_output.py | 16 +++++++++++++--- .../0.60.0.2.2/package/scripts/params_linux.py | 2 +- .../SLIDER/0.60.0.2.2/package/scripts/slider.py | 6 +++--- .../python/stacks/2.2/SLIDER/test_slider_client.py | 10 +++------- 5 files changed, 21 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/5985ef4e/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py index 51a6a3c..d442852 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/copy_tarball.py @@ -35,7 +35,7 @@ STACK_VERSION_PATTERN = "{{ stack_version }}" TARBALL_MAP = { "HDP": { - "slider": ("/usr/hdp/{0}/slider/slider.tar.gz".format(STACK_VERSION_PATTERN), + "slider": ("/usr/hdp/{0}/slider/lib/slider.tar.gz".format(STACK_VERSION_PATTERN), "/hdp/apps/{0}/slider/slider.tar.gz".format(STACK_VERSION_PATTERN)), "tez": ("/usr/hdp/{0}/tez/lib/tez.tar.gz".format(STACK_VERSION_PATTERN), "/hdp/apps/{0}/tez/tez.tar.gz".format(STACK_VERSION_PATTERN)), http://git-wip-us.apache.org/repos/asf/ambari/blob/5985ef4e/ambari-common/src/main/python/resource_management/libraries/functions/get_user_call_output.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/get_user_call_output.py b/ambari-common/src/main/python/resource_management/libraries/functions/get_user_call_output.py index 732cc7f..016161c 100644 --- a/ambari-common/src/main/python/resource_management/libraries/functions/get_user_call_output.py +++ b/ambari-common/src/main/python/resource_management/libraries/functions/get_user_call_output.py @@ -23,6 +23,8 @@ Ambari Agent import os import tempfile from resource_management.core import shell +from resource_management.core.logger import Logger +from resource_management.core.exceptions import Fail def get_user_call_output(command, user, quiet=False, is_checked_call=True, **call_kwargs): """ @@ -45,14 +47,22 @@ def get_user_call_output(command, user, quiet=False, is_checked_call=True, **cal command_string += " 1>" + out_files[0].name command_string += " 2>" + out_files[1].name - func = shell.checked_call if is_checked_call else shell.call - func_result = func(shell.as_user(command_string, user), quiet=quiet, **call_kwargs) + code, _ = shell.call(shell.as_user(command_string, user), quiet=quiet, **call_kwargs) files_output = [] for f in out_files: files_output.append(f.read().strip('\n')) + + if code: + all_output = files_output[1] + '\n' + files_output[0] + err_msg = Logger.filter_text(("Execution of '%s' returned %d. %s") % (command_string, code, all_output)) + + if is_checked_call: + raise Fail(err_msg) + else: + Logger.warning(err_msg) - return func_result[0], files_output[0], files_output[1] + return code, files_output[0], files_output[1] finally: for f in out_files: f.close() http://git-wip-us.apache.org/repos/asf/ambari/blob/5985ef4e/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py index d7bd296..09b7876 100644 --- a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py +++ b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/params_linux.py @@ -37,8 +37,8 @@ if Script.is_hdp_stack_greater_or_equal("2.2"): slider_conf_dir = format("{slider_home_dir}/conf") storm_slider_conf_dir = '/usr/hdp/current/storm-slider-client/conf' -slider_tar_gz = format('{slider_home_dir}/slider.tar.gz') slider_lib_dir = format('{slider_home_dir}/lib') +slider_tar_gz = format('{slider_lib_dir}/slider.tar.gz') user_group = config['configurations']['cluster-env']['user_group'] hdfs_user = config['configurations']['hadoop-env']['hdfs_user'] http://git-wip-us.apache.org/repos/asf/ambari/blob/5985ef4e/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider.py b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider.py index 1ede7f9..2f03d5b 100644 --- a/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider.py +++ b/ambari-server/src/main/resources/common-services/SLIDER/0.60.0.2.2/package/scripts/slider.py @@ -81,7 +81,7 @@ def slider(): mode=0644 ) if Script.is_hdp_stack_greater_or_equal("2.2"): - Execute(('tar', '-czvf', params.slider_tar_gz, '--exclude=slider-core*.jar', params.slider_lib_dir), - not_if = format('test -f {slider_tar_gz}'), - sudo = True, + File(params.slider_tar_gz, + owner=params.hdfs_user, + group=params.user_group, ) http://git-wip-us.apache.org/repos/asf/ambari/blob/5985ef4e/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py b/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py index 503cf22..11fb429 100644 --- a/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py +++ b/ambari-server/src/test/python/stacks/2.2/SLIDER/test_slider_client.py @@ -66,13 +66,9 @@ class TestSliderClient(RMFTestCase): mode=0644, content='log4jproperties\nline2' ) - self.assertResourceCalled('Execute', ('tar', - '-czvf', - '/usr/hdp/current/slider-client/slider.tar.gz', - '--exclude=slider-core*.jar', - '/usr/hdp/current/slider-client/lib'), - not_if = 'test -f /usr/hdp/current/slider-client/slider.tar.gz', - sudo = True, + self.assertResourceCalled('File', '/usr/hdp/current/slider-client/lib/slider.tar.gz', + owner = 'hdfs', + group = 'hadoop', ) self.assertNoMoreResources()