Skip to content

Commit 402c846

Browse files
committed
merged quoted booleans
2 parents 2ecb67f + ed817c0 commit 402c846

9 files changed

+36
-34
lines changed

manifests/client.pp

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
$address = $::ipaddress,
1010
$subscriptions = [],
1111
$client_name = $::fqdn,
12-
$enabled = true
12+
$enabled = 'true'
1313
) {
1414

1515
$ensure = $enabled ? {
16+
'true' => 'present',
1617
true => 'present',
1718
default => 'absent'
1819
}

manifests/init.pp

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
class sensu (
1111
$rabbitmq_password,
12-
$server = false,
13-
$client = true,
12+
$server = 'false',
13+
$client = 'true',
1414
$version = 'latest',
1515
$install_repo = 'true',
1616
$rabbitmq_port = '5671',
@@ -45,13 +45,13 @@
4545
Class['sensu::service::client'] ->
4646
Class['sensu']
4747

48-
if $server == true {
49-
if $client == true {
48+
if $server == 'true' or $server == true {
49+
if $client == 'true' or $client == true {
5050
$notify_services = [ Class['sensu::service::client'], Class['sensu::service::server'] ]
5151
} else {
5252
$notify_services = Class['sensu::service::server']
5353
}
54-
} elsif $client == true {
54+
} elsif $client == 'true' or $client == true {
5555
$notify_services = Class['sensu::service::client']
5656
} else {
5757
$notify_services = []

manifests/server.pp

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
$dashboard_port = '8080',
1515
$dashboard_user = 'admin',
1616
$dashboard_password = 'secret',
17-
$enabled = false
17+
$enabled = 'false'
1818
) {
1919

2020
$ensure = $enabled ? {
21+
'true' => 'present',
2122
true => 'present',
22-
false => 'absent'
23+
default => 'absent'
2324
}
2425

2526
sensu_redis_config { $::fqdn:

manifests/service/client.pp

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
) {
44

55
$real_ensure = $enabled ? {
6-
true => 'running',
7-
false => 'stopped',
6+
'true' => 'running',
7+
true => 'running',
8+
default => 'stopped',
89
}
910

1011
service { 'sensu-client':

manifests/service/server.pp

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
) {
44

55
$real_ensure = $enabled ? {
6-
true => 'running',
7-
false => 'stopped',
6+
'true' => 'running',
7+
true => 'running',
8+
default => 'stopped',
89
}
910

1011
Service {

spec/classes/sensu_init_spec.rb

+10-12
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,24 @@
3232
'dashboard_port' => '8080',
3333
'dashboard_user' => 'admin',
3434
'dashboard_password' => 'secret',
35-
'enabled' => false
35+
'enabled' => 'false'
3636
)}
3737

3838
it { should contain_class('sensu::client').with(
3939
'address' => '1.2.3.4',
4040
'subscriptions' => [],
4141
'client_name' => 'myhost.domain.com',
42-
'enabled' => true
42+
'enabled' => 'true'
4343
)}
4444

45-
it { should contain_class('sensu::service::server').with_enabled(false) }
46-
it { should contain_class('sensu::service::client').with_enabled(true) }
45+
it { should contain_class('sensu::service::server').with_enabled('false') }
46+
it { should contain_class('sensu::service::client').with_enabled('true') }
4747
end
4848

4949

5050
context 'setting all params' do
5151
let(:params) { {
5252
:rabbitmq_password => 'asdfjkl',
53-
:server => true,
54-
:client => false,
5553
:version => '0.9.10',
5654
:install_repo => false,
5755
:rabbitmq_port => '1234',
@@ -99,22 +97,22 @@
9997
'dashboard_port' => '5678',
10098
'dashboard_user' => 'dashuser',
10199
'dashboard_password' => 'dashpass',
102-
'enabled' => true
100+
'enabled' => 'true'
103101
)}
104102

105103
it { should contain_class('sensu::client').with(
106104
'address' => '127.0.0.1',
107105
'subscriptions' => ['all'],
108106
'client_name' => 'myhost',
109-
'enabled' => false
107+
'enabled' => 'false'
110108
)}
111109

112-
it { should contain_class('sensu::service::server').with_enabled(true) }
113-
it { should contain_class('sensu::service::client').with_enabled(false) }
110+
it { should contain_class('sensu::service::server').with_enabled('true') }
111+
it { should contain_class('sensu::service::client').with_enabled('false') }
114112
end
115113

116114
context 'server and client' do
117-
let(:params) { { :rabbitmq_password => 'asdfjkl', :server => true, :client => true } }
115+
let(:params) { { :rabbitmq_password => 'asdfjkl', :server => 'true', :client => 'true' } }
118116
let(:facts) { { :fqdn => 'myhost.domain.com', :ipaddress => '1.2.3.4' } }
119117

120118
it { should contain_class('sensu::rabbitmq').with(
@@ -123,7 +121,7 @@
123121
end
124122

125123
context 'neither server nor client' do
126-
let(:params) { { :rabbitmq_password => 'asdfjkl', :server => false, :client => false } }
124+
let(:params) { { :rabbitmq_password => 'asdfjkl', :server => 'false', :client => 'false' } }
127125
let(:facts) { { :fqdn => 'myhost.domain.com', :ipaddress => '1.2.3.4' } }
128126

129127
it { should contain_class('sensu::rabbitmq').with(

spec/classes/sensu_server_spec.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
context 'defaults (enabled)' do
1515
let(:facts) { { :fqdn => 'testhost.domain.com', :ipaddress => '1.2.3.4' } }
16-
let(:params) { { :enabled => true } }
16+
let(:params) { { :enabled => 'true' } }
1717

1818
it { should contain_sensu_redis_config('testhost.domain.com').with(
1919
'host' => 'localhost',
@@ -54,7 +54,7 @@
5454
:dashboard_port => '5678',
5555
:dashboard_user => 'user',
5656
:dashboard_password => 'mypass',
57-
:enabled => true
57+
:enabled => 'true'
5858
} }
5959

6060
it { should contain_sensu_redis_config('testhost.domain.com').with(
File renamed without changes.

spec/classes/sensu_service_server.pp spec/classes/sensu_service_server.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,45 @@
33
describe 'sensu::service::server', :type => :class do
44

55
context 'enabled' do
6-
let(:params) { { :enabled => true } }
6+
let(:params) { { :enabled => 'true' } }
77

88
it { should contain_service('sensu-server').with(
99
'ensure' => 'running',
10-
'enable' => true,
10+
'enable' => 'true',
1111
'hasrestart' => true
1212
) }
1313

1414
it { should contain_service('sensu-api').with(
1515
'ensure' => 'running',
16-
'enable' => true,
16+
'enable' => 'true',
1717
'hasrestart' => true
1818
) }
1919

2020
it { should contain_service('sensu-dashboard').with(
2121
'ensure' => 'running',
22-
'enable' => true,
22+
'enable' => 'true',
2323
'hasrestart' => true
2424
) }
2525
end
2626

2727
context 'disabled' do
28-
let(:params) { { :enabled => false } }
28+
let(:params) { { :enabled => 'false' } }
2929

3030
it { should contain_service('sensu-server').with(
3131
'ensure' => 'stopped',
32-
'enable' => false,
32+
'enable' => 'false',
3333
'hasrestart' => true
3434
) }
3535

3636
it { should contain_service('sensu-api').with(
3737
'ensure' => 'stopped',
38-
'enable' => false,
38+
'enable' => 'false',
3939
'hasrestart' => true
4040
) }
4141

4242
it { should contain_service('sensu-dashboard').with(
4343
'ensure' => 'stopped',
44-
'enable' => false,
44+
'enable' => 'false',
4545
'hasrestart' => true
4646
) }
4747

0 commit comments

Comments
 (0)