Skip to content

Commit

Permalink
Lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hunner committed Mar 18, 2016
1 parent eea6086 commit c8ee7d9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -729,8 +729,6 @@ Sets up a peer entry inside the peers configuration block in haproxy.cfg.

##### Parameters

* `ensure`: Specifies whether the peer should exist in the configuration block. Valid options: 'present' or 'absent'. Default: 'present'.

* `ipaddresses`: *Required unless the `collect_exported` parameter of your `haproxy::peers` resource is set to `true`.* Specifies the IP address used to contact the peer member server. Valid options: a string or an array. If you pass an array, it must contain the same number of elements as the array you pass to the `server_names` parameter. Puppet pairs up the elements from both arrays and creates a peer for each pair of values. Default: the value of the `$::ipaddress` fact.

* `peers_name`: *Required.* Specifies the peer in which to add the load balancer. Valid options: a string containing the name of an HAProxy peer.
Expand Down
6 changes: 3 additions & 3 deletions manifests/backend.pp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
'option' => [
'tcplog',
],
'balance' => 'roundrobin'
'balance' => 'roundrobin',
},
$instance = 'haproxy',
$section_name = $name,
Expand All @@ -74,15 +74,15 @@
fail("An haproxy::listen resource was discovered with the same name (${section_name}) which is not supported")
}

include haproxy::params
include ::haproxy::params
if $instance == 'haproxy' {
$instance_name = 'haproxy'
$config_file = $haproxy::params::config_file
} else {
$instance_name = "haproxy-${instance}"
$config_file = inline_template($haproxy::params::config_file_tmpl)
}
include haproxy::globals
include ::haproxy::globals
$_sort_options_alphabetic = pick($sort_options_alphabetic, $haproxy::globals::sort_options_alphabetic)

# Template uses: $section_name, $ipaddress, $ports, $options
Expand Down
17 changes: 8 additions & 9 deletions manifests/peer.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@
# ipaddresses parameter's array. A peer is created for each pair
# of server\_names and ipaddresses in the array.
#
# [*ensure*]
# Whether to add or remove the peer. Defaults to 'present'.
# Valid values are 'present' and 'absent'.
#
# [*ipaddresses*]
# Specifies the IP address used to contact the peer member server.
# Can be an array. If this parameter is specified as an array it
Expand All @@ -36,13 +32,17 @@
define haproxy::peer (
$peers_name,
$port,
$ensure = 'present',
$server_names = $::hostname,
$ipaddresses = $::ipaddress,
$instance = 'haproxy',
) {
$instance = 'haproxy',

include haproxy::params
#Deprecated
$ensure = undef,
) {
if $ensure {
warning('ensure is deprecated')
}
include ::haproxy::params
if $instance == 'haproxy' {
$instance_name = 'haproxy'
$config_file = $::haproxy::config_file
Expand All @@ -53,7 +53,6 @@

# Templates uses $ipaddresses, $server_name, $ports, $option
concat::fragment { "${instance_name}-peers-${peers_name}-${name}":
ensure => $ensure,
order => "30-peers-01-${peers_name}-${name}",
target => $config_file,
content => template('haproxy/haproxy_peer.erb'),
Expand Down
4 changes: 2 additions & 2 deletions manifests/peers.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
) {

# We derive these settings so that the caller only has to specify $instance.
include haproxy::params
include ::haproxy::params
if $instance == 'haproxy' {
$instance_name = 'haproxy'
$config_file = $::haproxy::config_file
Expand All @@ -27,7 +27,7 @@
$config_file = inline_template($haproxy::params::config_file_tmpl)
}

# Template uses: $name, $ipaddress, $ports, $options
# Template uses: $name
concat::fragment { "${instance_name}-${name}_peers_block":
order => "30-peers-00-${name}",
target => $config_file,
Expand Down

0 comments on commit c8ee7d9

Please sign in to comment.