ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-12169 Ambari RU doesn't work with Redhat satellite (dsen)
Date Fri, 26 Jun 2015 18:21:38 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 0376eb1a3 -> 0c68a6e1e


AMBARI-12169 Ambari RU doesn't work with Redhat satellite (dsen)


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

Branch: refs/heads/trunk
Commit: 0c68a6e1e02cbad10a5c66e54aebbc728f169f4b
Parents: 0376eb1
Author: Dmytro Sen <dsen@apache.org>
Authored: Fri Jun 26 21:18:45 2015 +0300
Committer: Dmytro Sen <dsen@apache.org>
Committed: Fri Jun 26 21:20:31 2015 +0300

----------------------------------------------------------------------
 .../core/providers/package/__init__.py          |  4 +-
 .../core/providers/package/apt.py               |  6 +--
 .../core/providers/package/choco.py             |  4 +-
 .../core/providers/package/yumrpm.py            | 10 ++--
 .../core/providers/package/zypper.py            |  6 +--
 .../core/resources/packaging.py                 |  1 +
 .../custom_actions/scripts/install_packages.py  | 12 ++---
 .../custom_actions/TestInstallPackages.py       | 56 ++++++++++----------
 8 files changed, 49 insertions(+), 50 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0c68a6e1/ambari-common/src/main/python/resource_management/core/providers/package/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/package/__init__.py
b/ambari-common/src/main/python/resource_management/core/providers/package/__init__.py
index ad48b43..7e532bc 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/package/__init__.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/package/__init__.py
@@ -42,11 +42,11 @@ class PackageProvider(Provider):
 
   def action_install(self):
     package_name = self.get_package_name_with_version()
-    self.install_package(package_name, self.resource.use_repos)
+    self.install_package(package_name, self.resource.use_repos, self.resource.skip_repos)
 
   def action_upgrade(self):
     package_name = self.get_package_name_with_version()
-    self.upgrade_package(package_name, self.resource.use_repos)
+    self.upgrade_package(package_name, self.resource.use_repos, self.resource.skip_repos)
 
   def action_remove(self):
     package_name = self.get_package_name_with_version()

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c68a6e1/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 c4cae2a..3de42a6 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
@@ -55,7 +55,7 @@ def replace_underscores(function_to_decorate):
 class AptProvider(PackageProvider):
 
   @replace_underscores
-  def install_package(self, name, use_repos=[]):
+  def install_package(self, name, use_repos=[], skip_repos=[]):
     if use_repos or not self._check_existence(name):
       cmd = INSTALL_CMD[self.get_logoutput()]
       copied_sources_files = []
@@ -100,8 +100,8 @@ class AptProvider(PackageProvider):
       Logger.info("Skipping installation of existing package %s" % (name))
 
   @replace_underscores
-  def upgrade_package(self, name, use_repos=[]):
-    return self.install_package(name, use_repos)
+  def upgrade_package(self, name, use_repos=[], skip_repos=[]):
+    return self.install_package(name, use_repos, skip_repos)
 
   @replace_underscores
   def remove_package(self, name):

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c68a6e1/ambari-common/src/main/python/resource_management/core/providers/package/choco.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/package/choco.py
b/ambari-common/src/main/python/resource_management/core/providers/package/choco.py
index cd345fa..db55296 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/package/choco.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/package/choco.py
@@ -46,7 +46,7 @@ CHECK_CMD = {
 }
 
 class ChocoProvider(PackageProvider):
-  def install_package(self, name, use_repos=[]):
+  def install_package(self, name, use_repos=[], skip_repos=[]):
     if not self._check_existence(name) or use_repos:
       cmd = INSTALL_CMD[self.get_logoutput()]
       if use_repos:
@@ -62,7 +62,7 @@ class ChocoProvider(PackageProvider):
     else:
       Logger.info("Skipping installation of existing package %s" % (name))
 
-  def upgrade_package(self, name, use_repos=[]):
+  def upgrade_package(self, name, use_repos=[], skip_repos=[]):
     cmd = UPGRADE_CMD[self.get_logoutput()]
     if use_repos:
       enable_repo_option = '-s' + ",".join(use_repos)

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c68a6e1/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 c17b7f0..87938ad 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
@@ -24,7 +24,6 @@ from resource_management.core.providers.package import PackageProvider
 from resource_management.core import shell
 from resource_management.core.shell import string_cmd_from_args_list
 from resource_management.core.logger import Logger
