Fix deleting portions of config when cleaning and cleaned idempotency
diff --git a/sensu/server.sls b/sensu/server.sls
index a522027..ec7c9f5 100644
--- a/sensu/server.sls
+++ b/sensu/server.sls
@@ -3,6 +3,7 @@
include:
- sensu._common
+- sensu.client
sensu_server_packages:
pkg.installed:
@@ -16,11 +17,6 @@
- require:
- pkg: sensu_server_packages
-purge_sensu_conf_dir:
- file.directory:
- - name: /etc/sensu/conf.d/
- - clean: True
-
{%- if server.mine_checks %}
{%- for node_name, node_grains in salt['mine.get']('*', 'grains.items').iteritems() %}
@@ -39,6 +35,8 @@
check: {{ check|yaml }}
- require:
- pkg: sensu_server_packages
+ - require_in:
+ - file: purge_sensu_conf_dir
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
@@ -59,6 +57,8 @@
check_name: "{{ check.name }}"
- require:
- pkg: sensu_server_packages
+ - require_in:
+ - file: purge_sensu_conf_dir
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
@@ -76,6 +76,8 @@
- require:
- file: /etc/sensu/config.json
- pkg: sensu_packages
+ - require_in:
+ - file: purge_sensu_conf_dir
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
@@ -99,6 +101,8 @@
- mode: 644
- require:
- file: /etc/sensu
+ - require_in:
+ - file: purge_sensu_conf_dir
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
@@ -110,10 +114,20 @@
- mode: 644
- require:
- file: /etc/sensu
+ - require_in:
+ - file: purge_sensu_conf_dir
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+purge_sensu_conf_dir:
+ file.directory:
+ - name: /etc/sensu/conf.d/
+ - clean: True
+ - require:
+ - file: /etc/sensu/conf.d/client.json
+ - file: /etc/sensu/conf.d/rabbitmq.json
+
service_sensu_server:
service.running:
- name: sensu-server
diff --git a/sensu/server/_handler_default.sls b/sensu/server/_handler_default.sls
index b298507..6beee37 100644
--- a/sensu/server/_handler_default.sls
+++ b/sensu/server/_handler_default.sls
@@ -8,3 +8,5 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir
diff --git a/sensu/server/_handler_flapjack.sls b/sensu/server/_handler_flapjack.sls
index 42c6288..cc4aef1 100644
--- a/sensu/server/_handler_flapjack.sls
+++ b/sensu/server/_handler_flapjack.sls
@@ -8,6 +8,8 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir
/etc/sensu/extensions/handlers/flapjack.rb:
file.managed:
diff --git a/sensu/server/_handler_mail.sls b/sensu/server/_handler_mail.sls
index cbe98f8..deb7603 100644
--- a/sensu/server/_handler_mail.sls
+++ b/sensu/server/_handler_mail.sls
@@ -9,6 +9,8 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir
/etc/sensu/conf.d/handler_mail.json:
file.managed:
@@ -20,6 +22,8 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir
/etc/sensu/handlers/mail.py:
file.managed:
diff --git a/sensu/server/_handler_pipe.sls b/sensu/server/_handler_pipe.sls
index 4c59818..604e615 100644
--- a/sensu/server/_handler_pipe.sls
+++ b/sensu/server/_handler_pipe.sls
@@ -9,3 +9,5 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir
diff --git a/sensu/server/_handler_sccd.sls b/sensu/server/_handler_sccd.sls
index 7a6441c..64e5e6c 100644
--- a/sensu/server/_handler_sccd.sls
+++ b/sensu/server/_handler_sccd.sls
@@ -9,6 +9,8 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir
/etc/sensu/conf.d/handler_sccd.json:
file.managed:
@@ -20,6 +22,8 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir
/etc/sensu/handlers/sccd.py:
file.managed:
diff --git a/sensu/server/_handler_slack.sls b/sensu/server/_handler_slack.sls
index 994e2d6..f795a13 100644
--- a/sensu/server/_handler_slack.sls
+++ b/sensu/server/_handler_slack.sls
@@ -9,6 +9,8 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir
/etc/sensu/conf.d/handler_slack.json:
file.managed:
@@ -20,6 +22,8 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir
/etc/sensu/handlers/slack.rb:
file.managed:
diff --git a/sensu/server/_handler_statsd.sls b/sensu/server/_handler_statsd.sls
index 8412d5a..63e48d7 100644
--- a/sensu/server/_handler_statsd.sls
+++ b/sensu/server/_handler_statsd.sls
@@ -15,6 +15,8 @@
- service: service_sensu_api
- require:
- pip: python-statsd
+ - require_in:
+ - file: purge_sensu_conf_dir
/etc/sensu/conf.d/handler_statsd.json:
file.managed:
@@ -26,6 +28,8 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir
/etc/sensu/handlers/statsd_handler.py:
file.managed:
diff --git a/sensu/server/_handler_stdout.sls b/sensu/server/_handler_stdout.sls
index 1371cb3..fd60d1a 100644
--- a/sensu/server/_handler_stdout.sls
+++ b/sensu/server/_handler_stdout.sls
@@ -9,3 +9,5 @@
- watch_in:
- service: service_sensu_server
- service: service_sensu_api
+ - require_in:
+ - file: purge_sensu_conf_dir