diff --git a/lib/puppet/provider/sensu_handler/json.rb b/lib/puppet/provider/sensu_handler/json.rb index e6db9e0691..7d0288e864 100644 --- a/lib/puppet/provider/sensu_handler/json.rb +++ b/lib/puppet/provider/sensu_handler/json.rb @@ -26,6 +26,7 @@ def create # Optional arguments self.config = resource[:config] unless resource[:config].nil? self.exchange = resource[:exchange] unless resource[:exchange].nil? + self.pipe = resource[:pipe] unless resource[:pipe].nil? self.socket = resource[:socket] unless resource[:socket].nil? self.handlers = resource[:handlers] unless resource[:handlers].nil? self.mutator = resource[:mutator] unless resource[:mutator].nil? @@ -69,6 +70,14 @@ def exchange=(value) conf['handlers'][resource[:name]]['exchange'] = value end + def pipe + conf['handlers'][resource[:name]]['pipe'] + end + + def pipe=(value) + conf['handlers'][resource[:name]]['pipe'] = value + end + def socket conf['handlers'][resource[:name]]['socket'] end diff --git a/lib/puppet/type/sensu_handler.rb b/lib/puppet/type/sensu_handler.rb index b7703c7387..06e76cee67 100644 --- a/lib/puppet/type/sensu_handler.rb +++ b/lib/puppet/type/sensu_handler.rb @@ -37,6 +37,10 @@ def initialize(*args) desc "Exchange information used by the amqp type" end + newproperty(:pipe) do + desc "Pipe information used by the transport type" + end + newproperty(:socket) do desc "Socket information used by the udp type" diff --git a/manifests/handler.pp b/manifests/handler.pp index b8e2fd9f30..2a130c5cd2 100644 --- a/manifests/handler.pp +++ b/manifests/handler.pp @@ -32,6 +32,11 @@ # Keys: host, port # Default: undef # +# [*pipe*] +# Hash. Pipe information used when type=transport +# Keys: name, type, options +# Default: undef +# # [*socket*] # Hash. Socket information when type=tcp or type=udp # Keys: host, port @@ -61,6 +66,7 @@ $handlers = undef, $severities = ['ok', 'warning', 'critical', 'unknown'], $exchange = undef, + $pipe = undef, $mutator = undef, $socket = undef, $filters = undef, @@ -89,6 +95,10 @@ fail('exchange must be set with type amqp') } + if $type == 'transport' and !pipe { + fail('pipe must be set with type transport') + } + if $type == 'set' and !$handlers { fail('handlers must be set with type set') } @@ -129,18 +139,19 @@ } sensu_handler { $name: - ensure => $ensure, - type => $type, - command => $command_real, - handlers => $handlers, - severities => $severities, - exchange => $exchange, - socket => $socket, - mutator => $mutator, - filters => $filters, - config => $config, - notify => $notify_services, - require => File['/etc/sensu/conf.d/handlers'], + ensure => $ensure, + type => $type, + command => $command_real, + handlers => $handlers, + severities => $severities, + exchange => $exchange, + pipe => $pipe, + socket => $socket, + mutator => $mutator, + filters => $filters, + config => $config, + notify => $notify_services, + require => File['/etc/sensu/conf.d/handlers'], } }