ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject [1/3] ambari git commit: Revert "AMBARI-18324: Externalize skip repo url check to ambari.properties instead of hardcoding it in Ambari Java code (dili)"
Date Wed, 14 Sep 2016 09:55:54 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 580a35139 -> 02256c3ff


Revert "AMBARI-18324: Externalize skip repo url check to ambari.properties instead of hardcoding
it in Ambari Java code (dili)"

This reverts commit 623c36d2e0832d9a0bc60bc9ff19b302d5e3cefa.


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

Branch: refs/heads/trunk
Commit: 962e06aca097ec02ee52f2284fb804c0c60425ad
Parents: 580a351
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Wed Sep 14 12:53:59 2016 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Wed Sep 14 12:53:59 2016 +0300

----------------------------------------------------------------------
 .../server/configuration/Configuration.java     | 25 +-------------------
 .../RepositoryVersionResourceProvider.java      | 15 +-----------
 .../server/configuration/ConfigurationTest.java | 20 ----------------
 3 files changed, 2 insertions(+), 58 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/962e06ac/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
index ee73b8d..0690ca8 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java
@@ -2300,14 +2300,6 @@ public class Configuration {
   public static final ConfigurationProperty<Integer> TASK_ID_LIST_LIMIT = new ConfigurationProperty<>(
       "task.query.parameterlist.size", 999);
 
-  /**
-   * A comma separated list of repo ids to skip the repo url check when registering a repo
for the stack
-   * @return
-   */
-  @Markdown(description = "The list of repo ids to skip the repo url check when registering
a repo for the stack.")
-  public static final ConfigurationProperty<String> SKIP_REPO_URL_EXISTENCE_VALIDATION_LIST
= new ConfigurationProperty<>(
-      "no.repo.existence.validation.list", "HDP-UTILS");
-
   private static final Logger LOG = LoggerFactory.getLogger(
     Configuration.class);
 
@@ -4833,22 +4825,6 @@ public class Configuration {
   }
 
   /**
-   * Default to HDP-UTILS
-   * */
-  public List<String> getSkipRepoUrlExistenceValidationList(){
-    List<String> list = new ArrayList<String>();
-    String propValue = getProperty(SKIP_REPO_URL_EXISTENCE_VALIDATION_LIST);
-    for (String repo: propValue.split(",")) {
-      repo = repo.trim();
-      if (!repo.isEmpty()) {
-        list.add(repo);
-      }
-    }
-    LOG.debug("Skip Repo URL Existence Validation on :" + list);
-    return list;
-  }
-
-  /**
    * Generates a markdown table which includes:
    * <ul>
    * <li>Property key name</li>
@@ -5211,4 +5187,5 @@ public class Configuration {
     ClusterSizeType clusterSize();
     String value();
   }
+
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/962e06ac/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 cd440f3..e440460 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
@@ -32,7 +32,6 @@ import org.apache.ambari.server.ObjectNotFoundException;
 import org.apache.ambari.server.api.resources.OperatingSystemResourceDefinition;
 import org.apache.ambari.server.api.resources.RepositoryResourceDefinition;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
-import org.apache.ambari.server.configuration.Configuration;
 import org.apache.ambari.server.controller.spi.NoSuchParentResourceException;
 import org.apache.ambari.server.controller.spi.NoSuchResourceException;
 import org.apache.ambari.server.controller.spi.Predicate;
@@ -458,14 +457,11 @@ public class RepositoryVersionResourceProvider extends AbstractAuthorizedResourc
 
     // List of all repo urls that are already added at stack
     Set<String> existingRepoUrls = new HashSet<String>();
-    Configuration configuration = new Configuration();
-    List<String> skipRepos = configuration.getSkipRepoUrlExistenceValidationList();
     List<RepositoryVersionEntity> existingRepoVersions = dao.findByStack(requiredStack);
     for (RepositoryVersionEntity existingRepoVersion : existingRepoVersions) {
       for (OperatingSystemEntity operatingSystemEntity : existingRepoVersion.getOperatingSystems())
{
         for (RepositoryEntity repositoryEntity : operatingSystemEntity.getRepositories())
{
-          boolean toSkipRepo = isToSkip(repositoryEntity.getRepositoryId(), skipRepos);
-          if (! toSkipRepo && // HDP-UTILS is shared between repo versions
+          if (! repositoryEntity.getRepositoryId().startsWith("HDP-UTILS") &&  //
HDP-UTILS is shared between repo versions
                   ! existingRepoVersion.getId().equals(repositoryVersion.getId())) { // Allow
modifying already defined repo version
             existingRepoUrls.add(repositoryEntity.getBaseUrl());
           }
@@ -552,13 +548,4 @@ public class RepositoryVersionResourceProvider extends AbstractAuthorizedResourc
     // This information is not associated with any particular resource
     return null;
   }
-
-  private static boolean isToSkip(String repoId, List<String> skipRepos){
-    for(String repo: skipRepos){
-      if (repoId.startsWith(repo)){
-        return true;
-      }
-    }
-    return false;
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/962e06ac/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
b/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
index f429a36..f9b76f8 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/configuration/ConfigurationTest.java
@@ -30,7 +30,6 @@ import java.io.FileOutputStream;
 import java.io.IOException;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
-import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -921,23 +920,4 @@ public class ConfigurationTest {
           StringUtils.isEmpty(markdown.description()));
     }
   }
-
-  /**
-   * Tests the default values for the {@link MetricsRetrievalService}.
-   *
-   * @throws Exception
-   */
-  @Test
-  public void testGetSkipRepoUrlExistenceValidationListDefaults() throws Exception {
-
-    final Properties ambariProperties = new Properties();
-    final Configuration configuration = new Configuration(ambariProperties);
-
-    List<String> skipRepos = configuration.getSkipRepoUrlExistenceValidationList();
-
-    // test defaults
-    Assert.assertEquals(skipRepos.size(), 1);
-    String hdpUtils = skipRepos.get(0);
-    Assert.assertTrue("HDP-UTILS".equals(hdpUtils));
-  }
 }


Mime
View raw message