Skip to content

Commit 28b4449

Browse files
committed
Update haproxy to 92b97f0c9532c1f6d5cf9a1358f68c75cf367cb0
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
1 parent f94533e commit 28b4449

7 files changed

Lines changed: 145 additions & 6 deletions

File tree

Puppetfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ mod 'gnocchi',
7979
:git => 'https://github.com/openstack/puppet-gnocchi.git'
8080

8181
mod 'haproxy',
82-
:commit => 'a1cd826990bb7e5d015418b679755aa6606ec13b',
82+
:commit => '92b97f0c9532c1f6d5cf9a1358f68c75cf367cb0',
8383
:git => 'https://github.com/puppetlabs/puppetlabs-haproxy.git'
8484

8585
mod 'heat',

haproxy/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## Supported Release 1.3.1
2+
###Summary
3+
4+
Small release for support of newer PE versions. This increments the version of PE in the metadata.json file.
5+
16
## 2015-07-15 - Supported Release 1.3.0
27
### Summary
38
This release adds puppet 4 support, and adds the ability to specify the order

haproxy/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ Sets up a peer entry inside the peers configuration block in haproxy.cfg.
668668

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

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

673673
* `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.
674674

haproxy/manifests/init.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@
123123
validate_bool($service_manage)
124124
validate_bool($merge_options)
125125
validate_string($service_options)
126+
validate_hash($global_options, $defaults_options)
126127

127128
# NOTE: These deprecating parameters are implemented in this class,
128129
# not in haproxy::instance. haproxy::instance is new and therefore

haproxy/manifests/instance.pp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@
160160
# Therefore, we "include haproxy::params" for any parameters we need.
161161
include haproxy::params
162162

163-
$_global_options = pick($global_options, $haproxy::params::global_options, [])
164-
$_defaults_options = pick($defaults_options, $haproxy::params::defaults_options, [])
163+
$_global_options = pick($global_options, $haproxy::params::global_options)
164+
$_defaults_options = pick($defaults_options, $haproxy::params::defaults_options)
165+
validate_hash($_global_options,$_defaults_options)
165166

166167
# Determine instance_name based on:
167168
# single-instance hosts: haproxy

haproxy/metadata.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "puppetlabs-haproxy",
3-
"version": "1.3.0",
3+
"version": "1.3.1",
44
"author": "Puppet Labs",
55
"summary": "Configures HAProxy servers and manages the configuration of backend member servers.",
66
"license": "Apache-2.0",
@@ -59,7 +59,7 @@
5959
"requirements": [
6060
{
6161
"name": "pe",
62-
"version_requirement": ">= 3.0.0 < 2015.3.0"
62+
"version_requirement": ">= 3.0.0 < 2015.4.0"
6363
},
6464
{
6565
"name": "puppet",

haproxy/spec/classes/haproxy_spec.rb

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,138 @@
463463
end
464464
end
465465
end
466+
467+
describe 'when overriding global and defaults options with user-supplied overrides and additions' do
468+
# For testing the merging functionality we restrict ourselves to
469+
# Debian OS family so that we don't have to juggle different sets of
470+
# global_options and defaults_options (like for FreeBSD).
471+
['Debian' ].each do |osfamily|
472+
context "on #{osfamily} family operatingsystems" do
473+
let(:facts) do
474+
{ :osfamily => osfamily }.merge default_facts
475+
end
476+
let(:contents) { param_value(catalogue, 'concat::fragment', 'haproxy-haproxy-base', 'content').split("\n") }
477+
let(:params) do
478+
{
479+
'merge_options' => false,
480+
'global_options' => {
481+
'log-send-hostname' => '',
482+
'chroot' => '/srv/haproxy-chroot',
483+
'stats' => [
484+
'socket /var/lib/haproxy/admin.sock mode 660 level admin',
485+
'timeout 30s'
486+
]
487+
},
488+
'defaults_options' => {
489+
'mode' => 'http',
490+
'option' => [
491+
'abortonclose',
492+
'logasap',
493+
'dontlognull',
494+
'httplog',
495+
'http-server-close',
496+
'forwardfor except 127.0.0.1',
497+
],
498+
'timeout' => [
499+
'connect 5s',
500+
'client 1m',
501+
'server 1m',
502+
'check 7s',
503+
]
504+
},
505+
}
506+
end
507+
it 'should manage a custom chroot directory' do
508+
subject.should contain_file('/srv/haproxy-chroot').with(
509+
'ensure' => 'directory'
510+
)
511+
end
512+
it 'should contain global and defaults sections' do
513+
contents.should include('global')
514+
contents.should include('defaults')
515+
end
516+
it 'should send hostname with log in global options' do
517+
contents.should include(' log-send-hostname ')
518+
end
519+
it 'should enable admin stats and stats timeout in global options' do
520+
contents.should include(' stats socket /var/lib/haproxy/admin.sock mode 660 level admin')
521+
contents.should include(' stats timeout 30s')
522+
end
523+
it 'should set mode http in default options' do
524+
contents.should include(' mode http')
525+
end
526+
it 'should not set the global parameter "maxconn"' do
527+
contents.should_not include(' maxconn 4000')
528+
end
529+
it 'should set various options in defaults, removing the "redispatch" option' do
530+
contents.should_not include(' option redispatch')
531+
contents.should include(' option abortonclose')
532+
contents.should include(' option logasap')
533+
contents.should include(' option dontlognull')
534+
contents.should include(' option httplog')
535+
contents.should include(' option http-server-close')
536+
contents.should include(' option forwardfor except 127.0.0.1')
537+
end
538+
it 'should set timeouts in defaults, removing the "http-request 10s" and "queue 1m" timeout' do
539+
contents.should_not include(' timeout http-request 10s')
540+
contents.should_not include(' timeout queue 1m')
541+
contents.should include(' timeout connect 5s')
542+
contents.should include(' timeout check 7s')
543+
contents.should include(' timeout client 1m')
544+
contents.should include(' timeout server 1m')
545+
end
546+
end
547+
end
548+
end
549+
550+
describe 'when specifying global_options with arrays instead of hashes' do
551+
# For testing input validation we restrict ourselves to
552+
# Debian OS family so that we don't have to juggle different sets of
553+
# global_options and defaults_options (like for FreeBSD).
554+
['Debian' ].each do |osfamily|
555+
context "on #{osfamily} family operatingsystems" do
556+
let(:facts) do
557+
{ :osfamily => osfamily }.merge default_facts
558+
end
559+
let(:contents) { param_value(catalogue, 'concat::fragment', 'haproxy-haproxy-base', 'content').split("\n") }
560+
let(:params) do
561+
{
562+
'merge_options' => true,
563+
'global_options' => [ 'log-send-hostname', 'chroot /srv/haproxy-chroot' ]
564+
}
565+
end
566+
it 'should raise error' do
567+
expect { catalogue }.to raise_error Puppet::Error, /is not a Hash/
568+
end
569+
end
570+
end
571+
end
572+
describe 'when specifying defaults_options with arrays instead of hashes' do
573+
# For testing input validation we restrict ourselves to
574+
# Debian OS family so that we don't have to juggle different sets of
575+
# global_options and defaults_options (like for FreeBSD).
576+
['Debian' ].each do |osfamily|
577+
context "on #{osfamily} family operatingsystems" do
578+
let(:facts) do
579+
{ :osfamily => osfamily }.merge default_facts
580+
end
581+
let(:contents) { param_value(catalogue, 'concat::fragment', 'haproxy-haproxy-base', 'content').split("\n") }
582+
let(:params) do
583+
{
584+
'merge_options' => true,
585+
'defaults_options' => [
586+
'mode http',
587+
'timeout connect 5s',
588+
'timeout client 1m'
589+
]
590+
}
591+
end
592+
it 'should raise error' do
593+
expect { catalogue }.to raise_error Puppet::Error, /is not a Hash/
594+
end
595+
end
596+
end
597+
end
466598
end
467599

468600
context 'on unsupported operatingsystems' do

0 commit comments

Comments
 (0)