From 381e45a7cc1f28ce177a248cdbf0e7b298ac6e4f Mon Sep 17 00:00:00 2001 From: Sam Bashton Date: Tue, 7 May 2013 14:39:20 +0100 Subject: [PATCH] Enforce safe_mode value as boolean --- lib/puppet/type/sensu_client_config.rb | 3 ++- manifests/client.pp | 2 +- spec/classes/sensu_client_spec.rb | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/puppet/type/sensu_client_config.rb b/lib/puppet/type/sensu_client_config.rb index 46c55de80b..06a20f97d4 100644 --- a/lib/puppet/type/sensu_client_config.rb +++ b/lib/puppet/type/sensu_client_config.rb @@ -37,8 +37,9 @@ def initialize(*args) desc "" end - newproperty(:safe_mode) do + newproperty(:safe_mode, :boolean => true) do desc "Require checks to be defined on server and client" + newvalues(:true, :false) end autorequire(:package) do diff --git a/manifests/client.pp b/manifests/client.pp index 0aa05089ed..18c752d539 100644 --- a/manifests/client.pp +++ b/manifests/client.pp @@ -10,7 +10,7 @@ $client_name = $::fqdn, $enabled = 'true', $purge_config = 'false', - $safe_mode = 'false', + $safe_mode = false, ) { $ensure = $enabled ? { diff --git a/spec/classes/sensu_client_spec.rb b/spec/classes/sensu_client_spec.rb index 4c6abfde0a..a7dcba62ae 100644 --- a/spec/classes/sensu_client_spec.rb +++ b/spec/classes/sensu_client_spec.rb @@ -21,7 +21,7 @@ :address => '1.2.3.4', :subscriptions => ['all'], :client_name => 'myclient', - :safe_mode => 'true' + :safe_mode => true } } it { should contain_sensu_client_config('host.domain.com').with( @@ -29,7 +29,7 @@ 'address' => '1.2.3.4', 'subscriptions' => ['all'], 'ensure' => 'present', - 'safe_mode' => 'true' + 'safe_mode' => true ) } end