Merge "Add support for parameters of the gatekeeper middleware"
This commit is contained in:
		@@ -7,25 +7,35 @@
 | 
			
		||||
#
 | 
			
		||||
# == Parameters
 | 
			
		||||
#
 | 
			
		||||
# [*shunt_inbound_x_timestamp*]
 | 
			
		||||
#  (Optional) Disallow clients to set arbitary X-Timestamps on uploade objects.
 | 
			
		||||
#  Defaults to $::os_service_default.
 | 
			
		||||
#
 | 
			
		||||
# [*allow_reserved_names_header*]
 | 
			
		||||
#  (Optional) Allow clients to access and manipulate the null namespace by
 | 
			
		||||
#  including a header like
 | 
			
		||||
#     X-Allow-Reserved-Names: true
 | 
			
		||||
#  Defaults to $::os_service_default.
 | 
			
		||||
#
 | 
			
		||||
# [*log_name*]
 | 
			
		||||
# The log name of gatekeeper.
 | 
			
		||||
# Default to gatekeeper.
 | 
			
		||||
#  (Optional) The log name of gatekeeper.
 | 
			
		||||
#  Defaults to gatekeeper.
 | 
			
		||||
#
 | 
			
		||||
# [*log_facility*]
 | 
			
		||||
# The log facility of gatekeeper.
 | 
			
		||||
# Default to LOG_LOCAL2.
 | 
			
		||||
#  (Optional) The log facility of gatekeeper.
 | 
			
		||||
#  Defaults to LOG_LOCAL2.
 | 
			
		||||
#
 | 
			
		||||
# [*log_level*]
 | 
			
		||||
# The log level of gatekeeper.
 | 
			
		||||
# Default to INFO.
 | 
			
		||||
#  (Optional) The log level of gatekeeper.
 | 
			
		||||
#  Defaults to INFO.
 | 
			
		||||
#
 | 
			
		||||
# [*log_headers*]
 | 
			
		||||
# The log headers of gatekeeper.
 | 
			
		||||
# Default to false.
 | 
			
		||||
#  (Optional) The log headers of gatekeeper.
 | 
			
		||||
#  Defaults to false.
 | 
			
		||||
#
 | 
			
		||||
# [*log_address*]
 | 
			
		||||
# The log address of gatekeeper.
 | 
			
		||||
# Default to '/dev/log'.
 | 
			
		||||
#  (Optional) The log address of gatekeeper.
 | 
			
		||||
#  Defaults to '/dev/log'.
 | 
			
		||||
#
 | 
			
		||||
# == Authors
 | 
			
		||||
#
 | 
			
		||||
@@ -36,21 +46,25 @@
 | 
			
		||||
# Copyright 2014 UnitedStack licensing@unitedstack.com
 | 
			
		||||
#
 | 
			
		||||
