ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathanhur...@apache.org
Subject [11/32] ambari git commit: AMBARI-18987 A general preupgrade check on if services cannot be upgrade are installed (dili)
Date Thu, 01 Dec 2016 17:06:56 GMT
AMBARI-18987 A general preupgrade check on if services cannot be upgrade are installed (dili)


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

Branch: refs/heads/branch-feature-AMBARI-18456
Commit: fff9980992ffcb40e643a4235a7cc36899f1fa5a
Parents: 1087859
Author: Di Li <dili@apache.org>
Authored: Wed Nov 30 12:49:03 2016 -0500
Committer: Di Li <dili@apache.org>
Committed: Wed Nov 30 12:49:03 2016 -0500

----------------------------------------------------------------------
 .../server/checks/ServicePresenceCheck.java     | 55 +++++++++-----------
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml |  5 +-
 .../HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml |  5 +-
 .../stacks/HDP/2.3/upgrades/upgrade-2.5.xml     |  5 +-
 .../stacks/HDP/2.3/upgrades/upgrade-2.6.xml     |  5 +-
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml |  5 +-
 .../HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml |  5 +-
 .../stacks/HDP/2.4/upgrades/upgrade-2.5.xml     |  5 +-
 .../stacks/HDP/2.4/upgrades/upgrade-2.6.xml     |  5 +-
 9 files changed, 57 insertions(+), 38 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
index 0f4eeb1..4642b88 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/ServicePresenceCheck.java
@@ -19,7 +19,6 @@ package org.apache.ambari.server.checks;
 
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
@@ -47,7 +46,7 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
 
   private static final Logger LOG = LoggerFactory.getLogger(ServicePresenceCheck.class);
 
-  static final String KEY_SERVICE_REMOVED = "servcie_removed";
+  static final String KEY_SERVICE_REMOVED = "service_removed";
   /*
    * List of services that do not support upgrade
    * services must be removed before the stack upgrade
@@ -77,28 +76,26 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
     Map<String, String> removedServices = getRemovedServices(request);
     List<String> failReasons = new ArrayList<>();
 
-    if(null != noUpgradeSupportServices && !noUpgradeSupportServices.isEmpty()){
-      String reason = getFailReason(prerequisiteCheck, request);
-      for(String service: noUpgradeSupportServices){
-        if (installedServices.contains(service.toUpperCase())){
-          prerequisiteCheck.getFailedOn().add(service);
-          String msg = String.format(reason, service, service);
-          failReasons.add(msg);
-        }
+    String reason = getFailReason(prerequisiteCheck, request);
+    for(String service: noUpgradeSupportServices){
+      if (installedServices.contains(service.toUpperCase())){
+        prerequisiteCheck.getFailedOn().add(service);
+        String msg = String.format(reason, service, service);
+        failReasons.add(msg);
       }
     }
-    if(null != removedServices){
-      String reason = getFailReason(KEY_SERVICE_REMOVED, prerequisiteCheck, request);
-      for (Map.Entry<String, String> entry : removedServices.entrySet()) {
-        String removedService = entry.getKey();
-        if(installedServices.contains(removedService.toUpperCase())){
-          prerequisiteCheck.getFailedOn().add(removedService);
-          String newService = entry.getValue();
-          String msg = String.format(reason, removedService, newService);
-          failReasons.add(msg);
-        }
+
+    reason = getFailReason(KEY_SERVICE_REMOVED, prerequisiteCheck, request);
+    for (Map.Entry<String, String> entry : removedServices.entrySet()) {
+      String removedService = entry.getKey();
+      if(installedServices.contains(removedService.toUpperCase())){
+        prerequisiteCheck.getFailedOn().add(removedService);
+        String newService = entry.getValue();
+        String msg = String.format(reason, removedService, newService);
+        failReasons.add(msg);
       }
     }
+
     if(!failReasons.isEmpty()){
       prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
       prerequisiteCheck.setFailReason(StringUtils.join(failReasons, '\n'));
@@ -126,52 +123,50 @@ public class ServicePresenceCheck extends AbstractCheckDescriptor{
    * @return service names
    * */
   private List<String> getNoUpgradeSupportServices(PrereqCheckRequest request){
+    List<String> result = new ArrayList<String>();
     String value = getPropertyValue(request, NO_UPGRADE_SUPPORT_SERVICES_PROPERTY_NAME);
     if (null != value){
       String[] services = value.split(",");
-      List<String> result = new ArrayList<String>();
       for(String service: services){
         service = service.trim();
         if (!service.isEmpty()){
           result.add(service);
         }
       }
-      return result;
-    } else {
-      return null;
     }
+    return result;
   }
 
   /**
    * @return service names and new service names map
    * */
   private Map<String, String> getRemovedServices(PrereqCheckRequest request) throws
