Repository: ambari Updated Branches: refs/heads/branch-2.6 c57e243d2 -> 54bc2a2e3 refs/heads/trunk 99b19e580 -> 024907346
AMBARI-22513 Make yumrpm.py functions to use global defined commands (dgrinenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/54bc2a2e Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/54bc2a2e Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/54bc2a2e Branch: refs/heads/branch-2.6 Commit: 54bc2a2e38a022356f1c405f755ac1b000450b3a Parents: c57e243 Author: Dmytro Grinenko <[email protected]> Authored: Fri Nov 24 15:55:20 2017 +0200 Committer: Dmytro Grinenko <[email protected]> Committed: Fri Nov 24 15:55:20 2017 +0200 ---------------------------------------------------------------------- .../core/providers/package/yumrpm.py | 4 ++-- .../HIVE/0.12.0.2.0/package/scripts/hive.py | 12 ++++++------ .../test/python/stacks/2.0.6/HIVE/test_hive_server.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/54bc2a2e/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py ---------------------------------------------------------------------- diff --git a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py index 24f03f7..fdf1743 100644 --- a/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py +++ b/ambari-common/src/main/python/resource_management/core/providers/package/yumrpm.py @@ -138,7 +138,7 @@ class YumProvider(RPMBasedPackageProvider): :rtype list[list,] """ - cmd = [AMBARI_SUDO_BINARY, "yum", "list", "available"] + cmd = list(ALL_AVAILABLE_PACKAGES_CMD) if repo_filter: cmd.extend(["--disablerepo=*", "--enablerepo=" + repo_filter]) @@ -154,7 +154,7 @@ class YumProvider(RPMBasedPackageProvider): :rtype list[list,] """ - packages = self._lookup_packages([AMBARI_SUDO_BINARY, "yum", "list", "installed"], "Installed Packages") + packages = self._lookup_packages(list(ALL_INSTALLED_PACKAGES_CMD), "Installed Packages") if repo_filter: packages = [item for item in packages if item[2].lower() == repo_filter.lower()] http://git-wip-us.apache.org/repos/asf/ambari/blob/54bc2a2e/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py index abbe59e..a02f951 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py +++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py @@ -24,7 +24,7 @@ from urlparse import urlparse from resource_management.libraries.script.script import Script from resource_management.libraries.resources.hdfs_resource import HdfsResource -from resource_management.libraries.functions.copy_tarball import copy_to_hdfs +from resource_management.libraries.functions import copy_tarball from resource_management.libraries.functions import StackFeature from resource_management.libraries.functions.stack_features import check_stack_feature from resource_management.core.resources.service import ServiceConfig @@ -138,19 +138,19 @@ def hive(name=None): # ********************************* # if copy tarball to HDFS feature supported copy mapreduce.tar.gz and tez.tar.gz to HDFS if params.stack_version_formatted_major and check_stack_feature(StackFeature.COPY_TARBALL_TO_HDFS, params.stack_version_formatted_major): - copy_to_hdfs("mapreduce", params.user_group, params.hdfs_user, skip=params.sysprep_skip_copy_tarballs_hdfs) - copy_to_hdfs("tez", params.user_group, params.hdfs_user, skip=params.sysprep_skip_copy_tarballs_hdfs) + copy_tarball.copy_to_hdfs("mapreduce", params.user_group, params.hdfs_user, skip=params.sysprep_skip_copy_tarballs_hdfs) + copy_tarball.copy_to_hdfs("tez", params.user_group, params.hdfs_user, skip=params.sysprep_skip_copy_tarballs_hdfs) # Always copy pig.tar.gz and hive.tar.gz using the appropriate mode. # This can use a different source and dest location to account - copy_to_hdfs("pig", + copy_tarball.copy_to_hdfs("pig", params.user_group, params.hdfs_user, file_mode=params.tarballs_mode, custom_source_file=params.pig_tar_source, custom_dest_file=params.pig_tar_dest_file, skip=params.sysprep_skip_copy_tarballs_hdfs) - copy_to_hdfs("hive", + copy_tarball.copy_to_hdfs("hive", params.user_group, params.hdfs_user, file_mode=params.tarballs_mode, @@ -171,7 +171,7 @@ def hive(name=None): src_filename = os.path.basename(source_file) dest_file = os.path.join(dest_dir, src_filename) - copy_to_hdfs(tarball_name, + copy_tarball.copy_to_hdfs(tarball_name, params.user_group, params.hdfs_user, file_mode=params.tarballs_mode, http://git-wip-us.apache.org/repos/asf/ambari/blob/54bc2a2e/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py index fa230cb..dca7c18 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py @@ -781,12 +781,12 @@ class TestHiveServer(RMFTestCase): @patch("os.path.exists", new = MagicMock(return_value=True)) @patch("platform.linux_distribution", new = MagicMock(return_value="Linux")) def test_stop_during_upgrade(self, copy_to_hdfs_mock): - hiveServerVersionOutput = """WARNING: Use "yarn jar" to launch YARN applications. Hive 1.2.1.2.3.0.0-2434 Subversion git://ip-10-0-0-90.ec2.internal/grid/0/jenkins/workspace/HDP-dal-centos6/bigtop/build/hive/rpm/BUILD/hive-1.2.1.2.3.0.0 -r a77a00ae765a73b2957337e96ed5a0dbb2e60dfb Compiled by jenkins on Sat Jun 20 11:50:41 EDT 2015 From source with checksum 150f554beae04f76f814f59549dead8b""" + call_side_effects = [(0, hiveServerVersionOutput), (0, hiveServerVersionOutput)] * 4 copy_to_hdfs_mock.return_value = True
