Showing with 153 additions and 17 deletions.
  1. +1 −0 .pdkignore
  2. +24 −9 CHANGELOG.md
  3. +1 −1 CODEOWNERS
  4. +1 −1 README.md
  5. +75 −0 REFERENCE.md
  6. +0 −1 manifests/config.pp
  7. +14 −1 manifests/defaults.pp
  8. +1 −2 manifests/params.pp
  9. +1 −1 metadata.json
  10. +35 −1 spec/defines/defaults_spec.rb
1 change: 1 addition & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
/.fixtures.yml
/Gemfile
/.gitattributes
/.github/
/.gitignore
/.gitlab-ci.yml
/.pdkignore
Expand Down
33 changes: 24 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [v8.0.0](https://github.com/puppetlabs/puppetlabs-haproxy/tree/v8.0.0) - 2023-11-22

[Full Changelog](https://github.com/puppetlabs/puppetlabs-haproxy/compare/v7.2.1...v8.0.0)

### Changed
- merge_options: Switch default false->true [#592](https://github.com/puppetlabs/puppetlabs-haproxy/pull/592) ([bastelfreak](https://github.com/bastelfreak))

### Added

- Add `merge_options` for `haproxy::defaults` [#588](https://github.com/puppetlabs/puppetlabs-haproxy/pull/588) ([yakatz](https://github.com/yakatz))

### Other

- Add bastelfreak to codeowners [#594](https://github.com/puppetlabs/puppetlabs-haproxy/pull/594) ([bastelfreak](https://github.com/bastelfreak))

## [v7.2.1](https://github.com/puppetlabs/puppetlabs-haproxy/tree/v7.2.1) - 2023-09-26

[Full Changelog](https://github.com/puppetlabs/puppetlabs-haproxy/compare/v7.2.0...v7.2.1)
Expand Down Expand Up @@ -214,13 +229,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

[Full Changelog](https://github.com/puppetlabs/puppetlabs-haproxy/compare/3.0.1...v4.0.0)

### Changed
- pdksync - (MODULES-8444) - Raise lower Puppet bound [#362](https://github.com/puppetlabs/puppetlabs-haproxy/pull/362) ([david22swan](https://github.com/david22swan))

### Added

- [FM-7934] - Puppet Strings [#365](https://github.com/puppetlabs/puppetlabs-haproxy/pull/365) ([carabasdaniel](https://github.com/carabasdaniel))

### Changed
- pdksync - (MODULES-8444) - Raise lower Puppet bound [#362](https://github.com/puppetlabs/puppetlabs-haproxy/pull/362) ([david22swan](https://github.com/david22swan))

### Fixed

- (MODULES-8930) Fix stahnma/epel dependency failures [#364](https://github.com/puppetlabs/puppetlabs-haproxy/pull/364) ([eimlav](https://github.com/eimlav))
Expand All @@ -234,14 +249,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

[Full Changelog](https://github.com/puppetlabs/puppetlabs-haproxy/compare/2.2.0...3.0.0)

### Changed
- (FM-7675) - Support has been removed for RHEL 6 [#345](https://github.com/puppetlabs/puppetlabs-haproxy/pull/345) ([david22swan](https://github.com/david22swan))

### Added

- (MODULES-8539) Added 'accepted_payload_size' to resolver [#346](https://github.com/puppetlabs/puppetlabs-haproxy/pull/346) ([genebean](https://github.com/genebean))
- Sergey leskov/servertemplatekwimp [#337](https://github.com/puppetlabs/puppetlabs-haproxy/pull/337) ([LeskovSergey](https://github.com/LeskovSergey))

### Changed
- (FM-7675) - Support has been removed for RHEL 6 [#345](https://github.com/puppetlabs/puppetlabs-haproxy/pull/345) ([david22swan](https://github.com/david22swan))

### Fixed

- (MODULES-8566) Only create entries for defined settings [#350](https://github.com/puppetlabs/puppetlabs-haproxy/pull/350) ([genebean](https://github.com/genebean))
Expand Down Expand Up @@ -287,13 +302,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a

[Full Changelog](https://github.com/puppetlabs/puppetlabs-haproxy/compare/list...2.0.0)

### Changed
- (WIP) Puppet4 update [#285](https://github.com/puppetlabs/puppetlabs-haproxy/pull/285) ([HelenCampbell](https://github.com/HelenCampbell))

### Added

- Add haproxy::resolver supported only by haproxy version 1.6+ [#291](https://github.com/puppetlabs/puppetlabs-haproxy/pull/291) ([missingcharacter](https://github.com/missingcharacter))

### Changed
- (WIP) Puppet4 update [#285](https://github.com/puppetlabs/puppetlabs-haproxy/pull/285) ([HelenCampbell](https://github.com/HelenCampbell))

### Fixed

- on freebsd haproxy lives on /usr/local/sbin [#292](https://github.com/puppetlabs/puppetlabs-haproxy/pull/292) ([rmdir](https://github.com/rmdir))
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Setting ownership to the modules team
* @puppetlabs/modules
* @puppetlabs/modules @bastelfreak
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ Acceptance tests for this module leverage [puppet_litmus](https://github.com/pup
To run the acceptance tests follow the instructions [here](https://github.com/puppetlabs/puppet_litmus/wiki/Tutorial:-use-Litmus-to-execute-acceptance-tests-with-a-sample-module-(MoTD)#install-the-necessary-gems-for-the-module).
You can also find a tutorial and walkthrough of using Litmus and the PDK on [YouTube](https://www.youtube.com/watch?v=FYfR7ZEGHoE).

If you run into an issue with this module, or if you would like to request a feature, please [file a ticket](https://tickets.puppetlabs.com/browse/MODULES/).
If you run into an issue with this module, or if you would like to request a feature, please [file a ticket](https://github.com/puppetlabs/puppetlabs-haproxy/issues).
Every Monday the Puppet IA Content Team has [office hours](https://puppet.com/community/office-hours) in the [Puppet Community Slack](http://slack.puppet.com/), alternating between an EMEA friendly time (1300 UTC) and an Americas friendly time (0900 Pacific, 1700 UTC).

If you have problems getting this module up and running, please [contact Support](http://puppetlabs.com/services/customer-support).
Expand Down
75 changes: 75 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ file on an haproxy load balancer.
* `haproxy::mailer::collect_exported`
* `haproxy::service`: HAProxy service

### Functions

* [`haproxy::generate_error_message`](#haproxy--generate_error_message): Function created to generate error message. Any string as error message can be passed and the function can be called in epp templates.
* [`haproxy::sort_bind`](#haproxy--sort_bind)
* [`haproxy::validate_ip_addr`](#haproxy--validate_ip_addr)

## Classes

### <a name="haproxy"></a>`haproxy`
Expand Down Expand Up @@ -714,6 +720,7 @@ The following parameters are available in the `haproxy::defaults` defined type:

* [`options`](#-haproxy--defaults--options)
* [`sort_options_alphabetic`](#-haproxy--defaults--sort_options_alphabetic)
* [`merge_options`](#-haproxy--defaults--merge_options)
* [`instance`](#-haproxy--defaults--instance)

##### <a name="-haproxy--defaults--options"></a>`options`
Expand All @@ -733,6 +740,16 @@ Defaults to true.

Default value: `true`

##### <a name="-haproxy--defaults--merge_options"></a>`merge_options`

Data type: `Boolean`

Whether to merge the user-supplied `options` hash with the
`default_options` values set in params.pp. Merging allows to change
or add options without having to recreate the entire hash.

Default value: `$haproxy::params::merge_options`

##### <a name="-haproxy--defaults--instance"></a>`instance`

Data type: `String`
Expand Down Expand Up @@ -2010,3 +2027,61 @@ Optional. Defaults to 'haproxy'

Default value: `'haproxy'`

## Functions

### <a name="haproxy--generate_error_message"></a>`haproxy::generate_error_message`

Type: Ruby 4.x API

Function created to generate error message. Any string as error message can be passed and the function can
be called in epp templates.

#### `haproxy::generate_error_message(String $error_message)`

Function created to generate error message. Any string as error message can be passed and the function can
be called in epp templates.

Returns: `Any`

##### `error_message`

Data type: `String`



### <a name="haproxy--sort_bind"></a>`haproxy::sort_bind`

Type: Ruby 4.x API

The haproxy::sort_bind function.

#### `haproxy::sort_bind(Hash $bind)`

The haproxy::sort_bind function.

Returns: `Array`

##### `bind`

Data type: `Hash`



### <a name="haproxy--validate_ip_addr"></a>`haproxy::validate_ip_addr`

Type: Ruby 4.x API

The haproxy::validate_ip_addr function.

#### `haproxy::validate_ip_addr(String $virtual_ip)`

The haproxy::validate_ip_addr function.

Returns: `Boolean`

##### `virtual_ip`

Data type: `String`



1 change: 0 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
} else {
$_global_options = $global_options
$_defaults_options = $defaults_options
warning("${module_name}: The \$merge_options parameter will default to true in the next major release. Please review the documentation regarding the implications.") # lint:ignore:140chars
}

if defined(Class['haproxy']) {
Expand Down
15 changes: 14 additions & 1 deletion manifests/defaults.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,18 @@
# Sort options either alphabetic or custom like haproxy internal sorts them.
# Defaults to true.
#
# @param merge_options
# Whether to merge the user-supplied `options` hash with the
# `default_options` values set in params.pp. Merging allows to change
# or add options without having to recreate the entire hash.
#
# @param instance
# Optional. Defaults to 'haproxy'.
#
define haproxy::defaults (
Hash $options = {},
Boolean $sort_options_alphabetic = true,
Boolean $merge_options = $haproxy::params::merge_options,
String $instance = 'haproxy',
) {
if $instance == 'haproxy' {
Expand All @@ -36,9 +42,16 @@
include haproxy::globals
$_sort_options_alphabetic = pick($sort_options_alphabetic, $haproxy::globals::sort_options_alphabetic)

$defaults_options = pick($options, $haproxy::params::defaults_options)
if $merge_options {
$_defaults_options = $haproxy::params::defaults_options + $defaults_options
} else {
$_defaults_options = $defaults_options
}

$parameters = {
'_sort_options_alphabetic' => $_sort_options_alphabetic,
'options' => $options,
'options' => $_defaults_options,
'name' => $name,
}

Expand Down
3 changes: 1 addition & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
# extended by changing package names and configuration file paths.
#
class haproxy::params {
# XXX: This will change to true in the next major release
$merge_options = false
$merge_options = true

$service_options = "ENABLED=1\n" # Only used by Debian.
$sysconfig_options = 'OPTIONS=""' #Only used by Redhat/CentOS etc
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-haproxy",
"version": "7.2.1",
"version": "8.0.0",
"author": "puppetlabs",
"summary": "Configures HAProxy servers and manages the configuration of backend member servers.",
"license": "Apache-2.0",
Expand Down
36 changes: 35 additions & 1 deletion spec/defines/defaults_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
context 'with a single option' do
let(:params) do
{
options: { 'balance' => 'roundrobin' }
options: { 'balance' => 'roundrobin' },
merge_options: false
}
end

Expand All @@ -37,4 +38,37 @@
)
}
end

context 'with merge defaults true' do
let(:params) do
{
options: { 'balance' => 'roundrobin' }
}
end

defaults_output = <<~EXPECTEDOUTPUT
defaults test
balance roundrobin
log global
maxconn 8000
option redispatch
retries 3
stats enable
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout check 10s
EXPECTEDOUTPUT
it {
is_expected.to contain_concat__fragment('haproxy-test_defaults_block').with(
'order' => '25-test',
'target' => '/tmp/haproxy.cfg',
'content' => defaults_output,
)
}
end
end