From f2b6ffe6c20adf37e96818ffa62b4a1627daf84d Mon Sep 17 00:00:00 2001 From: Paul O'Connor Date: Mon, 1 Feb 2016 16:15:41 +0000 Subject: [PATCH 1/3] Add loglevel introduced in 0.14.1 --- manifests/init.pp | 2 ++ manifests/params.pp | 1 + spec/classes/uchiwa_spec.rb | 8 ++++++++ templates/etc/sensu/uchiwa.json.erb | 1 + 4 files changed, 12 insertions(+) diff --git a/manifests/init.pp b/manifests/init.pp index 56f1405..4f03079 100755 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -156,6 +156,7 @@ $auth = $uchiwa::params::auth, $ssl = $uchiwa::params::ssl, $usersoptions = $uchiwa::params::usersoptions, + $loglevel = $uchiwa::params::loglevel ) inherits uchiwa::params { # validate parameters here @@ -180,6 +181,7 @@ validate_hash($auth) validate_hash($ssl) validate_hash($usersoptions) + validate_re($loglevel, 'trace|debug|info|warn|fatal') anchor { 'uchiwa::begin': } -> class { 'uchiwa::install': } diff --git a/manifests/params.pp b/manifests/params.pp index 119bf38..e139472 100755 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -28,6 +28,7 @@ $manage_services = true $manage_package = true $manage_user = true + $loglevel = 'info' $sensu_api_endpoints = [ { diff --git a/spec/classes/uchiwa_spec.rb b/spec/classes/uchiwa_spec.rb index cea89e0..620fe38 100644 --- a/spec/classes/uchiwa_spec.rb +++ b/spec/classes/uchiwa_spec.rb @@ -196,4 +196,12 @@ } end + context 'with debug log level' do + let(:params) {{ :loglevel => 'debug' }} + it { + should contain_file('/etc/sensu/uchiwa.json') \ + .with_content(/"loglevel": "debug"/) + } + end + end diff --git a/templates/etc/sensu/uchiwa.json.erb b/templates/etc/sensu/uchiwa.json.erb index f09d79b..d43e578 100644 --- a/templates/etc/sensu/uchiwa.json.erb +++ b/templates/etc/sensu/uchiwa.json.erb @@ -27,6 +27,7 @@ "uchiwa": { "host": "<%= @host %>", "port": <%= @port %>, + "loglevel": "<%= @loglevel %>", "user": "<%= @user %>", "pass": "<%= @pass %>", "refresh": <%= @refresh %><%= ',' if @users.size > 0 or @auth.size == 2 or @ssl.size == 2 or @usersoptions.size > 0 %> From 817d6eb9c04a687711ce4426ee3ce7dff874f3d9 Mon Sep 17 00:00:00 2001 From: Paul O'Connor Date: Mon, 1 Feb 2016 17:31:22 +0000 Subject: [PATCH 2/3] loglevel is a protected parameter --- manifests/init.pp | 2 +- manifests/params.pp | 2 +- spec/classes/uchiwa_spec.rb | 2 +- templates/etc/sensu/uchiwa.json.erb | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 4f03079..46c87f8 100755 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -156,7 +156,7 @@ $auth = $uchiwa::params::auth, $ssl = $uchiwa::params::ssl, $usersoptions = $uchiwa::params::usersoptions, - $loglevel = $uchiwa::params::loglevel + $log_level = $uchiwa::params::log_level ) inherits uchiwa::params { # validate parameters here diff --git a/manifests/params.pp b/manifests/params.pp index e139472..e116b5e 100755 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -28,7 +28,7 @@ $manage_services = true $manage_package = true $manage_user = true - $loglevel = 'info' + $log_level = 'info' $sensu_api_endpoints = [ { diff --git a/spec/classes/uchiwa_spec.rb b/spec/classes/uchiwa_spec.rb index 620fe38..41887d0 100644 --- a/spec/classes/uchiwa_spec.rb +++ b/spec/classes/uchiwa_spec.rb @@ -197,7 +197,7 @@ end context 'with debug log level' do - let(:params) {{ :loglevel => 'debug' }} + let(:params) {{ :log_level => 'debug' }} it { should contain_file('/etc/sensu/uchiwa.json') \ .with_content(/"loglevel": "debug"/) diff --git a/templates/etc/sensu/uchiwa.json.erb b/templates/etc/sensu/uchiwa.json.erb index d43e578..929e1f9 100644 --- a/templates/etc/sensu/uchiwa.json.erb +++ b/templates/etc/sensu/uchiwa.json.erb @@ -27,7 +27,7 @@ "uchiwa": { "host": "<%= @host %>", "port": <%= @port %>, - "loglevel": "<%= @loglevel %>", + "loglevel": "<%= @log_level %>", "user": "<%= @user %>", "pass": "<%= @pass %>", "refresh": <%= @refresh %><%= ',' if @users.size > 0 or @auth.size == 2 or @ssl.size == 2 or @usersoptions.size > 0 %> From b77d1f6c3d7a6713cdfbe7e4fb466c17f52e3f76 Mon Sep 17 00:00:00 2001 From: Paul O'Connor Date: Mon, 1 Feb 2016 18:31:45 +0000 Subject: [PATCH 3/3] Missed one variable rename --- manifests/init.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index 46c87f8..460cad1 100755 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -181,7 +181,7 @@ validate_hash($auth) validate_hash($ssl) validate_hash($usersoptions) - validate_re($loglevel, 'trace|debug|info|warn|fatal') + validate_re($log_level, 'trace|debug|info|warn|fatal') anchor { 'uchiwa::begin': } -> class { 'uchiwa::install': }