You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2015/09/11 20:12:22 UTC
ambari git commit: AMBARI-13075. Make ambari-server robust/debuggable
if user accidentally adds a config type to a config groups when it does not
exist as base type (aonishuk)
Repository: ambari
Updated Branches:
refs/heads/branch-2.1 0293d4cf0 -> 28689a80b
AMBARI-13075. Make ambari-server robust/debuggable if user accidentally adds a config type to a config groups when it does not exist as base type (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/28689a80
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/28689a80
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/28689a80
Branch: refs/heads/branch-2.1
Commit: 28689a80be836d4242867af3c9ff61ab76a0a311
Parents: 0293d4c
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Sep 11 21:12:03 2015 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Sep 11 21:12:03 2015 +0300
----------------------------------------------------------------------
.../server/controller/internal/ConfigGroupResourceProvider.java | 1 +
.../controller/internal/ConfigGroupResourceProviderTest.java | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/28689a80/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
index 2642792..df24cb6 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProvider.java
@@ -477,6 +477,7 @@ public class ConfigGroupResourceProvider extends
"Attempted to add a config group to a cluster which doesn't exist", e);
}
+ verifyConfigs(request.getConfigs(), request.getClusterName());
validateRequest(request);
Map<Long, ConfigGroup> configGroupMap = cluster.getConfigGroups();
http://git-wip-us.apache.org/repos/asf/ambari/blob/28689a80/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
index 4bf3f15..a92e15c 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/internal/ConfigGroupResourceProviderTest.java
@@ -121,7 +121,7 @@ public class ConfigGroupResourceProviderTest {
ConfigGroupFactory configGroupFactory = createNiceMock(ConfigGroupFactory.class);
ConfigGroup configGroup = createNiceMock(ConfigGroup.class);
- expect(managementController.getClusters()).andReturn(clusters);
+ expect(managementController.getClusters()).andReturn(clusters).anyTimes();
expect(clusters.getCluster("Cluster100")).andReturn(cluster).anyTimes();
expect(clusters.getHost("h1")).andReturn(h1);
expect(clusters.getHost("h2")).andReturn(h2);
@@ -131,6 +131,7 @@ public class ConfigGroupResourceProviderTest {
expect(hostDAO.findByName("h2")).andReturn(hostEntity2).atLeastOnce();
expect(hostEntity1.getHostId()).andReturn(1L).atLeastOnce();
expect(hostEntity2.getHostId()).andReturn(2L).atLeastOnce();
+ expect(cluster.isConfigTypeExists("core-site")).andReturn(true).anyTimes();
Capture<Cluster> clusterCapture = new Capture<Cluster>();
Capture<String> captureName = new Capture<String>();