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-13335. Install package command during RU should honor excluded packages - temporary workaround (dlysnichenko)
Date Wed, 07 Oct 2015 11:49:26 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1.2 0ef0b7b62 -> a9290ec85


AMBARI-13335. Install package command during RU should honor excluded packages - temporary
workaround (dlysnichenko)


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

Branch: refs/heads/branch-2.1.2
Commit: a9290ec85f305ceb274e1008346fcf9122cba2b7
Parents: 0ef0b7b
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Wed Oct 7 14:44:14 2015 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Wed Oct 7 14:47:59 2015 +0300

----------------------------------------------------------------------
 ambari-server/conf/unix/ambari.properties       |  1 +
 .../server/configuration/Configuration.java     | 20 ++++++++++++++++++++
 .../ClusterStackVersionResourceProvider.java    | 13 +++++++++++--
 .../HostStackVersionResourceProvider.java       | 13 +++++++++++--
 4 files changed, 43 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/a9290ec8/ambari-server/conf/unix/ambari.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/ambari.properties b/ambari-server/conf/unix/ambari.properties
index 75e0fe1..361f13f 100644
--- a/ambari-server/conf/unix/ambari.properties
+++ b/ambari-server/conf/unix/ambari.properties
@@ -92,3 +92,4 @@ skip.service.checks=false
 
 rolling.upgrade.min.stack=HDP-2.2
 rolling.upgrade.max.stack=
+rolling.upgrade.skip.packages.prefixes=

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9290ec8/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index 6cac860..b39d645 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -21,8 +21,10 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.ArrayList;
 import java.util.EnumSet;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Properties;
@@ -179,8 +181,10 @@ public class Configuration {
   public static final String SERVER_JDBC_PROPERTIES_PREFIX = "server.jdbc.properties.";
   public static final String ROLLING_UPGRADE_MIN_STACK_KEY = "rolling.upgrade.min.stack";
   public static final String ROLLING_UPGRADE_MAX_STACK_KEY = "rolling.upgrade.max.stack";
+  public static final String ROLLING_UPGRADE_SKIP_PACKAGES_PREFIXES_KEY = "rolling.upgrade.skip.packages.prefixes";
   public static final String ROLLING_UPGRADE_MIN_STACK_DEFAULT = "HDP-2.2";
   public static final String ROLLING_UPGRADE_MAX_STACK_DEFAULT = "";
+  public static final String ROLLING_UPGRADE_SKIP_PACKAGES_PREFIXES_DEFAULT = "";
 
   public static final String SERVER_JDBC_CONNECTION_POOL = "server.jdbc.connection-pool";
   public static final String SERVER_JDBC_CONNECTION_POOL_MIN_SIZE = "server.jdbc.connection-pool.min-size";
@@ -893,6 +897,22 @@ public class Configuration {
   }
 
   /**
+   * @return a list of prefixes. Packages whose name starts with any of these
+   * prefixes, should be skipped during upgrade.
+   */
+  public List<String> getRollingUpgradeSkipPackagesPrefixes() {
+    String propertyValue = properties.getProperty(ROLLING_UPGRADE_SKIP_PACKAGES_PREFIXES_KEY,
+            ROLLING_UPGRADE_SKIP_PACKAGES_PREFIXES_DEFAULT);
+    ArrayList<String> res = new ArrayList<>();
+    for (String prefix : propertyValue.split(",")) {
+      if (! prefix.isEmpty()) {
+        res.add(prefix.trim());
+      }
+    }
+    return res;
+  }
+
+  /**
    * Get the map with server config parameters.
    * Keys - public constants of this class
    * @return the map with server config parameters

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9290ec8/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 7030d23..967b9c7 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
@@ -462,7 +462,7 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
     for (ServiceComponentHost component : components) {
       servicesOnHost.add(component.getServiceName());
     }
-
+    List<String> blacklistedPackagePrefixes = configuration.getRollingUpgradeSkipPackagesPrefixes();
     for (String serviceName : servicesOnHost) {
       ServiceInfo info;
       try {
@@ -476,7 +476,16 @@ public class ClusterStackVersionResourceProvider extends AbstractControllerResou
               host.getOsFamily());
       for (ServiceOsSpecific.Package aPackage : packagesForService) {
         if (! aPackage.getSkipUpgrade()) {
-          packages.add(aPackage);
+          boolean blacklisted = false;
+          for(String prefix : blacklistedPackagePrefixes) {
+            if (aPackage.getName().startsWith(prefix)) {
+              blacklisted = true;
+              break;
+            }
+          }
+          if (! blacklisted) {
+            packages.add(aPackage);
+          }
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/a9290ec8/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 a09edd0..43a4423 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
@@ -367,7 +367,7 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource
     for (ServiceComponentHost component : components) {
       servicesOnHost.add(component.getServiceName());
     }
-
+    List<String> blacklistedPackagePrefixes = configuration.getRollingUpgradeSkipPackagesPrefixes();
     for (String serviceName : servicesOnHost) {
       ServiceInfo info;
       try {
@@ -380,7 +380,16 @@ public class HostStackVersionResourceProvider extends AbstractControllerResource
               host.getOsFamily());
       for (ServiceOsSpecific.Package aPackage : packagesForService) {
         if (! aPackage.getSkipUpgrade()) {
-          packages.add(aPackage);
+          boolean blacklisted = false;
+          for(String prefix : blacklistedPackagePrefixes) {
+            if (aPackage.getName().startsWith(prefix)) {
+              blacklisted = true;
+              break;
+            }
+          }
+          if (! blacklisted) {
+            packages.add(aPackage);
+          }
         }
       }
     }


Mime
View raw message