You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2014/07/24 18:32:12 UTC
[2/2] git commit: AMBARI-6598. Host maintenance mode does not work
when host contains started Nagios server (dlysnichenko)
AMBARI-6598. Host maintenance mode does not work when host contains started Nagios server (dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/f5c3c22b
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/f5c3c22b
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/f5c3c22b
Branch: refs/heads/trunk
Commit: f5c3c22bd03042d2579b71e4930d5a45760a97af
Parents: 0246ad3
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Jul 24 19:10:16 2014 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Thu Jul 24 19:31:43 2014 +0300
----------------------------------------------------------------------
.../ambari/server/controller/MaintenanceStateHelper.java | 6 +++++-
.../ambari/server/controller/MaintenanceStateHelperTest.java | 7 +++++--
2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/f5c3c22b/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
index 77c7167..6a429be 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/MaintenanceStateHelper.java
@@ -271,10 +271,14 @@ public class MaintenanceStateHelper {
new RequestResourceFilter(NAGIOS_SERVICE, NAGIOS_COMPONENT, null);
for (String clusterName : clusterNames) {
+ RequestOperationLevel level =
+ new RequestOperationLevel(Resource.Type.HostComponent,
+ clusterName, NAGIOS_SERVICE, NAGIOS_COMPONENT, null);
+
ExecuteActionRequest actionRequest = new ExecuteActionRequest(
clusterName, null, NAGIOS_ACTION_NAME,
Collections.singletonList(resourceFilter),
- null, params);
+ level, params);
if (null == response) {
// createAction() may throw an exception if Nagios is in MS or
http://git-wip-us.apache.org/repos/asf/ambari/blob/f5c3c22b/ambari-server/src/test/java/org/apache/ambari/server/controller/MaintenanceStateHelperTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/MaintenanceStateHelperTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/MaintenanceStateHelperTest.java
index 8b9b36a..c9ac5bb 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/MaintenanceStateHelperTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/MaintenanceStateHelperTest.java
@@ -120,7 +120,8 @@ public class MaintenanceStateHelperTest {
Assert.assertEquals("NAGIOS", resourceFilter.getServiceName());
Assert.assertEquals("NAGIOS_SERVER", resourceFilter.getComponentName());
Assert.assertEquals("c1", ear.getClusterName());
- Assert.assertTrue(map.containsKey("context"));
+ Assert.assertTrue(map.containsKey("context"));
+ Assert.assertEquals(ear.getOperationLevel().getLevel(), Type.HostComponent);
}
private void testHost(MaintenanceState state) throws Exception {
@@ -178,7 +179,8 @@ public class MaintenanceStateHelperTest {
Assert.assertEquals("NAGIOS", resourceFilter.getServiceName());
Assert.assertEquals("NAGIOS_SERVER", resourceFilter.getComponentName());
Assert.assertEquals("c1", ear.getClusterName());
- Assert.assertTrue(map.containsKey("context"));
+ Assert.assertTrue(map.containsKey("context"));
+ Assert.assertEquals(ear.getOperationLevel().getLevel(), Type.HostComponent);
}
private void testService(MaintenanceState state) throws Exception {
@@ -238,6 +240,7 @@ public class MaintenanceStateHelperTest {
Assert.assertEquals("NAGIOS_SERVER", resourceFilter.getComponentName());
Assert.assertEquals("c1", ear.getClusterName());
Assert.assertTrue(map.containsKey("context"));
+ Assert.assertEquals(ear.getOperationLevel().getLevel(), Type.HostComponent);
}
@Test