Skip to content

Commit

Permalink
Update haproxy to 92b97f0c9532c1f6d5cf9a1358f68c75cf367cb0
Browse files Browse the repository at this point in the history
92b97f0c9532c1f6d5cf9a1358f68c75cf367cb0 Merge pull request redhat-openstack#208 from arteal/patch-1
75e4abf34ae95393d84a24cfe14a48d4d0456730 Merge pull request redhat-openstack#209 from puppetlabs/1.3.x
6a003d490718a93533cfdd8c57e13d6b669661f3 Merge pull request redhat-openstack#207 from tlimoncelli/validate_hash_options
43af8e5213aff72ea2e2831d189a4014c002ec85 Fix port parameter name on haproxy::peer defined type
1f0b8552d47fb1ef04c4be7457b0b7e6ac82d905 Merge pull request redhat-openstack#206 from tphoney/release_1.3.1
9b8ccedcad1af831bff268eba5e345627cfe81b3 1.3.1 release prep
478b02904533ef84ee8d960d736828312273fed4 Validate global_options and defaults_options.

Change-Id: I161447773d94545506544e22e0728c3667c159a1
  • Loading branch information
xbezdick committed Dec 15, 2015
1 parent f94533e commit 28b4449
Show file tree
Hide file tree
Showing 7 changed files with 145 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Puppetfile
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ mod 'gnocchi',
:git => 'https://github.com/openstack/puppet-gnocchi.git'

mod 'haproxy',
:commit => 'a1cd826990bb7e5d015418b679755aa6606ec13b',
:commit => '92b97f0c9532c1f6d5cf9a1358f68c75cf367cb0',
:git => 'https://github.com/puppetlabs/puppetlabs-haproxy.git'

mod 'heat',
Expand Down
5 changes: 5 additions & 0 deletions haproxy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## Supported Release 1.3.1
###Summary

Small release for support of newer PE versions. This increments the version of PE in the metadata.json file.

## 2015-07-15 - Supported Release 1.3.0
### Summary
This release adds puppet 4 support, and adds the ability to specify the order
Expand Down
2 changes: 1 addition & 1 deletion haproxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,7 +668,7 @@ Sets up a peer entry inside the peers configuration block in haproxy.cfg.

* `peers_name`: *Required.* Specifies the peer in which to add the load balancer. Valid options: a string containing the name of an HAProxy peer.

* `ports`: *Required.* Specifies the port on which the load balancer sends connections to peers. Valid options: a string containing a port number.
* `port`: *Required.* Specifies the port on which the load balancer sends connections to peers. Valid options: a string containing a port number.

* `server_names`: *Required unless the `collect_exported` parameter of your `haproxy::peers` resource is set to `true`.* Sets the name of the peer server as listed in the peers configuration block. 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 `ipaddresses`. Puppet pairs up the elements from both arrays and creates a peer for each pair of values. Default: the value of the `$::hostname` fact.

Expand Down
1 change: 1 addition & 0 deletions haproxy/manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
validate_bool($service_manage)
validate_bool($merge_options)
validate_string($service_options)
validate_hash($global_options, $defaults_options)

# NOTE: These deprecating parameters are implemented in this class,
# not in haproxy::instance. haproxy::instance is new and therefore
Expand Down
5 changes: 3 additions & 2 deletions haproxy/manifests/instance.pp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@
# Therefore, we "include haproxy::params" for any parameters we need.
include haproxy::params

$_global_options = pick($global_options, $haproxy::params::global_options, [])
$_defaults_options = pick($defaults_options, $haproxy::params::defaults_options, [])
$_global_options = pick($global_options, $haproxy::params::global_options)
$_defaults_options = pick($defaults_options, $haproxy::params::defaults_options)
validate_hash($_global_options,$_defaults_options)

