ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject ambari git commit: AMBARI-9076. Pre-Upgrade Check shows incorrect check results and blocks the user from proceeding (Yurii Shylov via ncole)
Date Fri, 09 Jan 2015 21:00:01 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 25a3a1962 -> 29ef16162


AMBARI-9076. Pre-Upgrade Check shows incorrect check results and blocks the user from proceeding
(Yurii Shylov via ncole)


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

Branch: refs/heads/trunk
Commit: 29ef1616271a5a30be23beb5454e4c7f27519e2d
Parents: 25a3a19
Author: Nate Cole <ncole@hortonworks.com>
Authored: Fri Jan 9 15:56:45 2015 -0500
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Fri Jan 9 15:56:45 2015 -0500

----------------------------------------------------------------------
 .../ambari/server/controller/PreUpgradeCheckRequest.java  | 10 +++++-----
 .../internal/PreUpgradeCheckResourceProvider.java         |  6 +++---
 .../apache/ambari/server/state/UpgradeCheckHelper.java    |  9 +++++----
 3 files changed, 13 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/29ef1616/ambari-server/src/main/java/org/apache/ambari/server/controller/PreUpgradeCheckRequest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/PreUpgradeCheckRequest.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/PreUpgradeCheckRequest.java
index 86619e8..bc7e7f3 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/PreUpgradeCheckRequest.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/PreUpgradeCheckRequest.java
@@ -22,7 +22,7 @@ package org.apache.ambari.server.controller;
  */
 public class PreUpgradeCheckRequest {
   private final String clusterName;
-  private String repositoryVersionName;
+  private String repositoryVersion;
 
   //TODO make repositoryVersionName also final as soon as UI will be changed to always provide
it to API
   public PreUpgradeCheckRequest(String clusterName) {
@@ -33,11 +33,11 @@ public class PreUpgradeCheckRequest {
     return clusterName;
   }
 
-  public String getRepositoryVersionName() {
-    return repositoryVersionName;
+  public String getRepositoryVersion() {
+    return repositoryVersion;
   }
 
-  public void setRepositoryVersionName(String repositoryVersionName) {
-    this.repositoryVersionName = repositoryVersionName;
+  public void setRepositoryVersion(String repositoryVersion) {
+    this.repositoryVersion = repositoryVersion;
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/29ef1616/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
index 009b5fe..d4ec2de 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/PreUpgradeCheckResourceProvider.java
@@ -109,7 +109,7 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider
{
       final String clusterName = propertyMap.get(UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID).toString();
       final PreUpgradeCheckRequest upgradeCheckRequest = new PreUpgradeCheckRequest(clusterName);
       if (propertyMap.containsKey(UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID)) {
-        upgradeCheckRequest.setRepositoryVersionName(propertyMap.get(UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID).toString());
+        upgradeCheckRequest.setRepositoryVersion(propertyMap.get(UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID).toString());
       }
       for (UpgradeCheck upgradeCheck: upgradeChecks.performPreUpgradeChecks(upgradeCheckRequest))
{
         final Resource resource = new ResourceImpl(Resource.Type.PreUpgradeCheck);
@@ -120,8 +120,8 @@ public class PreUpgradeCheckResourceProvider extends ReadOnlyResourceProvider
{
         setResourceProperty(resource, UPGRADE_CHECK_FAILED_ON_PROPERTY_ID, upgradeCheck.getFailedOn(),
requestedIds);
         setResourceProperty(resource, UPGRADE_CHECK_CHECK_TYPE_PROPERTY_ID, upgradeCheck.getType(),
requestedIds);
         setResourceProperty(resource, UPGRADE_CHECK_CLUSTER_NAME_PROPERTY_ID, upgradeCheck.getClusterName(),
requestedIds);
-        if (upgradeCheckRequest.getRepositoryVersionName() != null) {
-          setResourceProperty(resource, UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID, upgradeCheckRequest.getRepositoryVersionName(),
requestedIds);
+        if (upgradeCheckRequest.getRepositoryVersion() != null) {
+          setResourceProperty(resource, UPGRADE_CHECK_REPOSITORY_VERSION_PROPERTY_ID, upgradeCheckRequest.getRepositoryVersion(),
requestedIds);
         }
         resources.add(resource);
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/29ef1616/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeCheckHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeCheckHelper.java
b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeCheckHelper.java
index 4d16a83..8ea259d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeCheckHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeCheckHelper.java
@@ -310,7 +310,7 @@ public class UpgradeCheckHelper {
 
     @Override
     public boolean isApplicable(PreUpgradeCheckRequest request) throws AmbariException {
-      return request.getRepositoryVersionName() != null;
+      return request.getRepositoryVersion() != null;
     }
 
     @Override
@@ -318,10 +318,11 @@ public class UpgradeCheckHelper {
       final String clusterName = request.getClusterName();
       final Cluster cluster = clustersProvider.get().getCluster(clusterName);
       final Map<String, Host> clusterHosts = clustersProvider.get().getHostsForCluster(clusterName);
-      final RepositoryVersionEntity repositoryVersion = repositoryVersionDaoProvider.get().findByDisplayName(request.getRepositoryVersionName());
+      final StackId stackId = cluster.getDesiredStackVersion();
+      final RepositoryVersionEntity repositoryVersion = repositoryVersionDaoProvider.get().findByStackAndVersion(stackId.getStackId(),
request.getRepositoryVersion());
       if (repositoryVersion == null) {
         upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Repository version " + request.getRepositoryVersionName()
+ " doesn't exist");
+        upgradeCheck.setFailReason("Repository version " + request.getRepositoryVersion()
+ " doesn't exist");
         upgradeCheck.getFailedOn().addAll(clusterHosts.keySet());
         return;
       }
@@ -336,7 +337,7 @@ public class UpgradeCheckHelper {
       }
       if (!upgradeCheck.getFailedOn().isEmpty()) {
         upgradeCheck.setStatus(UpgradeCheckStatus.FAIL);
-        upgradeCheck.setFailReason("Some hosts do not have repository version " + request.getRepositoryVersionName()
+ " installed");
+        upgradeCheck.setFailReason("Some hosts do not have repository version " + request.getRepositoryVersion()
+ " installed");
       }
     }
   }


Mime
View raw message