AmbariException{
+    Map<String, String> result = new LinkedHashMap<String, String>();
     String value = getPropertyValue(request, REMOVED_SERVICES_PROPERTY_NAME);
     String newValue = getPropertyValue(request, NEW_SERVICES_PROPERTY_NAME);
     if(value == null && newValue == null){
-      return null; //no need to check removed services as they are not specified in the upgrade
xml file.
+      return result; //no need to check removed services as they are not specified in the
upgrade xml file.
     } else {
       if (value == null || newValue == null){
-        throw new AmbariException("Removed services must be paired with new services list.");
+        throw new AmbariException(String.format("Both %s and %s list must be specified in
the upgrade XML file.", REMOVED_SERVICES_PROPERTY_NAME, NEW_SERVICES_PROPERTY_NAME));
       } else {
         List<String> oldServices = Arrays.asList(value.split(","));
         List<String> newServices = Arrays.asList(newValue.split(","));
         if (oldServices.size() != newServices.size()){
-          throw new AmbariException("Removed services must be paired with new services list.");
+          throw new AmbariException(String.format("%s must have the same number of services
as the %s list.", NEW_SERVICES_PROPERTY_NAME, REMOVED_SERVICES_PROPERTY_NAME));
         } else {
-          Map<String, String> result = new LinkedHashMap<String, String>();
           for (int i = 0; i < oldServices.size(); i++){
             String oldService = oldServices.get(i).trim();
             String newService = newServices.get(i).trim();
             if (oldService.isEmpty() || newService.isEmpty()) {
-              throw new AmbariException("Removed services must be paired with new services
list.");
+              throw new AmbariException(String.format("Make sure both %s and %s list only
contain comma separated list of services.", NEW_SERVICES_PROPERTY_NAME, REMOVED_SERVICES_PROPERTY_NAME));
             } else {
               result.put(oldService, newService);
             }
           }
-          return result;
         }
       }
     }
+    return result;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
index 1d964f8..24b90b2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.5.xml
@@ -22,12 +22,15 @@
   <type>NON_ROLLING</type>
   <prerequisite-checks>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <configuration>
       <!-- Configuration properties for all pre-reqs including required pre-reqs -->
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
index fe2598b..019c76e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/nonrolling-upgrade-2.6.xml
@@ -22,12 +22,15 @@
   <type>NON_ROLLING</type>
   <prerequisite-checks>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <configuration>
       <!-- Configuration properties for all pre-reqs including required pre-reqs -->
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
index 10219b5..9b4a2a7 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.5.xml
@@ -33,7 +33,7 @@
     <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
     <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
     <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
 
     <!-- Specific to HDP 2.5, Storm is not rolling -->
@@ -45,6 +45,9 @@
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
index 55fc284..c8baea1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.3/upgrades/upgrade-2.6.xml
@@ -33,7 +33,7 @@
     <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
     <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
     <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
 
     <!-- Specific to HDP 2.5, Storm is not rolling -->
@@ -45,6 +45,9 @@
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
index ea9c60c..3608247 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.5.xml
@@ -22,13 +22,16 @@
   <type>NON_ROLLING</type>
   <prerequisite-checks>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
 
     <configuration>
       <!-- Configuration properties for all pre-reqs including required pre-reqs -->
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
   

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
index 6597cde..2a1ecf7 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/nonrolling-upgrade-2.6.xml
@@ -22,13 +22,16 @@
   <type>NON_ROLLING</type>
   <prerequisite-checks>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
 
     <configuration>
       <!-- Configuration properties for all pre-reqs including required pre-reqs -->
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
index 5e457cf..9767f01 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.5.xml
@@ -34,7 +34,7 @@
     <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
     <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
     <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
 
     <!-- Specific to HDP 2.5, Storm is not rolling -->
@@ -46,6 +46,9 @@
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/fff99809/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
index d4f4ff9..2fd7a7a 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.4/upgrades/upgrade-2.6.xml
@@ -34,7 +34,7 @@
     <check>org.apache.ambari.server.checks.ServicesYarnWorkPreservingCheck</check>
     <check>org.apache.ambari.server.checks.YarnRMHighAvailabilityCheck</check>
     <check>org.apache.ambari.server.checks.YarnTimelineServerStatePreservingCheck</check>
-    <check>org.apache.ambari.server.checks.AtlasPresenceCheck</check>
+    <check>org.apache.ambari.server.checks.ServicePresenceCheck</check>
     <check>org.apache.ambari.server.checks.RangerAuditDbCheck</check>
 
     <!-- Specific to HDP 2.5, Storm is not rolling -->
@@ -46,6 +46,9 @@
       <check-properties name="org.apache.ambari.server.checks.HiveDynamicServiceDiscoveryCheck">
         <property name="min-failure-stack-version">HDP-2.3.0.0</property>
       </check-properties>
+      <check-properties name="org.apache.ambari.server.checks.ServicePresenceCheck">
+        <property name="no-upgrade-support-service-names">Atlas</property>
+      </check-properties>
     </configuration>
   </prerequisite-checks>
 


Mime
View raw message