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-17173. Allow option to skip duplicate URL checking when creating VDF. Part 2 (ncole)
Date Mon, 13 Jun 2016 19:07:30 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 7594165a4 -> 9d0661d18


AMBARI-17173. Allow option to skip duplicate URL checking when creating VDF. Part 2 (ncole)


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

Branch: refs/heads/branch-2.4
Commit: 9d0661d184aedc38597444cf3d209c454103898f
Parents: 7594165
Author: Nate Cole <ncole@hortonworks.com>
Authored: Mon Jun 13 15:06:14 2016 -0400
Committer: Nate Cole <ncole@hortonworks.com>
Committed: Mon Jun 13 15:07:25 2016 -0400

----------------------------------------------------------------------
 .../RepositoryVersionResourceProvider.java        | 18 ++++++++----------
 .../VersionDefinitionResourceProviderTest.java    |  2 +-
 2 files changed, 9 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9d0661d1/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 62568cf..8d6e6e2 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
@@ -477,16 +477,14 @@ public class RepositoryVersionResourceProvider extends AbstractAuthorizedResourc
 
     final Set<String> osRepositoryVersion = new HashSet<String>();
 
-    if (!skipUrlCheck) {
-      for (OperatingSystemEntity os: repositoryVersion.getOperatingSystems()) {
-        osRepositoryVersion.add(os.getOsType());
-
-        for (RepositoryEntity repositoryEntity : os.getRepositories()) {
-          String baseUrl = repositoryEntity.getBaseUrl();
-          if (os.isAmbariManagedRepos() && existingRepoUrls.contains(baseUrl)) {
-            throw new AmbariException("Base url " + baseUrl + " is already defined for another
repository version. " +
-                    "Setting up base urls that contain the same versions of components will
cause stack upgrade to fail.");
-          }
+    for (OperatingSystemEntity os: repositoryVersion.getOperatingSystems()) {
+      osRepositoryVersion.add(os.getOsType());
+
+      for (RepositoryEntity repositoryEntity : os.getRepositories()) {
+        String baseUrl = repositoryEntity.getBaseUrl();
+        if (!skipUrlCheck && os.isAmbariManagedRepos() && existingRepoUrls.contains(baseUrl))
{
+          throw new AmbariException("Base url " + baseUrl + " is already defined for another
repository version. " +
+                  "Setting up base urls that contain the same versions of components will
cause stack upgrade to fail.");
         }
       }
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/9d0661d1/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
index 3bc4aec..6b66f12 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/VersionDefinitionResourceProviderTest.java
@@ -521,7 +521,7 @@ public class VersionDefinitionResourceProviderTest {
     Assert.assertNotNull(res.getPropertyValue("VersionDefinition/validation"));
 
     validation = (Set<String>) res.getPropertyValue("VersionDefinition/validation");
-    Assert.assertEquals(3, validation.size());
+    Assert.assertEquals(2, validation.size());
     for (String reason : validation) {
       if (reason.contains("http://baseurl1")) {
         Assert.fail("URL validation should be skipped for http://baseurl1");


Mime
View raw message