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-16125. 500-error on PUT to the repository_versions endpoint (ncole)
Date Wed, 27 Apr 2016 14:28:08 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk fbd53ed75 -> bff239c08


AMBARI-16125. 500-error on PUT to the repository_versions endpoint (ncole)


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

Branch: refs/heads/trunk
Commit: bff239c08cb0409898f71c764c0514c03b0ca087
Parents: fbd53ed
Author: Nate Cole <ncole@hortonworks.com>
Authored: Tue Apr 26 13:45:01 2016 -0400
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Wed Apr 27 10:27:55 2016 -0400

----------------------------------------------------------------------
 .../RepositoryVersionResourceProvider.java      | 40 --------------------
 1 file changed, 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/bff239c0/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProvider.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProvider.java
index 0370384..57fb115 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/RepositoryVersionResourceProvider.java
@@ -19,7 +19,6 @@ package org.apache.ambari.server.controller.internal;
 
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.EnumSet;
 import java.util.HashMap;
@@ -56,7 +55,6 @@ import org.apache.ambari.server.security.authorization.AuthorizationException;
 import org.apache.ambari.server.security.authorization.AuthorizationHelper;
 import org.apache.ambari.server.security.authorization.ResourceType;
 import org.apache.ambari.server.security.authorization.RoleAuthorization;
-import org.apache.ambari.server.state.Cluster;
 import org.apache.ambari.server.state.Clusters;
 import org.apache.ambari.server.state.OperatingSystemInfo;
 import org.apache.ambari.server.state.RepositoryVersionState;
@@ -65,7 +63,6 @@ import org.apache.ambari.server.state.StackId;
 import org.apache.ambari.server.state.StackInfo;
 import org.apache.ambari.server.state.repository.ManifestServiceInfo;
 import org.apache.ambari.server.state.repository.VersionDefinitionXml;
-import org.apache.ambari.server.state.stack.UpgradePack;
 import org.apache.ambari.server.state.stack.upgrade.RepositoryVersionHelper;
 import org.apache.commons.lang.ObjectUtils;
 import org.apache.commons.lang.StringUtils;
@@ -214,10 +211,6 @@ public class RepositoryVersionResourceProvider extends AbstractAuthorizedResourc
             throw new AmbariException("Repository version for stack " + entity.getStack()
+ " and version " + entity.getVersion() + " already exists");
           }
 
-          if (!upgradePackExists(entity.getVersion())) {
-            throw new AmbariException("Stack " + entity.getStackId() + " doesn't have upgrade
packages");
-          }
-
           validateRepositoryVersion(repositoryVersionDAO, ambariMetaInfo, entity);
 
           repositoryVersionDAO.create(entity);
@@ -361,10 +354,6 @@ public class RepositoryVersionResourceProvider extends AbstractAuthorizedResourc
             entity.setDisplayName(propertyMap.get(REPOSITORY_VERSION_DISPLAY_NAME_PROPERTY_ID).toString());
           }
 
-          if (!upgradePackExists(entity.getVersion())) {
-            throw new AmbariException("Stack " + entity.getStackId() + " doesn't have upgrade
packages");
-          }
-
           validateRepositoryVersion(repositoryVersionDAO, ambariMetaInfo, entity);
 
           repositoryVersionDAO.merge(entity);
@@ -504,35 +493,6 @@ public class RepositoryVersionResourceProvider extends AbstractAuthorizedResourc
   }
 
   /**
-   * Check for required upgrade pack across all stack definitions
-   * @param checkVersion version to check (e.g. 2.2.3.0-1111)
-   * @return existence flag
-   */
-  private boolean upgradePackExists(String checkVersion) throws AmbariException{
-    Collection<StackInfo> stacks = new ArrayList<StackInfo>();
-
-    // Search results only in the installed stacks
-    for (Cluster cluster : clusters.get().getClusters().values()){
-      stacks.add(ambariMetaInfo.getStack(cluster.getCurrentStackVersion().getStackName(),
-                                          cluster.getCurrentStackVersion().getStackVersion()));
-    }
-
-    for (StackInfo si: stacks){
-      Map<String, UpgradePack> upgradePacks = si.getUpgradePacks();
-      if (upgradePacks!=null) {
-        for (UpgradePack upgradePack: upgradePacks.values()){
-          if (upgradePack.canBeApplied(checkVersion)) {
-            // If we found at least one match, the rest could be skipped
-            return true;
-          }
-        }
-      }
-    }
-   return false;
-  }
-
-
-  /**
    * Transforms map of json properties to repository version entity.
    *
    * @param properties json map


Mime
View raw message