You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2017/11/17 13:32:30 UTC

[06/11] ambari git commit: AMBARI-22444 - Add Native Libraries To Tez Tarball (part3) (jonathanhurley)

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/3279bef5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3279bef5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3279bef5

Branch: refs/heads/branch-feature-AMBARI-22457
Commit: 3279bef5288cc84f89cbd1a170b78f5af276eae3
Parents: 658e76e
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Thu Nov 16 09:43:24 2017 -0500
Committer: Jonathan Hurley <jh...@hortonworks.com>
Committed: Thu Nov 16 11:44:18 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/3279bef5/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 1dbf1a4..dfe7c62 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)