You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2015/09/22 11:53:13 UTC
ambari git commit: AMBARI-13178. RU: Failed to install new stack on
U14, ambari-agent non root.(vbrodetskyi)
Repository: ambari
Updated Branches:
refs/heads/branch-2.1 3936a72a5 -> 8d851b51f
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/8d851b51
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8d851b51
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8d851b51
Branch: refs/heads/branch-2.1
Commit: 8d851b51f0276ef79274a31580c18bf8fc0bd82d
Parents: 3936a72
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Tue Sep 22 12:49:51 2015 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Tue Sep 22 12:49:51 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/8d851b51/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/8d851b51/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