diff --git a/manifests/handler.pp b/manifests/handler.pp index 2a130c5cd2..9278dcaf64 100644 --- a/manifests/handler.pp +++ b/manifests/handler.pp @@ -80,6 +80,7 @@ validate_re($ensure, ['^present$', '^absent$'] ) validate_re($type, [ '^pipe$', '^tcp$', '^udp$', '^amqp$', '^set$', '^transport$' ] ) if $exchange { validate_hash($exchange) } + if $pipe { validate_hash($pipe) } if $socket { validate_hash($socket) } validate_array($severities) if $source { validate_re($source, ['^puppet://'] ) } @@ -95,7 +96,7 @@ fail('exchange must be set with type amqp') } - if $type == 'transport' and !pipe { + if $type == 'transport' and !$pipe { fail('pipe must be set with type transport') } diff --git a/spec/defines/sensu_handler_spec.rb b/spec/defines/sensu_handler_spec.rb index a19539dc9e..83ceb409ae 100644 --- a/spec/defines/sensu_handler_spec.rb +++ b/spec/defines/sensu_handler_spec.rb @@ -81,6 +81,30 @@ it { should contain_sensu_handler('myhandler').with_socket({'host' => '192.168.23.23', 'port' => '2003'}) } end + context 'transport' do + let(:params) { + { + :type => 'transport', + :pipe => { + 'type' => 'topic', + 'name' => 'events', + 'options' => { + 'passive' => 'true', + 'durable' => 'true' + } + } + } + } + it { should contain_sensu_handler('myhandler').with_pipe({ + 'type' => 'topic', + 'name' => 'events', + 'options' => { + 'passive' => 'true', + 'durable' => 'true' + } + }) } + end + context 'mutator' do let(:params) { { :mutator => 'only_check_output' } }