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 2014/09/05 00:53:06 UTC

git commit: AMBARI-7011. ambari trunk commit build fails due to NagiosPropertyProviderTest. (Jun Aoki via mahadev)

Repository: ambari
Updated Branches:
  refs/heads/trunk ad983dee1 -> 1c09523b2


AMBARI-7011. ambari trunk commit build fails due to NagiosPropertyProviderTest. (Jun Aoki via mahadev)


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

Branch: refs/heads/trunk
Commit: 1c09523b2f40f38bd60e69a855b5f7e5d4bcbcac
Parents: ad983de
Author: Mahadev Konar <ma...@apache.org>
Authored: Thu Sep 4 15:52:54 2014 -0700
Committer: Mahadev Konar <ma...@apache.org>
Committed: Thu Sep 4 15:52:58 2014 -0700

----------------------------------------------------------------------
 .../server/controller/nagios/NagiosPropertyProvider.java     | 8 ++++++--
 .../server/controller/nagios/NagiosPropertyProviderTest.java | 2 ++
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1c09523b/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java
index 64d5e58..d2e425f 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProvider.java
@@ -79,10 +79,12 @@ public class NagiosPropertyProvider extends BaseProvider implements PropertyProv
   private static final String ALERT_SUMMARY_PASSIVE_PROPERTY_ID = "alerts/summary/PASSIVE";
   private static final String PASSIVE_TOKEN = "AMBARIPASSIVE=";
   
-  private static final List<String> IGNORABLE_FOR_SERVICES = new ArrayList<String>(
+  private static final List<String> DEFAULT_IGNORABLE_FOR_SERVICES = Collections.unmodifiableList(new ArrayList<String>(
       Arrays.asList("NodeManager health", "NodeManager process", "TaskTracker process",
       "RegionServer process", "DataNode process", "DataNode space",
-      "ZooKeeper Server process", "Supervisors process"));
+      "ZooKeeper Server process", "Supervisors process")));
+  
+  private static List<String> IGNORABLE_FOR_SERVICES;
   
   private static final List<String> IGNORABLE_FOR_HOSTS = new ArrayList<String>(
     Collections.singletonList("percent"));
@@ -99,6 +101,7 @@ public class NagiosPropertyProvider extends BaseProvider implements PropertyProv
   static {
     NAGIOS_PROPERTY_IDS.add("alerts/summary");
     NAGIOS_PROPERTY_IDS.add("alerts/detail");
+    IGNORABLE_FOR_SERVICES = new ArrayList<String>(DEFAULT_IGNORABLE_FOR_SERVICES);
 
     scheduler = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
       @Override
@@ -121,6 +124,7 @@ public class NagiosPropertyProvider extends BaseProvider implements PropertyProv
     clusters = injector.getInstance(Clusters.class);
     Configuration config = injector.getInstance(Configuration.class);
     
+    IGNORABLE_FOR_SERVICES = new ArrayList<String>(DEFAULT_IGNORABLE_FOR_SERVICES);
     String ignores = config.getProperty(Configuration.NAGIOS_IGNORE_FOR_SERVICES_KEY);
     if (null != ignores) {
       Collections.addAll(IGNORABLE_FOR_SERVICES, COMMA_PATTERN.split(ignores));

http://git-wip-us.apache.org/repos/asf/ambari/blob/1c09523b/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java b/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java
index 0a0821a..4316dc9 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/controller/nagios/NagiosPropertyProviderTest.java
@@ -235,6 +235,7 @@ public class NagiosPropertyProviderTest {
   
   @Test
   public void testNagiosServiceAlerts() throws Exception {
+    module.properties.remove(Configuration.NAGIOS_IGNORE_FOR_SERVICES_KEY); // make sure NAGIOS_IGNORE_FOR_SERVICES_KEY is not set, which could be set by testNagiosServiceAlertsAddIgnore
 
     TestStreamProvider streamProvider = new TestStreamProvider("nagios_alerts.txt");
 
@@ -243,6 +244,7 @@ public class NagiosPropertyProviderTest {
         "ServiceInfo/cluster_name",
         "ServiceInfo/service_name");
     npp.forceReset();
+    NagiosPropertyProvider.init(injector);
     
     Resource resource = new ResourceImpl(Resource.Type.Service);
     resource.setProperty("ServiceInfo/cluster_name", "c1");