ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vbrodets...@apache.org
Subject ambari git commit: AMBARI-13178. RU: Failed to install new stack on U14, ambari-agent non root.(vbrodetskyi)
Date Tue, 22 Sep 2015 09:54:48 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f596785cd -> a892ba9c8


AMBARI-13178. RU: Failed to install new stack on U14, ambari-agent non root.(vbrodetskyi)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a892ba9c
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a892ba9c
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a892ba9c

Branch: refs/heads/trunk
Commit: a892ba9c8060041bbc07bce3486c44e5f71fddf0
Parents: f596785
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Tue Sep 22 12:54:31 2015 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Tue Sep 22 12:54:31 2015 +0300

----------------------------------------------------------------------
 .../resource_management/core/providers/package/apt.py       | 3 ++-
 .../src/main/python/resource_management/core/sudo.py        | 9 ++++++++-
 2 files changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a892ba9c/ambari-common/src/main/python/resource_management/core/providers/package/apt.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/package/apt.py
b/ambari-common/src/main/python/resource_management/core/providers/package/apt.py
index 3de42a6..ddd6952 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/package/apt.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/package/apt.py
@@ -26,6 +26,7 @@ import re
 
 from resource_management.core.providers.package import PackageProvider
 from resource_management.core import shell
+from resource_management.core import sudo
 from resource_management.core.shell import string_cmd_from_args_list
 from resource_management.core.logger import Logger
 
@@ -70,7 +71,7 @@ class AptProvider(PackageProvider):
           if repo != 'base':
             new_sources_file = os.path.join(apt_sources_list_tmp_dir, repo + '.list')
             Logger.info("Temporal sources file will be copied: %s" % new_sources_file)
-            shutil.copy(os.path.join(APT_SOURCES_LIST_DIR, repo + '.list'), new_sources_file)
+            sudo.copy(os.path.join(APT_SOURCES_LIST_DIR, repo + '.list'), new_sources_file)
             copied_sources_files.append(new_sources_file)
         cmd = cmd + ['-o', 'Dir::Etc::SourceParts=%s' % apt_sources_list_tmp_dir]
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/a892ba9c/ambari-common/src/main/python/resource_management/core/sudo.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/sudo.py b/ambari-common/src/main/python/resource_management/core/sudo.py
index 9915ff3..1a83ec5 100644
--- a/ambari-common/src/main/python/resource_management/core/sudo.py
+++ b/ambari-common/src/main/python/resource_management/core/sudo.py
@@ -46,6 +46,9 @@ if os.geteuid() == 0:
       os.chmod(path, st.st_mode | mode_to_stat[mode])
     else:
       shell.checked_call(["chmod", mode, path])
+      
+  def copy(src, dst):
+    shutil.copy(src, dst)
     
   def makedirs(path, mode):
     os.makedirs(path, mode)
@@ -214,4 +217,8 @@ else:
     try:
       shell.checked_call(["kill", "-"+str(signal), str(pid)], sudo=True)
     except Fail as ex:
-      raise OSError(str(ex))
\ No newline at end of file
+      raise OSError(str(ex))
+    
+  # shutil.copy replacement
+  def copy(src, dst):
+    shell.checked_call(["sudo", "cp", "-r", src, dst], sudo=True)
\ No newline at end of file


Mime
View raw message