ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject ambari git commit: AMBARI-9120. Parallel package installation under SLES misbehaves (dlysnichenko)
Date Mon, 19 Jan 2015 17:13:11 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 20250f473 -> ea6c4ecaf


AMBARI-9120. Parallel package installation under SLES misbehaves (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: ea6c4ecaf7e7d7f0cb0beeed889b8192ded2254a
Parents: 20250f4
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Mon Jan 19 19:11:25 2015 +0200
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Mon Jan 19 19:11:25 2015 +0200

----------------------------------------------------------------------
 .../ClusterStackVersionResourceProvider.java    |  2 +-
 .../HostStackVersionResourceProvider.java       |  2 +-
 .../DistributeRepositoriesActionListener.java   |  5 +-
 .../custom_actions/scripts/install_packages.py  | 19 +++++++-
 .../custom_actions/TestInstallPackages.py       | 50 ++++++++++++++++++--
 5 files changed, 69 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ea6c4eca/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
index a33930d..6d503e2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ClusterStackVersionResourceProvider.java
@@ -88,7 +88,7 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
   protected static final String CLUSTER_STACK_VERSION_REPOSITORY_VERSION_PROPERTY_ID   =
PropertyHelper.getPropertyId("ClusterStackVersions", "repository_version");
 
   protected static final String INSTALL_PACKAGES_ACTION = "install_packages";
-  protected static final String INSTALL_PACKAGES_FULL_NAME = "Distribute repositories/install
packages";
+  protected static final String INSTALL_PACKAGES_FULL_NAME = "Install version";
 
   @SuppressWarnings("serial")
   private static Set<String> pkPropertyIds = new HashSet<String>() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea6c4eca/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
index 51cf340..b36c6e9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/HostStackVersionResourceProvider.java
@@ -86,7 +86,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource
   protected static final String HOST_STACK_VERSION_REPO_VERSION_PROPERTY_ID    = PropertyHelper.getPropertyId("HostStackVersions",
"repository_version");
 
   protected static final String INSTALL_PACKAGES_ACTION = "install_packages";
-  protected static final String INSTALL_PACKAGES_FULL_NAME = "Distribute repositories/install
packages";
+  protected static final String INSTALL_PACKAGES_FULL_NAME = "Install version";
 
 
   @SuppressWarnings("serial")

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea6c4eca/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/DistributeRepositoriesActionListener.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/DistributeRepositoriesActionListener.java
b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/DistributeRepositoriesActionListener.java
index da6e680..feca260 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/DistributeRepositoriesActionListener.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/events/listeners/upgrade/DistributeRepositoriesActionListener.java
@@ -169,9 +169,8 @@ public class DistributeRepositoriesActionListener {
         }
       } else {
         LOG.error(
-                String.format("Can not transition host stack version state from %s to %s
for" +
-                                "host %s",
-                        hostVersion.getState(), newHostState, event.getHostname()));
+                "Can not transition host stack version state from {} to {} for " +
+                                "host {}", hostVersion.getState(), newHostState, event.getHostname());
       }
     }
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea6c4eca/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 83c8037..32732f1 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
@@ -22,6 +22,7 @@ Ambari Agent
 
 import json
 import sys
+import re
 import traceback
 from resource_management import *
 from resource_management.libraries.functions.list_ambari_managed_repos import list_ambari_managed_repos
@@ -85,7 +86,8 @@ class InstallPackages(Script):
         packages_installed_before = [package[0] for package in packages_installed_before]
         packages_were_checked = True
         for package in package_list:
-          Package(package['name'], use_repos=list(current_repo_files) if OSCheck.is_ubuntu_family()
else current_repositories)
+          name = self.format_package_name(package['name'], repository_version)
+          Package(name, use_repos=list(current_repo_files) if OSCheck.is_ubuntu_family()
else current_repositories)
         package_install_result = True
       except Exception, err:
         print "Can not install packages."
@@ -145,5 +147,20 @@ class InstallPackages(Script):
     )
     return repo['repoName'], file_name
 