# Determine instance_name based on:
# single-instance hosts: haproxy
Expand Down
4 changes: 2 additions & 2 deletions haproxy/metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppetlabs-haproxy",
"version": "1.3.0",
"version": "1.3.1",
"author": "Puppet Labs",
"summary": "Configures HAProxy servers and manages the configuration of backend member servers.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -59,7 +59,7 @@
"requirements": [
{
"name": "pe",
"version_requirement": ">= 3.0.0 < 2015.3.0"
"version_requirement": ">= 3.0.0 < 2015.4.0"
},
{
"name": "puppet",
Expand Down
132 changes: 132 additions & 0 deletions haproxy/spec/classes/haproxy_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,138 @@
end
end
end

describe 'when overriding global and defaults options with user-supplied overrides and additions' do
# For testing the merging functionality we restrict ourselves to
# Debian OS family so that we don't have to juggle different sets of
# global_options and defaults_options (like for FreeBSD).
['Debian' ].each do |osfamily|
context "on #{osfamily} family operatingsystems" do
let(:facts) do
{ :osfamily => osfamily }.merge default_facts
end
let(:contents) { param_value(catalogue, 'concat::fragment', 'haproxy-haproxy-base', 'content').split("\n") }
let(:params) do
{
'merge_options' => false,
'global_options' => {
'log-send-hostname' => '',
'chroot' => '/srv/haproxy-chroot',
'stats' => [
'socket /var/lib/haproxy/admin.sock mode 660 level admin',
'timeout 30s'
]
},
'defaults_options' => {
'mode' => 'http',
'option' => [
'abortonclose',
'logasap',
'dontlognull',
'httplog',
'http-server-close',
'forwardfor except 127.0.0.1',
],
'timeout' => [
'connect 5s',
'client 1m',
'server 1m',
'check 7s',
]
},
}
end
it 'should manage a custom chroot directory' do
subject.should contain_file('/srv/haproxy-chroot').with(
'ensure' => 'directory'
)
end
it 'should contain global and defaults sections' do
contents.should include('global')
contents.should include('defaults')
end
it 'should send hostname with log in global options' do
contents.should include(' log-send-hostname ')
end
it 'should enable admin stats and stats timeout in global options' do
contents.should include(' stats socket /var/lib/haproxy/admin.sock mode 660 level admin')
contents.should include(' stats timeout 30s')
end
it 'should set mode http in default options' do
contents.should include(' mode http')
end
it 'should not set the global parameter "maxconn"' do
contents.should_not include(' maxconn 4000')
end
it 'should set various options in defaults, removing the "redispatch" option' do
contents.should_not include(' option redispatch')
contents.should include(' option abortonclose')
contents.should include(' option logasap')
contents.should include(' option dontlognull')
contents.should include(' option httplog')
contents.should include(' option http-server-close')
contents.should include(' option forwardfor except 127.0.0.1')
end
it 'should set timeouts in defaults, removing the "http-request 10s" and "queue 1m" timeout' do
contents.should_not include(' timeout http-request 10s')
contents.should_not include(' timeout queue 1m')
contents.should include(' timeout connect 5s')
contents.should include(' timeout check 7s')
contents.should include(' timeout client 1m')
contents.should include(' timeout server 1m')
end
end
end
end

describe 'when specifying global_options with arrays instead of hashes' do
# For testing input validation we restrict ourselves to
# Debian OS family so that we don't have to juggle different sets of
# global_options and defaults_options (like for FreeBSD).
['Debian' ].each do |osfamily|
context "on #{osfamily} family operatingsystems" do
let(:facts) do
{ :osfamily => osfamily }.merge default_facts
end
let(:contents) { param_value(catalogue, 'concat::fragment', 'haproxy-haproxy-base', 'content').split("\n") }
let(:params) do
{
'merge_options' => true,
'global_options' => [ 'log-send-hostname', 'chroot /srv/haproxy-chroot' ]
}
end
it 'should raise error' do
expect { catalogue }.to raise_error Puppet::Error, /is not a Hash/
end
end
end
end
describe 'when specifying defaults_options with arrays instead of hashes' do
# For testing input validation we restrict ourselves to
# Debian OS family so that we don't have to juggle different sets of
# global_options and defaults_options (like for FreeBSD).
['Debian' ].each do |osfamily|
context "on #{osfamily} family operatingsystems" do
let(:facts) do
{ :osfamily => osfamily }.merge default_facts
end
let(:contents) { param_value(catalogue, 'concat::fragment', 'haproxy-haproxy-base', 'content').split("\n") }
let(:params) do
{
'merge_options' => true,
'defaults_options' => [
'mode http',
'timeout connect 5s',
'timeout client 1m'
]
}
end
it 'should raise error' do
expect { catalogue }.to raise_error Puppet::Error, /is not a Hash/
end
end
end
end
end

context 'on unsupported operatingsystems' do
Expand Down

0 comments on commit 28b4449

Please sign in to comment.