class swift::proxy::gatekeeper(
 | 
			
		||||
  $log_name     = 'gatekeeper',
 | 
			
		||||
  $log_facility = 'LOG_LOCAL2',
 | 
			
		||||
  $log_level    = 'INFO',
 | 
			
		||||
  $log_headers  = false,
 | 
			
		||||
  $log_address  = '/dev/log'
 | 
			
		||||
  $shunt_inbound_x_timestamp   = $::os_service_default,
 | 
			
		||||
  $allow_reserved_names_header = $::os_service_default,
 | 
			
		||||
  $log_name                    = 'gatekeeper',
 | 
			
		||||
  $log_facility                = 'LOG_LOCAL2',
 | 
			
		||||
  $log_level                   = 'INFO',
 | 
			
		||||
  $log_headers                 = false,
 | 
			
		||||
  $log_address                 = '/dev/log'
 | 
			
		||||
) {
 | 
			
		||||
 | 
			
		||||
  include swift::deps
 | 
			
		||||
 | 
			
		||||
  swift_proxy_config {
 | 
			
		||||
    'filter:gatekeeper/use':              value => 'egg:swift#gatekeeper';
 | 
			
		||||
    'filter:gatekeeper/set log_name':     value => $log_name;
 | 
			
		||||
    'filter:gatekeeper/set log_facility': value => $log_facility;
 | 
			
		||||
    'filter:gatekeeper/set log_level':    value => $log_level;
 | 
			
		||||
    'filter:gatekeeper/set log_headers':  value => $log_headers;
 | 
			
		||||
    'filter:gatekeeper/set log_address':  value => $log_address;
 | 
			
		||||
    'filter:gatekeeper/use':                         value => 'egg:swift#gatekeeper';
 | 
			
		||||
    'filter:gatekeeper/shunt_inbound_x_timestamp':   value => $shunt_inbound_x_timestamp;
 | 
			
		||||
    'filter:gatekeeper/allow_reserved_names_header': value => $allow_reserved_names_header;
 | 
			
		||||
    'filter:gatekeeper/set log_name':                value => $log_name;
 | 
			
		||||
    'filter:gatekeeper/set log_facility':            value => $log_facility;
 | 
			
		||||
    'filter:gatekeeper/set log_level':               value => $log_level;
 | 
			
		||||
    'filter:gatekeeper/set log_headers':             value => $log_headers;
 | 
			
		||||
    'filter:gatekeeper/set log_address':             value => $log_address;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										8
									
								
								releasenotes/notes/gatekeeper-opts-73ef4db32c2e702e.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								releasenotes/notes/gatekeeper-opts-73ef4db32c2e702e.yaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,8 @@
 | 
			
		||||
---
 | 
			
		||||
features:
 | 
			
		||||
  - |
 | 
			
		||||
    The following two parameters have been added to
 | 
			
		||||
    the ``swift::proxy::gatekeeper`` class.
 | 
			
		||||
 | 
			
		||||
    - ``shunt_inbound_x_timestamp``
 | 
			
		||||
    - ``allow_reserved_names_header``
 | 
			
		||||
@@ -4,6 +4,8 @@ describe 'swift::proxy::gatekeeper' do
 | 
			
		||||
  shared_examples 'swift::proxy::gatekeeper' do
 | 
			
		||||
    describe "when using default parameters" do
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/use').with_value('egg:swift#gatekeeper') }
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/shunt_inbound_x_timestamp').with_value('<SERVICE DEFAULT>') }
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/allow_reserved_names_header').with_value('<SERVICE DEFAULT>') }
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_name').with_value('gatekeeper') }
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_facility').with_value('LOG_LOCAL2') }
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_level').with_value('INFO') }
 | 
			
		||||
@@ -14,12 +16,16 @@ describe 'swift::proxy::gatekeeper' do
 | 
			
		||||
    describe "when overriding default parameters" do
 | 
			
		||||
      let :params do
 | 
			
		||||
        {
 | 
			
		||||
          :log_name         => 'newgatekeeper',
 | 
			
		||||
          :log_facility     => 'LOG_LOCAL3',
 | 
			
		||||
          :log_level        => 'WARN',
 | 
			
		||||
          :shunt_inbound_x_timestamp   => true,
 | 
			
		||||
          :allow_reserved_names_header => false,
 | 
			
		||||
          :log_name                    => 'newgatekeeper',
 | 
			
		||||
          :log_facility                => 'LOG_LOCAL3',
 | 
			
		||||
          :log_level                   => 'WARN',
 | 
			
		||||
        }
 | 
			
		||||
      end
 | 
			
		||||
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/shunt_inbound_x_timestamp').with_value(true) }
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/allow_reserved_names_header').with_value(false) }
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_name').with_value('newgatekeeper') }
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_facility').with_value('LOG_LOCAL3') }
 | 
			
		||||
      it { is_expected.to contain_swift_proxy_config('filter:gatekeeper/set log_level').with_value('WARN') }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user