Skip to content

Commit 79847c3

Browse files
committed
Exclude brackets from the name as this makes sensu barf
Re-apply commit which was originally d85c270 as this was accidentally removed in commit 95ef05e
1 parent 7fecb8c commit 79847c3

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

manifests/check.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
fail("sensu::check{${name}}: high_flap_threshold must be an integer (got: ${high_flap_threshold})")
6666
}
6767

68-
$check_name = regsubst($name, ' ', '_', 'G')
68+
$check_name = regsubst(regsubst($name, ' ', '_', 'G'), '[\(\)]', '', 'G')
6969

7070
file { "/etc/sensu/conf.d/checks/${check_name}.json":
7171
ensure => $ensure,

spec/defines/sensu_check_spec.rb

+16
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,23 @@
6464
it { should contain_file('/etc/sensu/conf.d/checks/mycheck_foobar.json') }
6565

6666
end
67+
end
68+
69+
context 'with brackets in name' do
70+
let(:title) { 'mycheck (foo) bar' }
71+
context 'defaults' do
72+
let(:params) { { :command => '/etc/sensu/somecommand.rb' } }
6773

74+
it { should contain_sensu_check('mycheck_foo_bar').with(
75+
'command' => '/etc/sensu/somecommand.rb',
76+
'handlers' => '',
77+
'interval' => '60',
78+
'subscribers' => ''
79+
) }
80+
81+
it { should contain_file('/etc/sensu/conf.d/checks/mycheck_foo_bar.json') }
82+
end
6883
end
6984

7085
end
86+

0 commit comments

Comments
 (0)