You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2015/11/06 11:49:30 UTC

[2/2] ambari git commit: AMBARI-13761. RU: SUSE new stack install failed (aonishuk)

AMBARI-13761. RU: SUSE new stack install failed (aonishuk)


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

Branch: refs/heads/branch-2.1
Commit: 44608b299cd3541fd6b518789632b2a75318347a
Parents: a2a633b
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Nov 6 12:49:20 2015 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Nov 6 12:49:20 2015 +0200

----------------------------------------------------------------------
 .../custom_actions/scripts/install_packages.py  | 28 +++++++++++++++++++-
 .../configs/install_packages_config.json        |  9 +++++++
 2 files changed, 36 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/44608b29/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 dd43c8f..8fc9ab7 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
@@ -300,7 +300,8 @@ class InstallPackages(Script):
       allInstalledPackages(packages_installed_before)
       packages_installed_before = [package[0] for package in packages_installed_before]
       packages_were_checked = True
-      for package in package_list:
+      filtered_package_list = self.filter_package_list(package_list)
+      for package in filtered_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,
@@ -383,6 +384,31 @@ class InstallPackages(Script):
   def abort_handler(self, signum, frame):
     Logger.error("Caught signal {0}, will handle it gracefully. Compute the actual version if possible before exiting.".format(signum))
     self.check_partial_install()
+    
+  def filter_package_list(self, package_list):
+    """
+    Note: that we have skipUpgrade option in metainfo.xml to filter packages,
+    so use this method only if, for some reason the metainfo option cannot be used.
+    
+    Here we filter packages that are managed with custom logic in package
+    scripts. Usually this packages come from system repositories, and either
+     are not available when we restrict repository list, or should not be
+    installed on host at all.
+    :param package_list: original list
+    :return: filtered package_list
+    """
+    filtered_package_list = []
+    for package in package_list:
+      skip_package = False
+      
+      # skip upgrade for hadooplzo* versioned package, only if lzo is disabled 
+      io_compression_codecs = default("/configurations/core-site/io.compression.codecs", None)
+      if not io_compression_codecs or "com.hadoop.compression.lzo" not in io_compression_codecs:
+        skip_package = package['name'].startswith('hadooplzo')
+
+      if not skip_package:
+        filtered_package_list.append(package)
+    return filtered_package_list
 
 
 if __name__ == "__main__":

http://git-wip-us.apache.org/repos/asf/ambari/blob/44608b29/ambari-server/src/test/python/custom_actions/configs/install_packages_config.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/custom_actions/configs/install_packages_config.json b/ambari-server/src/test/python/custom_actions/configs/install_packages_config.json
index 6ecf8d8..50e327a 100644
--- a/ambari-server/src/test/python/custom_actions/configs/install_packages_config.json
+++ b/ambari-server/src/test/python/custom_actions/configs/install_packages_config.json
@@ -82,5 +82,14 @@
         "hs_host": [
             "0b3.vm"
         ]
+    },
+    "configurations": {
+        "cluster-env": {
+            "repo_suse_rhel_template": "[{{repo_id}}]\nname={{repo_id}}\n{% if mirror_list %}mirrorlist={{mirror_list}}{% else %}baseurl={{base_url}}{% endif %}\n\npath=/\nenabled=1\ngpgcheck=0", 
+            "repo_ubuntu_template": "{{package_type}} {{base_url}} {{components}}"
+        },
+        "core-site": {
+            "io.compression.codecs": "com.hadoop.compression.lzo"
+        }
     }
 }