+  def format_package_name(self, package_name, repo_id):
+    """
+    This method overcomes problems at SLES SP3. Zypper here behaves differently
+    than at SP1, and refuses to install packages by mask if there is any installed package
that
+    matches this mask.
+    So we preppend concrete HDP version to mask under Suse
+    """
+    if OSCheck.is_suse_family() and '*' in package_name:
+      mask_version = re.search(r'((_\d+)*(_)?\*)', package_name).group(0)
+      formatted_version = '_' + repo_id.replace('.', '_').replace('-', '_') + '*'
+      return package_name.replace(mask_version, formatted_version)
+    else:
+      return package_name
+
+
 if __name__ == "__main__":
   InstallPackages().execute()

http://git-wip-us.apache.org/repos/asf/ambari/blob/ea6c4eca/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 0ad56c8..a3e18fd 100644
--- a/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
+++ b/ambari-server/src/test/python/custom_actions/TestInstallPackages.py
@@ -45,7 +45,7 @@ class TestInstallPackages(RMFTestCase):
                        command="actionexecute",
                        config_file="install_packages_config.json",
                        target=RMFTestCase.TARGET_CUSTOM_ACTIONS,
-                       os_type=('Suse', '11', 'Final'),
+                       os_type=('Redhat', '6.4', 'Final'),
     )
     self.assertTrue(put_structured_out.called)
     self.assertEquals(put_structured_out.call_args[0][0],
@@ -91,7 +91,7 @@ class TestInstallPackages(RMFTestCase):
                        command="actionexecute",
                        config_file="install_packages_config.json",
                        target=RMFTestCase.TARGET_CUSTOM_ACTIONS,
-                       os_type=('Suse', '11', 'Final'),
+                       os_type=('Redhat', '6.4', 'Final'),
     )
     self.assertTrue(put_structured_out.called)
     self.assertEquals(put_structured_out.call_args[0][0],
@@ -154,7 +154,7 @@ class TestInstallPackages(RMFTestCase):
                       command="actionexecute",
                       config_file="install_packages_config.json",
                       target=RMFTestCase.TARGET_CUSTOM_ACTIONS,
-                      os_type=('Suse', '11', 'Final'))
+                      os_type=('Redhat', '6.4', 'Final'))
 
     self.assertTrue(put_structured_out.called)
     self.assertEquals(put_structured_out.call_args[0][0],
@@ -185,3 +185,47 @@ class TestInstallPackages(RMFTestCase):
     self.assertResourceCalled('Package', 'snappy_fake_pkg', action=["remove"])
     self.assertNoMoreResources()
 
+
+  @patch("resource_management.libraries.script.Script.put_structured_out")
+  @patch("resource_management.libraries.functions.packages_analyzer.allInstalledPackages",
+         new=MagicMock(side_effect = _add_packages))
+  def test_format_package_name(self, put_structured_out):
+    self.executeScript("scripts/install_packages.py",
+                       classname="InstallPackages",
+                       command="actionexecute",
+                       config_file="install_packages_config.json",
+                       target=RMFTestCase.TARGET_CUSTOM_ACTIONS,
+                       os_type=('Suse', '11', 'Final'),
+                       )
+    self.assertTrue(put_structured_out.called)
+    self.assertEquals(put_structured_out.call_args[0][0],
+                      {'package_installation_result': 'SUCCESS',
+                       'installed_repository_version': u'2.2.0.1-885',
+                       'ambari_repositories': []})
+    self.assertResourceCalled('Repository', 'HDP-UTILS-2.2.0.1-885',
+                              base_url=u'http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0',
+                              action=['create'],
+                              components=[u'HDP-UTILS', 'main'],
+                              repo_template='repo_suse_rhel.j2',
+                              repo_file_name=u'HDP-2.2.0.1-885',
+                              mirror_list=None,
+                              append_to_file=False,
+                              )
+    self.assertResourceCalled('Repository', 'HDP-2.2.0.1-885',
+                              base_url=u'http://s3.amazonaws.com/dev.hortonworks.com/HDP/centos5/2.x/updates/2.2.0.0',
+                              action=['create'],
+                              components=[u'HDP', 'main'],
+                              repo_template='repo_suse_rhel.j2',
+                              repo_file_name=u'HDP-2.2.0.1-885',
+                              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.assertNoMoreResources()
+


Mime
View raw message