Skip to content

Commit

Permalink
Add support for safe_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Bashton committed May 7, 2013
1 parent 60096a8 commit b9f33d3
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/puppet/provider/sensu_client_config/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions lib/puppet/type/sensu_client_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions manifests/client.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$client_name = $::fqdn,
$enabled = 'true',
$purge_config = 'false',
$safe_mode = 'false',
) {

$ensure = $enabled ? {
Expand All @@ -27,6 +28,7 @@
client_name => $client_name,
address => $address,
subscriptions => $subscriptions,
safe_mode => $safe_mode,
}

}
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
$plugins = [],
$purge_config = false,
$use_embedded_ruby = false,
$safe_mode = false,
){

Class['sensu::package'] ->
Expand Down Expand Up @@ -102,6 +103,7 @@
client_name => $client_name,
enabled => $client,
purge_config => $purge_config,
safe_mode => $safe_mode,
}

class { 'sensu::service::client': enabled => $client }
Expand Down

0 comments on commit b9f33d3

Please sign in to comment.