You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ma...@apache.org on 2017/02/14 08:30:49 UTC
ambari git commit: AMBARI-19961. KERBEROS_CLIENT is not included
automatically in all hostgroups when scaling a cluster after server restart
(magyari_sandor)
Repository: ambari
Updated Branches:
refs/heads/trunk 6bb86b103 -> eb1b9cfaa
AMBARI-19961. KERBEROS_CLIENT is not included automatically in all hostgroups when scaling a cluster after server restart (magyari_sandor)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/eb1b9cfa
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/eb1b9cfa
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/eb1b9cfa
Branch: refs/heads/trunk
Commit: eb1b9cfaa869e25577b3502b68c08efbbf1cbaf5
Parents: 6bb86b1
Author: Sandor Magyari <sm...@hortonworks.com>
Authored: Fri Feb 10 22:09:29 2017 +0100
Committer: Sandor Magyari <sm...@hortonworks.com>
Committed: Tue Feb 14 09:30:29 2017 +0100
----------------------------------------------------------------------
.../ambari/server/topology/TopologyManager.java | 6 ++++
.../server/topology/TopologyManagerTest.java | 35 +++++++++++++++++---
2 files changed, 36 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/eb1b9cfa/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
index 3103c34..c4c3dd2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/topology/TopologyManager.java
@@ -174,6 +174,12 @@ public class TopologyManager {
synchronized (initializationLock) {
if (!isInitialized) {
replayRequests(persistedState.getAllRequests());
+ // ensure KERBEROS_CLIENT is present in each hostgroup even if it's not in original BP
+ for(ClusterTopology clusterTopology : clusterTopologyMap.values()) {
+ if (clusterTopology.isClusterKerberosEnabled()) {
+ addKerberosClient(clusterTopology);
+ }
+ }
isInitialized = true;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/eb1b9cfa/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
index 07060b7..4f087f0 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/topology/TopologyManagerTest.java
@@ -149,6 +149,9 @@ public class TopologyManagerTest {
private ResourceProvider resourceProvider;
@Mock(type = MockType.STRICT)
private SettingDAO settingDAO;
+ @Mock(type = MockType.NICE)
+ private ClusterTopology clusterTopologyMock;
+
@Mock(type = MockType.STRICT)
private Future mockFuture;
@@ -342,7 +345,6 @@ public class TopologyManagerTest {
persistedState.persistLogicalRequest(logicalRequest, 1);
expectLastCall().anyTimes();
-
Class clazz = TopologyManager.class;
Field f = clazz.getDeclaredField("executor");
@@ -364,12 +366,12 @@ public class TopologyManagerTest {
PowerMock.verify(System.class);
verify(blueprint, stack, request, group1, group2, ambariContext, logicalRequestFactory,
logicalRequest, configurationRequest, configurationRequest2, configurationRequest3,
- requestStatusResponse, executor, persistedState, mockFuture, settingDAO);
+ requestStatusResponse, executor, persistedState, clusterTopologyMock, mockFuture, settingDAO);
PowerMock.reset(System.class);
reset(blueprint, stack, request, group1, group2, ambariContext, logicalRequestFactory,
logicalRequest, configurationRequest, configurationRequest2, configurationRequest3,
- requestStatusResponse, executor, persistedState, mockFuture, settingDAO);
+ requestStatusResponse, executor, persistedState, clusterTopologyMock, mockFuture, settingDAO);
}
@Test
@@ -383,6 +385,29 @@ public class TopologyManagerTest {
}
@Test
+ public void testAddKerberosClientAtTopologyInit() throws Exception {
+ Map<ClusterTopology, List<LogicalRequest>> allRequests = new HashMap<>();
+ List<LogicalRequest> requestList = new ArrayList<>();
+ requestList.add(logicalRequest);
+ expect(logicalRequest.hasCompleted()).andReturn(true).anyTimes();
+ allRequests.put(clusterTopologyMock, requestList);
+ expect(requestStatusResponse.getTasks()).andReturn(Collections.<ShortTaskStatus>emptyList()).anyTimes();
+ expect(clusterTopologyMock.isClusterKerberosEnabled()).andReturn(true);
+ expect(clusterTopologyMock.getClusterId()).andReturn(CLUSTER_ID).anyTimes();
+ expect(clusterTopologyMock.getBlueprint()).andReturn(blueprint).anyTimes();
+ expect(persistedState.getAllRequests()).andReturn(allRequests).anyTimes();
+ expect(persistedState.getProvisionRequest(CLUSTER_ID)).andReturn(logicalRequest).anyTimes();
+ expect(ambariContext.isTopologyResolved(CLUSTER_ID)).andReturn(true).anyTimes();
+ expect(group1.addComponent("KERBEROS_CLIENT")).andReturn(true);
+ expect(group2.addComponent("KERBEROS_CLIENT")).andReturn(true);
+
+ replayAll();
+
+ topologyManager.provisionCluster(request);
+ //todo: assertions
+ }
+
+ @Test
public void testBlueprintRequestCompletion() throws Exception {
List<ShortTaskStatus> tasks = new ArrayList<>();
ShortTaskStatus t1 = new ShortTaskStatus();
@@ -498,8 +523,8 @@ public class TopologyManagerTest {
private void replayAll() {
replay(blueprint, stack, request, group1, group2, ambariContext, logicalRequestFactory,
configurationRequest, configurationRequest2, configurationRequest3, executor,
- persistedState, securityConfigurationFactory, credentialStoreService, clusterController, resourceProvider,
- mockFuture, requestStatusResponse, logicalRequest, settingDAO);
+ persistedState, clusterTopologyMock, securityConfigurationFactory, credentialStoreService,
+ clusterController, resourceProvider, mockFuture, requestStatusResponse, logicalRequest, settingDAO);
}
@Test(expected = InvalidTopologyException.class)