Merge pull request #45 from SwannCroiset/alerting-property

Redefine alerting property
diff --git a/_modules/heka_alarming.py b/_modules/heka_alarming.py
index d87ed73..b12fa23 100644
--- a/_modules/heka_alarming.py
+++ b/_modules/heka_alarming.py
@@ -26,6 +26,14 @@
     return ' || '.join(matchers)
 
 
+def alarm_activate_alerting(alerting):
+    return 'true' if alerting in ['enabled', 'enabled_with_notification'] else 'false'
+
+
+def alarm_enable_notification(alerting):
+    return 'true' if alerting == 'enabled_with_notification' else 'false'
+
+
 def alarm_cluster_message_matcher(alarm_cluster):
     """
     Return an Heka message matcher expression for a given alarm cluster.
diff --git a/heka/files/toml/filter/afd_alarm.toml b/heka/files/toml/filter/afd_alarm.toml
index c1168df..5fefb2d 100644
--- a/heka/files/toml/filter/afd_alarm.toml
+++ b/heka/files/toml/filter/afd_alarm.toml
@@ -11,4 +11,6 @@
 afd_name = "{{ alarm_name }}"
 hostname = "{{ grains.host }}"
 dimensions = '{{ salt['heka_alarming.dimensions'](alarm)|json }}'
-activate_alerting = {{ alarm.alerting|default(True)|lower }}
+{%- set alerting = alarm.get('alerting', 'enabled') %}
+activate_alerting = {{ salt['heka_alarming.alarm_activate_alerting'](alerting) }}
+enable_notification = {{ salt['heka_alarming.alarm_enable_notification'](alerting) }}
diff --git a/heka/files/toml/filter/gse_alarm_cluster.toml b/heka/files/toml/filter/gse_alarm_cluster.toml
index 72b1923..1c9fe77 100644
--- a/heka/files/toml/filter/gse_alarm_cluster.toml
+++ b/heka/files/toml/filter/gse_alarm_cluster.toml
@@ -9,7 +9,6 @@
 [gse_{{ alarm_cluster_name }}_filter.config]
 topology_file = "gse_{{ alarm_cluster_name|replace('-', '_') }}_topology"
 dimensions = '{{ salt['heka_alarming.dimensions'](alarm_cluster)|json }}'
-activate_alerting = {{ alarm_cluster.alerting|default(True)|lower }}
 {%- if alarm_cluster.interval is defined %}
 interval = {{ alarm_cluster.interval }}
 {%- endif %}
@@ -19,3 +18,6 @@
 {%- if alarm_cluster.warm_up_period is defined %}
 warm_up_period = {{ alarm_cluster.warm_up_period }}
 {%- endif %}
+{%- set alerting = alarm_cluster.get('alerting', 'enabled_with_notification') %}
+activate_alerting = {{ salt['heka_alarming.alarm_activate_alerting'](alerting) }}
+enable_notification = {{ salt['heka_alarming.alarm_enable_notification'](alerting) }}