Merge "Added new parameter: $activate_httplog"

This commit is contained in:
Zuul 2017-11-24 14:20:45 +00:00 committed by Gerrit Code Review
commit 0980deab43
3 changed files with 78 additions and 8 deletions

View File

@ -49,6 +49,11 @@
# The IPv4, IPv6 or filesystem socket path of the syslog server.
# Defaults to '/dev/log'
#
# [*activate_httplog*]
# Globally activate "httplog" option (in defaults section)
# In case the listener is NOT set to "http" mode, HAProxy will fallback to "tcplog".
# Defaults to false
#
# [*haproxy_globals_override*]
# HAProxy global option we can append to the default base set in this class.
# If you enter an already existing key, it will override the default.
@ -587,6 +592,7 @@ class tripleo::haproxy (
$haproxy_listen_bind_param = [ 'transparent' ],
$haproxy_member_options = [ 'check', 'inter 2000', 'rise 2', 'fall 5' ],
$haproxy_log_address = '/dev/log',
$activate_httplog = false,
$haproxy_globals_override = {},
$haproxy_daemon = true,
$haproxy_socket_access_level = 'user',
@ -836,16 +842,23 @@ class tripleo::haproxy (
$haproxy_daemonize = {}
}
$haproxy_defaults_options = {
'mode' => 'tcp',
'log' => 'global',
'retries' => '3',
'timeout' => $haproxy_default_timeout,
'maxconn' => $haproxy_default_maxconn,
}
if $activate_httplog {
$httplog = {'option' => 'httplog'}
} else {
$httplog = {}
}
class { '::haproxy':
service_manage => $haproxy_service_manage,
global_options => merge($haproxy_global_options, $haproxy_daemonize, $haproxy_globals_override),
defaults_options => {
'mode' => 'tcp',
'log' => 'global',
'retries' => '3',
'timeout' => $haproxy_default_timeout,
'maxconn' => $haproxy_default_maxconn,
},
defaults_options => merge($haproxy_defaults_options, $httplog),
}

View File

@ -0,0 +1,10 @@
---
features:
- |
Added new parameter to tripleo::haproxy: activate_httplog
This allows to activate the HTTP full logs in HAProxy.
fixes:
- Fixes `bug 1733801
<https://bugs.launchpad.net/tripleo/+bug/1733801>`__ so we can activate
haproxy logs.

View File

@ -100,6 +100,53 @@ describe 'tripleo::haproxy' do
end
end
describe "default Defaults for haproxy" do
it 'should NOT activate httplog' do
is_expected.to contain_class('haproxy').with(
:defaults_options => {
"mode"=>"tcp",
"log"=>"global",
"retries"=>"3",
"timeout"=> [
"http-request 10s",
"queue 2m",
"connect 10s",
"client 2m",
"server 2m",
"check 10s",
],
"maxconn"=>4096,
}
)
end
end
describe "activate httplog" do
before :each do
params.merge!({
:activate_httplog => true,
})
end
it 'should activate httplog' do
is_expected.to contain_class('haproxy').with(
:defaults_options => {
"mode"=>"tcp",
"log"=>"global",
"retries"=>"3",
"timeout"=> [
"http-request 10s",
"queue 2m",
"connect 10s",
"client 2m",
"server 2m",
"check 10s",
],
"maxconn"=>4096,
"option"=>"httplog",
}
)
end
end
end
on_supported_os.each do |os, facts|