ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alejan...@apache.org
Subject ambari git commit: AMBARI-14281. EU/RU can fail if register a repo without a build number that already exists, add PreCheck (alejandro)
Date Wed, 09 Dec 2015 21:39:08 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 7640ce4f9 -> 85d2fa19d


AMBARI-14281. EU/RU can fail if register a repo without a build number that already exists,
add PreCheck (alejandro)


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

Branch: refs/heads/branch-2.2
Commit: 85d2fa19d04277ef0f12a0525d78e560f4911305
Parents: 7640ce4
Author: Alejandro Fernandez <afernandez@hortonworks.com>
Authored: Wed Dec 9 13:18:36 2015 -0800
Committer: Alejandro Fernandez <afernandez@hortonworks.com>
Committed: Wed Dec 9 13:32:54 2015 -0800

----------------------------------------------------------------------
 .../apache/ambari/server/checks/InstallPackagesCheck.java   | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/85d2fa19/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
b/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
index 334b434..bbf2198 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/checks/InstallPackagesCheck.java
@@ -61,13 +61,14 @@ public class InstallPackagesCheck extends AbstractCheckDescriptor {
     final String repoVersion = request.getRepositoryVersion();
 
     final RepositoryVersionEntity rve = repositoryVersionDaoProvider.get().findByStackNameAndVersion(stackName,
request.getRepositoryVersion());
-    if (rve.getVersion().indexOf("-") < 0 ) {
+    if (StringUtils.isBlank(rve.getVersion()) || !rve.getVersion().matches("^\\d+(\\.\\d+)*\\-\\d+$"))
{
       String message = MessageFormat.format("The Repository Version {0} for Stack {1} must
contain a \"-\" followed by a build number. " +
-              "Make sure that another registered repository does not have the same repo URL
or " +
-              "shares the same build number. Next, try reinstalling the Repository Version.",
rve.getVersion(), rve.getStackVersion());
-      prerequisiteCheck.setFailedOn(new LinkedHashSet<String>() {{ add("Repository
Version " + rve.getVersion()); }});
+          "Make sure that another registered repository does not have the same repo URL or
" +
+          "shares the same build number. Next, try reinstalling the Repository Version.",
rve.getVersion(), rve.getStackVersion());
+      prerequisiteCheck.getFailedOn().add("Repository Version " + rve.getVersion());
       prerequisiteCheck.setStatus(PrereqCheckStatus.FAIL);
       prerequisiteCheck.setFailReason(message);
+      return;
     }
 
     final ClusterVersionEntity clusterVersion = clusterVersionDAOProvider.get().findByClusterAndStackAndVersion(


Mime
View raw message