From 97159553619293c5c7f56fbd551f55a36a8d9dff Mon Sep 17 00:00:00 2001 From: Tim Sharpe Date: Sun, 29 Apr 2012 15:44:25 +1000 Subject: [PATCH] Have the various sensu_*_config classes autonotify their respective services --- lib/puppet/type/sensu_api_config.rb | 9 +++++++++ lib/puppet/type/sensu_check_config.rb | 9 +++++++++ lib/puppet/type/sensu_client_config.rb | 8 ++++++++ lib/puppet/type/sensu_dashboard_config.rb | 8 ++++++++ lib/puppet/type/sensu_handler_config.rb | 8 ++++++++ lib/puppet/type/sensu_rabbitmq_config.rb | 10 ++++++++++ lib/puppet/type/sensu_redis_config.rb | 9 +++++++++ 7 files changed, 61 insertions(+) diff --git a/lib/puppet/type/sensu_api_config.rb b/lib/puppet/type/sensu_api_config.rb index 18b2d9cc44..af1468299b 100644 --- a/lib/puppet/type/sensu_api_config.rb +++ b/lib/puppet/type/sensu_api_config.rb @@ -1,6 +1,15 @@ Puppet::Type.newtype(:sensu_api_config) do @doc = "" + def initialize(*args) + super + + self[:notify] = [ + "Service[sensu-api]", + "Service[sensu-dashboard]", + ].select { |ref| catalog.resource(ref) } + end + ensurable do newvalue(:present) do provider.create diff --git a/lib/puppet/type/sensu_check_config.rb b/lib/puppet/type/sensu_check_config.rb index 7aec48b1b0..566199f7e7 100644 --- a/lib/puppet/type/sensu_check_config.rb +++ b/lib/puppet/type/sensu_check_config.rb @@ -1,6 +1,15 @@ Puppet::Type.newtype(:sensu_check_config) do @doc = "" + def initialize(*args) + super + + self[:notify] = [ + "Service[sensu-client]", + "Service[sensu-server]", + ].select { |ref| catalog.resource(ref) } + end + ensurable do newvalue(:present) do provider.create diff --git a/lib/puppet/type/sensu_client_config.rb b/lib/puppet/type/sensu_client_config.rb index d91cf8fd72..91052d85c6 100644 --- a/lib/puppet/type/sensu_client_config.rb +++ b/lib/puppet/type/sensu_client_config.rb @@ -1,6 +1,14 @@ Puppet::Type.newtype(:sensu_client_config) do @doc = "" + def initialize(*args) + super + + self[:notify] = [ + "Service[sensu-client]", + ].select { |ref| catalog.resource(ref) } + end + ensurable do newvalue(:present) do provider.create diff --git a/lib/puppet/type/sensu_dashboard_config.rb b/lib/puppet/type/sensu_dashboard_config.rb index ca2d62418a..cda334313c 100644 --- a/lib/puppet/type/sensu_dashboard_config.rb +++ b/lib/puppet/type/sensu_dashboard_config.rb @@ -1,6 +1,14 @@ Puppet::Type.newtype(:sensu_dashboard_config) do @doc = "" + def initialize(*args) + super + + self[:notify] = [ + "Service[sensu-dashboard]", + ].select { |ref| catalog.resource(ref) } + end + ensurable do newvalue(:present) do provider.create diff --git a/lib/puppet/type/sensu_handler_config.rb b/lib/puppet/type/sensu_handler_config.rb index 4c5a4ccf28..166225ede4 100644 --- a/lib/puppet/type/sensu_handler_config.rb +++ b/lib/puppet/type/sensu_handler_config.rb @@ -1,6 +1,14 @@ Puppet::Type.newtype(:sensu_handler_config) do @doc = "" + def initialize(*args) + super + + self[:notify] = [ + "Service[sensu-server]", + ].select { |ref| catalog.resource(ref) } + end + ensurable do newvalue(:present) do provider.create diff --git a/lib/puppet/type/sensu_rabbitmq_config.rb b/lib/puppet/type/sensu_rabbitmq_config.rb index 58f6ec7d6c..3ca0c5d42c 100644 --- a/lib/puppet/type/sensu_rabbitmq_config.rb +++ b/lib/puppet/type/sensu_rabbitmq_config.rb @@ -1,6 +1,16 @@ Puppet::Type.newtype(:sensu_rabbitmq_config) do @doc = "" + def initialize(*args) + super + + self[:notify] = [ + "Service[sensu-server]", + "Service[sensu-client]", + "Service[sensu-api]", + ].select { |ref| catalog.resource(ref) } + end + ensurable do newvalue(:present) do provider.create diff --git a/lib/puppet/type/sensu_redis_config.rb b/lib/puppet/type/sensu_redis_config.rb index 733f549239..ee3b479d05 100644 --- a/lib/puppet/type/sensu_redis_config.rb +++ b/lib/puppet/type/sensu_redis_config.rb @@ -1,6 +1,15 @@ Puppet::Type.newtype(:sensu_redis_config) do @doc = "" + def initialize(*args) + super + + self[:notify] = [ + "Service[sensu-api]", + "Service[sensu-server]", + ].select { |ref| catalog.resource(ref) } + end + ensurable do newvalue(:present) do provider.create