-from resource_management.core.utils import suppress_stdout
 import os
 
 INSTALL_CMD = {
@@ -38,20 +37,21 @@ REMOVE_CMD = {
 }
 
 class YumProvider(PackageProvider):
-  def install_package(self, name, use_repos=[]):
+  def install_package(self, name, use_repos=[], skip_repos=[]):
     if use_repos or not self._check_existence(name):
       cmd = INSTALL_CMD[self.get_logoutput()]
       if use_repos:
         enable_repo_option = '--enablerepo=' + ",".join(use_repos)
-        cmd = cmd + ['--disablerepo=*', enable_repo_option]
+        disable_repo_option = '--disablerepo=' + "*,".join(skip_repos)
+        cmd = cmd + [disable_repo_option, enable_repo_option]
       cmd = cmd + [name]
       Logger.info("Installing package %s ('%s')" % (name, string_cmd_from_args_list(cmd)))
       shell.checked_call(cmd, sudo=True, logoutput=self.get_logoutput())
     else:
       Logger.info("Skipping installation of existing package %s" % (name))
 
-  def upgrade_package(self, name, use_repos=[]):
-    return self.install_package(name, use_repos)
+  def upgrade_package(self, name, use_repos=[], skip_repos=[]):
+    return self.install_package(name, use_repos, skip_repos)
 
   def remove_package(self, name):
     if self._check_existence(name):

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c68a6e1/ambari-common/src/main/python/resource_management/core/providers/package/zypper.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/providers/package/zypper.py
b/ambari-common/src/main/python/resource_management/core/providers/package/zypper.py
index dd16ce0..aec8f88 100644
--- a/ambari-common/src/main/python/resource_management/core/providers/package/zypper.py
+++ b/ambari-common/src/main/python/resource_management/core/providers/package/zypper.py
@@ -51,7 +51,7 @@ def get_active_base_repos():
 
 
 class ZypperProvider(PackageProvider):
-  def install_package(self, name, use_repos=[]):
+  def install_package(self, name, use_repos=[], skip_repos=[]):
     if use_repos or not self._check_existence(name):
       cmd = INSTALL_CMD[self.get_logoutput()]
       if use_repos:
@@ -70,8 +70,8 @@ class ZypperProvider(PackageProvider):
     else:
       Logger.info("Skipping installation of existing package %s" % (name))
 
-  def upgrade_package(self, name, use_repos=[]):
-    return self.install_package(name, use_repos)
+  def upgrade_package(self, name, use_repos=[], skip_repos=[]):
+    return self.install_package(name, use_repos, skip_repos)
   
   def remove_package(self, name):
     if self._check_existence(name):

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c68a6e1/ambari-common/src/main/python/resource_management/core/resources/packaging.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/resources/packaging.py
b/ambari-common/src/main/python/resource_management/core/resources/packaging.py
index 4e8c9fc..1ca88af 100644
--- a/ambari-common/src/main/python/resource_management/core/resources/packaging.py
+++ b/ambari-common/src/main/python/resource_management/core/resources/packaging.py
@@ -32,6 +32,7 @@ class Package(Resource):
 
   # Allow using only specific list of repositories when performing action
   use_repos = ResourceArgument(default=[])
+  skip_repos = ResourceArgument(default=[])
   """
   True           -  log it in INFO mode
   False          -  never log it

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c68a6e1/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
index 0681afe..8d1c07f 100644
--- a/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
+++ b/ambari-server/src/main/resources/custom_actions/scripts/install_packages.py
@@ -83,12 +83,8 @@ class InstallPackages(Script):
 
     # Install/update repositories
     installed_repositories = []
-    self.current_repositories = ['base']
-    # Some packages are installed from core repos
-    if OSCheck.is_redhat_family():
-      # rhui* is used for rhel, and base is for centos
-      self.current_repositories.append('rhui*')
-    self.current_repo_files = set(['base'])
+    self.current_repositories = []
+    self.current_repo_files = set()
 
     Logger.info("Will install packages for repository version {0}".format(self.repository_version))
     try:
@@ -250,7 +246,9 @@ class InstallPackages(Script):
       packages_were_checked = True
       for package in package_list:
         name = self.format_package_name(package['name'], self.repository_version)
-        Package(name, use_repos=list(self.current_repo_files) if OSCheck.is_ubuntu_family()
else self.current_repositories)
+        Package(name,
+                use_repos=list(self.current_repo_files) if OSCheck.is_ubuntu_family() else
self.current_repositories,
+                skip_repos=[self.REPO_FILE_NAME_PREFIX + "*"] if OSCheck.is_redhat_family()
else [])
     except Exception, err:
       ret_code = 1
       Logger.logger.exception("Package Manager failed to install packages. Error: {0}".format(str(err)))

http://git-wip-us.apache.org/repos/asf/ambari/blob/0c68a6e1/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/custom_actions/TestInstallPackages.py b/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
index 6badfd1..1e6dcea 100644
--- a/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
+++ b/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
@@ -92,13 +92,13 @@ class TestInstallPackages(RMFTestCase):
                               mirror_list=None,
                               append_to_file=True,
     )
-    self.assertResourceCalled('Package', 'hadoop_2_2_*', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'snappy', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'snappy-devel', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'lzo', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'hadooplzo_2_2_*', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'hadoop_2_2_*-libhdfs', use_repos=['base', 'rhui*',
'HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'ambari-log4j', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
+    self.assertResourceCalled('Package', 'hadoop_2_2_*', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'snappy', use_repos=['HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'],
skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'snappy-devel', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'lzo', use_repos=['HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'],
skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'hadooplzo_2_2_*', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'hadoop_2_2_*-libhdfs', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'ambari-log4j', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=['HDP-*'])
     self.assertNoMoreResources()
 
   @patch("ambari_commons.os_check.OSCheck.is_suse_family")
@@ -141,13 +141,13 @@ class TestInstallPackages(RMFTestCase):
                               mirror_list=None,
                               append_to_file=True,
                               )
-    self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885*', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'snappy', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'snappy-devel', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'lzo', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885*', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885*-libhdfs', use_repos=['base',
'HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'ambari-log4j', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
+    self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885*', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=[])
+    self.assertResourceCalled('Package', 'snappy', use_repos=['HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'],
skip_repos=[])
+    self.assertResourceCalled('Package', 'snappy-devel', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=[])
+    self.assertResourceCalled('Package', 'lzo', use_repos=['HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'],
skip_repos=[])
+    self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885*', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=[])
+    self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885*-libhdfs', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=[])
+    self.assertResourceCalled('Package', 'ambari-log4j', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=[])
     self.assertNoMoreResources()
 
 
@@ -192,13 +192,13 @@ class TestInstallPackages(RMFTestCase):
                               mirror_list=None,
                               append_to_file=True,
     )
-    self.assertResourceCalled('Package', 'hadoop_2_2_*', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'snappy', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'snappy-devel', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'lzo', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'hadooplzo_2_2_*', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'hadoop_2_2_*-libhdfs', use_repos=['base', 'rhui*',
'HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'ambari-log4j', use_repos=['base', 'rhui*', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
+    self.assertResourceCalled('Package', 'hadoop_2_2_*', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'snappy', use_repos=['HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'],
skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'snappy-devel', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'lzo', use_repos=['HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'],
skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'hadooplzo_2_2_*', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'hadoop_2_2_*-libhdfs', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=['HDP-*'])
+    self.assertResourceCalled('Package', 'ambari-log4j', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=['HDP-*'])
     self.assertNoMoreResources()
 
 
@@ -314,11 +314,11 @@ class TestInstallPackages(RMFTestCase):
                               mirror_list=None,
                               append_to_file=True,
                               )
-    self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885*', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'snappy', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'snappy-devel', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'lzo', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885*', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885*-libhdfs', use_repos=['base',
'HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'])
-    self.assertResourceCalled('Package', 'ambari-log4j', use_repos=['base', 'HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'])
+    self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885*', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=[])
+    self.assertResourceCalled('Package', 'snappy', use_repos=['HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'],
skip_repos=[])
+    self.assertResourceCalled('Package', 'snappy-devel', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=[])
+    self.assertResourceCalled('Package', 'lzo', use_repos=['HDP-UTILS-2.2.0.1-885', 'HDP-2.2.0.1-885'],
skip_repos=[])
+    self.assertResourceCalled('Package', 'hadooplzo_2_2_0_1_885*', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=[])
+    self.assertResourceCalled('Package', 'hadoop_2_2_0_1_885*-libhdfs', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=[])
+    self.assertResourceCalled('Package', 'ambari-log4j', use_repos=['HDP-UTILS-2.2.0.1-885',
'HDP-2.2.0.1-885'], skip_repos=[])
     self.assertNoMoreResources()


Mime
View raw message