Skip to content

Commit

Permalink
Exclude brackets from the name as this makes sensu barf
Browse files Browse the repository at this point in the history
  • Loading branch information
bobtfish committed Dec 30, 2013
1 parent 3cf0363 commit d85c270
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion manifests/check.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
$custom = undef,
) {

$check_name = regsubst($name, ' ', '_', 'G')
$check_name = regsubst(regsubst($name, ' ', '_', 'G'), '[\(\)]', '', 'G')

file { "/etc/sensu/conf.d/checks/${check_name}.json":
ensure => $ensure,
Expand Down
16 changes: 16 additions & 0 deletions spec/defines/sensu_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,23 @@
it { should contain_file('/etc/sensu/conf.d/checks/mycheck_foobar.json') }

end
end

context 'with brackets in name' do
let(:title) { 'mycheck (foo) bar' }
context 'defaults' do
let(:params) { { :command => '/etc/sensu/somecommand.rb' } }

it { should contain_sensu_check('mycheck_foo_bar').with(
'command' => '/etc/sensu/somecommand.rb',
'handlers' => '',
'interval' => '60',
'subscribers' => ''
) }

it { should contain_file('/etc/sensu/conf.d/checks/mycheck_foo_bar.json') }
end
end

end

0 comments on commit d85c270

Please sign in to comment.