Skip to content

Commit

Permalink
Add bind option for client
Browse files Browse the repository at this point in the history
  • Loading branch information
Thom Duran committed Jun 5, 2014
1 parent 073edff commit 52de326
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/puppet/provider/sensu_client_config/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def create
@conf['client'] = {}
self.client_name = resource[:client_name]
self.address = resource[:address]
self.bind = resource[:bind]
self.subscriptions = resource[:subscriptions]
self.safe_mode = resource[:safe_mode]
self.custom = resource[:custom] unless resource[:custom].nil?
Expand All @@ -50,7 +51,7 @@ def exists?
end

def check_args
['name', 'address', 'subscriptions', 'safe_mode']
['name', 'address', 'subscriptions', 'safe_mode', 'bind']
end

def client_name
Expand All @@ -69,6 +70,14 @@ def address=(value)
@conf['client']['address'] = value
end

def bind
@conf['client']['bind']
end

def bind=(value)
@conf['client']['bind'] = value
end

def subscriptions
@conf['client']['subscriptions'] || []
end
Expand Down
5 changes: 5 additions & 0 deletions lib/puppet/type/sensu_client_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ def initialize(*args)
desc ""
end

newproperty(:bind) do
desc "The IP that client will bind to"
defaultto '127.0.0.1'
end

newparam(:base_path) do
desc "The base path to the client config file"
defaultto '/etc/sensu/conf.d/'
Expand Down
1 change: 1 addition & 0 deletions manifests/client/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
ensure => $ensure,
client_name => $sensu::client_name,
address => $sensu::client_address,
bind => $sensu::client_bind,
subscriptions => $sensu::subscriptions,
safe_mode => $sensu::safe_mode,
custom => $sensu::client_custom,
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
$dashboard_user = 'admin',
$dashboard_password = 'secret',
$subscriptions = [],
$client_bind = '127.0.0.1',
$client_address = $::ipaddress,
$client_name = $::fqdn,
$client_custom = {},
Expand Down

0 comments on commit 52de326

Please sign in to comment.