From b9f33d34a8628542049a21e53010cf249af074ad Mon Sep 17 00:00:00 2001 From: Sam Bashton Date: Tue, 7 May 2013 14:02:55 +0100 Subject: [PATCH] Add support for safe_mode --- lib/puppet/provider/sensu_client_config/json.rb | 10 ++++++++++ lib/puppet/type/sensu_client_config.rb | 4 ++++ manifests/client.pp | 2 ++ manifests/init.pp | 2 ++ 4 files changed, 18 insertions(+) diff --git a/lib/puppet/provider/sensu_client_config/json.rb b/lib/puppet/provider/sensu_client_config/json.rb index 178f4180d2..a64f60e7c6 100644 --- a/lib/puppet/provider/sensu_client_config/json.rb +++ b/lib/puppet/provider/sensu_client_config/json.rb @@ -25,6 +25,7 @@ def create self.client_name = resource[:client_name] self.address = resource[:address] self.subscriptions = resource[:subscriptions] + self.safe_mode = resource[:safe_mode] end def destroy @@ -58,4 +59,13 @@ def subscriptions def subscriptions=(value) @conf['client']['subscriptions'] = value end + + def safe_mode + @conf['client']['safe_mode'] + end + + def safe_mode=(value) + @conf['client']['safe_mode'] = value + end + end diff --git a/lib/puppet/type/sensu_client_config.rb b/lib/puppet/type/sensu_client_config.rb index 533dafae71..46c55de80b 100644 --- a/lib/puppet/type/sensu_client_config.rb +++ b/lib/puppet/type/sensu_client_config.rb @@ -37,6 +37,10 @@ def initialize(*args) desc "" end + newproperty(:safe_mode) do + desc "Require checks to be defined on server and client" + end + autorequire(:package) do ['sensu'] end diff --git a/manifests/client.pp b/manifests/client.pp index 38c9be8f69..0aa05089ed 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -10,6 +10,7 @@ $client_name = $::fqdn, $enabled = 'true', $purge_config = 'false', + $safe_mode = 'false', ) { $ensure = $enabled ? { @@ -27,6 +28,7 @@ client_name => $client_name, address => $address, subscriptions => $subscriptions, + safe_mode => $safe_mode, } } diff --git a/manifests/init.pp b/manifests/init.pp index 9511e05e24..f2a8e242f4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -33,6 +33,7 @@ $plugins = [], $purge_config = false, $use_embedded_ruby = false, + $safe_mode = false, ){ Class['sensu::package'] -> @@ -102,6 +103,7 @@ client_name => $client_name, enabled => $client, purge_config => $purge_config, + safe_mode => $safe_mode, } class { 'sensu::service::client': enabled => $client }