Skip to content

Commit

Permalink
Merge pull request #278 from tdevelioglu/polish
Browse files Browse the repository at this point in the history
Polish
  • Loading branch information
solarkennedy authored Sep 17, 2016
2 parents 85348aa + e603a66 commit 1ba4616
Show file tree
Hide file tree
Showing 9 changed files with 321 additions and 213 deletions.
56 changes: 28 additions & 28 deletions manifests/check.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,56 @@
# Define availability of check. Use 'absent' to remove existing checks.
# Defaults to 'present'
#
# [*http*]
# HTTP endpoint for the service healthcheck
#
# [*id*]
# The id for the check (defaults to $title)
#
# [*ttl*]
# Value in seconds before the http endpoint considers a failing healthcheck
# to be "HARD" down.
# [*interval*]
# Value in seconds for the interval between runs of the check
#
# [*http*]
# HTTP endpoint for the service healthcheck
# [*notes*]
# Human readable description of the check
#
# [*script*]
# Full path to the location of the healthcheck script. Must be nagios
# compliant with regards to the return codes.
#
# [*service_id*]
# An optional service_id to match this check against
#
# [*status*]
# The default state of the check when it is registered against a consul
# agent. Should be either "critical" or "passing"
#
# [*tcp*]
# The IP/hostname and port for the service healthcheck. Should be in
# 'hostname:port' format.
#
# [*interval*]
# Value in seconds for the interval between runs of the check
#
# [*service_id*]
# An optional service_id to match this check against
#
# [*timeout*]
# A timeout value for HTTP request only
#
# [*notes*]
# Human readable description of the check
#
# [*token*]
# ACL token for interacting with the catalog (must be 'management' type)
#
# [*status*]
# The default state of the check when it is registered against a consul
# agent. Should be either "critical" or "passing"
# [*ttl*]
# Value in seconds before the http endpoint considers a failing healthcheck
# to be "HARD" down.
#
define consul::check(
$ensure = present,
$id = $title,
$ttl = undef,
$http = undef,
$script = undef,
$tcp = undef,
$id = $title,
$interval = undef,
$notes = undef,
$script = undef,
$service_id = undef,
$status = undef,
$tcp = undef,
$timeout = undef,
$notes = undef,
$token = undef,
$status = undef,
$ttl = undef,
) {
include consul

Expand All @@ -84,12 +84,12 @@
consul_validate_checks($check_hash[check])

$escaped_id = regsubst($id,'\/','_','G')
File[$consul::config_dir] ->
File[$::consul::config_dir] ->
file { "${consul::config_dir}/check_${escaped_id}.json":
ensure => $ensure,
owner => $consul::user,
group => $consul::group,
mode => $consul::config_mode,
content => consul_sorted_json($check_hash, $consul::pretty_config, $consul::pretty_config_indent),
owner => $::consul::user,
group => $::consul::group,
mode => $::consul::config_mode,
content => consul_sorted_json($check_hash, $::consul::pretty_config, $::consul::pretty_config_indent),
} ~> Class['consul::reload_service']
}
18 changes: 9 additions & 9 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
$purge = true,
) {

if $consul::init_style {
if $::consul::init_style {

case $consul::init_style {
case $::consul::init_style {
'upstart': {
file { '/etc/init/consul.conf':
mode => '0444',
Expand Down Expand Up @@ -84,20 +84,20 @@
}
}

file { $consul::config_dir:
file { $::consul::config_dir:
ensure => 'directory',
owner => $consul::user,
group => $consul::group,
owner => $::consul::user,
group => $::consul::group,
purge => $purge,
recurse => $purge,
} ->
file { 'consul config.json':
ensure => present,
path => "${consul::config_dir}/config.json",
owner => $consul::user,
group => $consul::group,
mode => $consul::config_mode,
content => consul_sorted_json($config_hash, $consul::pretty_config, $consul::pretty_config_indent),
owner => $::consul::user,
group => $::consul::group,
mode => $::consul::config_mode,
content => consul_sorted_json($config_hash, $::consul::pretty_config, $::consul::pretty_config_indent),
}

}
Loading

0 comments on commit 1ba4616

Please sign in to comment.