Skip to content

Commit

Permalink
Add api bind param
Browse files Browse the repository at this point in the history
  • Loading branch information
Thom Duran committed Jun 3, 2014
1 parent 3b86e55 commit 073edff
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
19 changes: 18 additions & 1 deletion lib/puppet/provider/sensu_api_config/json.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def flush
# Returns nothing.
def create
conf['api'] = {}
self.bind = resource[:bind]
self.port = resource[:port]
self.host = resource[:host]
self.user = resource[:user] unless resource[:user].nil?
Expand All @@ -50,14 +51,30 @@ def exists?
conf.has_key? 'api'
end


# Public: Retrieve the bind IP that the API is bound on the server
#
# Returns the String bind IP

def bind
conf['api']['bind']
end

# Public: Set the IP that bind will use.
#
# Returns nothing.

def bind=(value)
conf['api']['bind'] = value
end

# Public: Retrieve the port number that the API is configured to listen on.
#
# Returns the String port number.
def port
conf['api']['port'].to_s
end


def config_file
"#{resource[:base_path]}/api.json"
end
Expand Down
6 changes: 6 additions & 0 deletions lib/puppet/type/sensu_api_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ def initialize(*args)
defaultto 'localhost'
end

newproperty(:bind) do
desc "The bind IP that sensu will bind to"

defaultto '0.0.0.0'
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/api/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

sensu_api_config { $::fqdn:
ensure => $ensure,
bind => $sensu::api_bind,
host => $sensu::api_host,
port => $sensu::api_port,
user => $sensu::api_user,
Expand Down
4 changes: 4 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@
# Integer. Redis port to be used by sensu
# Default: 6379
#
# [*api_bind*]
# String. IP to bind api service
# Default: 0.0.0.0
# [*api_host*]
# String. Hostname of the sensu api service
# Default: localhost
Expand Down Expand Up @@ -187,6 +190,7 @@
$rabbitmq_ssl_cert_chain = undef,
$redis_host = 'localhost',
$redis_port = 6379,
$api_bind = '0.0.0.0',
$api_host = 'localhost',
$api_port = 4567,
$api_user = undef,
Expand Down

0 comments on commit 073edff

Please sign in to comment.