AMBARI-22444 - Add Native Libraries To Tez Tarball (part3) (jonathanhurley)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a393926c Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a393926c Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a393926c Branch: refs/heads/branch-feature-AMBARI-20859 Commit: a393926c5cdae85b567349c89098712d21a5e1ec Parents: f087874 Author: Jonathan Hurley <jhur...@hortonworks.com> Authored: Thu Nov 16 09:43:24 2017 -0500 Committer: Jonathan Hurley <jhur...@hortonworks.com> Committed: Thu Nov 16 11:46:27 2017 -0500 ---------------------------------------------------------------------- .../resource_management/libraries/functions/copy_tarball.py | 9 +++++++++ 1 file changed, 9 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a393926c/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 7bca967..9b6fb98 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 @@ -58,8 +58,11 @@ def _prepare_tez_tarball(): temp_dir = Script.get_tmp_dir() + # create the temp staging directories ensuring that non-root agents using tarfile can work with them mapreduce_temp_dir = tempfile.mkdtemp(prefix="mapreduce-tarball-", dir=temp_dir) tez_temp_dir = tempfile.mkdtemp(prefix="tez-tarball-", dir=temp_dir) + sudo.chmod(mapreduce_temp_dir, 0777) + sudo.chmod(tez_temp_dir, 0777) Logger.info("Extracting {0} to {1}".format(mapreduce_source_file, mapreduce_temp_dir)) tar_archive.extract_archive(mapreduce_source_file, mapreduce_temp_dir) @@ -76,11 +79,17 @@ def _prepare_tez_tarball(): if not os.path.exists(tez_lib_dir): raise Fail("Unable to seed the Tez tarball with native libraries since the target Tez lib directory {0} does not exist".format(tez_lib_dir)) + # ensure that the tez/lib directory is readable by non-root (which it typically is not) + sudo.chmod(tez_lib_dir, 0755) + + # copy native libraries from hadoop to tez Execute(("cp", "-a", hadoop_lib_native_dir, tez_lib_dir), sudo = True) + # create the staging directory so that non-root agents can write to it tez_native_tarball_staging_dir = os.path.join(temp_dir, "tez-native-tarball-staging") if not os.path.exists(tez_native_tarball_staging_dir): Directory(tez_native_tarball_staging_dir, + mode = 0777, cd_access='a', create_parents = True, recursive_ownership = True)