Add proxyserver gatekeeper middleware
swift::proxy::gatekeeper class will be used to configure gatekeeper middlerware. Change-Id: I2f90ae41ba98f9b7d2bd7f3c5ed92fdbcd8fa999 Implements: blueprint icehouse-proxyserver-middlewares
This commit is contained in:
parent
eefaf9ca54
commit
e2c9415a35
manifests/proxy
spec/classes
templates/proxy
53
manifests/proxy/gatekeeper.pp
Normal file
53
manifests/proxy/gatekeeper.pp
Normal file
@ -0,0 +1,53 @@
|
||||
#
|
||||
# Configure swift gatekeeper.
|
||||
#
|
||||
# == Examples
|
||||
#
|
||||
# include swift::proxy::gatekeeper
|
||||
#
|
||||
# == Parameters
|
||||
#
|
||||
# [*log_name*]
|
||||
# The log name of gatekeeper.
|
||||
# Default to gatekeeper.
|
||||
#
|
||||
# [*log_facility*]
|
||||
# The log facility of gatekeeper.
|
||||
# Default to LOG_LOCAL0.
|
||||
#
|
||||
# [*log_level*]
|
||||
# The log level of gatekeeper.
|
||||
# Default to INFO.
|
||||
#
|
||||
# [*log_headers*]
|
||||
# The log headers of gatekeeper.
|
||||
# Default to false.
|
||||
#
|
||||
# [*log_address*]
|
||||
# The log address of gatekeeper.
|
||||
# Default to '/dev/log'.
|
||||
#
|
||||
# == Authors
|
||||
#
|
||||
# Xingchao Yu yuxcer@gmail.com
|
||||
#
|
||||
# == Copyright
|
||||
#
|
||||
# Copyright 2014 UnitedStack licensing@unitedstack.com
|
||||
#
|
||||
|
||||
class swift::proxy::gatekeeper(
|
||||
$log_name = 'gatekeeper',
|
||||
$log_facility = 'LOG_LOCAL0',
|
||||
$log_level = 'INFO',
|
||||
$log_headers = 'false',
|
||||
$log_address = '/dev/log'
|
||||
) {
|
||||
|
||||
concat::fragment { 'swift_gatekeeper':
|
||||
target => '/etc/swift/proxy-server.conf',
|
||||
content => template('swift/proxy/gatekeeper.conf.erb'),
|
||||
order => '34',
|
||||
}
|
||||
|
||||
}
|
57
spec/classes/swift_proxy_gatekeeper_spec.rb
Normal file
57
spec/classes/swift_proxy_gatekeeper_spec.rb
Normal file
@ -0,0 +1,57 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::gatekeeper' do
|
||||
|
||||
let :facts do
|
||||
{
|
||||
:concat_basedir => '/var/lib/puppet/concat'
|
||||
}
|
||||
end
|
||||
|
||||
let :pre_condition do
|
||||
'class { "concat::setup": }
|
||||
concat { "/etc/swift/proxy-server.conf": }'
|
||||
end
|
||||
|
||||
let :fragment_file do
|
||||
"/var/lib/puppet/concat/_etc_swift_proxy-server.conf/fragments/34_swift_gatekeeper"
|
||||
end
|
||||
|
||||
describe "when using default parameters" do
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
[
|
||||
'[filter:gatekeeper]',
|
||||
'use = egg:swift#gatekeeper',
|
||||
'set log_name = gatekeeper',
|
||||
'set log_facility = LOG_LOCAL0',
|
||||
'set log_level = INFO',
|
||||
'set log_headers = false',
|
||||
'set log_address = /dev/log',
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
describe "when overriding default parameters" do
|
||||
let :params do
|
||||
{
|
||||
:log_name => 'newgatekeeper',
|
||||
:log_facility => 'LOG_LOCAL2',
|
||||
:log_level => 'WARN',
|
||||
}
|
||||
end
|
||||
it 'should build the fragment with correct parameters' do
|
||||
verify_contents(subject, fragment_file,
|
||||
[
|
||||
'[filter:gatekeeper]',
|
||||
'use = egg:swift#gatekeeper',
|
||||
'set log_name = newgatekeeper',
|
||||
'set log_facility = LOG_LOCAL2',
|
||||
'set log_level = WARN',
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
7
templates/proxy/gatekeeper.conf.erb
Normal file
7
templates/proxy/gatekeeper.conf.erb
Normal file
@ -0,0 +1,7 @@
|
||||
[filter:gatekeeper]
|
||||
use = egg:swift#gatekeeper
|
||||
set log_name = <%= @log_name %>
|
||||
set log_facility = <%= @log_facility %>
|
||||
set log_level = <%= @log_level %>
|
||||
set log_headers = <%= @log_headers %>
|
||||
set log_address = <%= @log_address %>
|
Loading…
x
Reference in New Issue
Block a user