From 52de3261253fab433c83df7930f3ce68393b95f1 Mon Sep 17 00:00:00 2001 From: Thom Duran Date: Thu, 5 Jun 2014 13:56:22 -0700 Subject: [PATCH] Add bind option for client --- lib/puppet/provider/sensu_client_config/json.rb | 11 ++++++++++- lib/puppet/type/sensu_client_config.rb | 5 +++++ manifests/client/config.pp | 1 + manifests/init.pp | 1 + 4 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/puppet/provider/sensu_client_config/json.rb b/lib/puppet/provider/sensu_client_config/json.rb index d070efba23..22cbe1f17a 100644 --- a/lib/puppet/provider/sensu_client_config/json.rb +++ b/lib/puppet/provider/sensu_client_config/json.rb @@ -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? @@ -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 @@ -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 diff --git a/lib/puppet/type/sensu_client_config.rb b/lib/puppet/type/sensu_client_config.rb index 25ec53c2f9..c6da17c313 100644 --- a/lib/puppet/type/sensu_client_config.rb +++ b/lib/puppet/type/sensu_client_config.rb @@ -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/' diff --git a/manifests/client/config.pp b/manifests/client/config.pp index a4df76c7c0..298a1556e8 100644 --- a/manifests/client/config.pp +++ b/manifests/client/config.pp @@ -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, diff --git a/manifests/init.pp b/manifests/init.pp index 8d53612239..26730dba2e 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -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 = {},