From 77e850340c60708ba8f31bfc0b58ba7706e6a82b Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 18 Jul 2022 12:02:57 +0900 Subject: [PATCH] proxy: Reduce hard-coded default values ... and use the service default values instead. This allows us to reduce amount of implementations we should maintain by ourselves and catch up with any change in service side more timely. Change-Id: I1eb53866aff14b6d7bca72d65b21810f87abc0ad --- manifests/proxy.pp | 20 ++++++++++---------- spec/classes/swift_proxy_spec.rb | 11 ++++++----- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/manifests/proxy.pp b/manifests/proxy.pp index 9577faf9..cc7b0a58 100644 --- a/manifests/proxy.pp +++ b/manifests/proxy.pp @@ -64,16 +64,16 @@ # Defaults to 'LOG_LOCAL2'. # # [*log_handoffs*] -# (optional) If True, the proxy will log whenever it has to failover to a handoff node -# Defaults to true. +# (optional) If True, the proxy will log whenever it has to failover to a handoff node +# Defaults to $::os_service_default. # # [*object_chunk_size*] -# (optional) Chunk size to read from object servers. -# Default to 65536. +# (optional) Chunk size to read from object servers. +# Defaults to $::os_service_default. # # [*client_chunk_size*] -# (optional) Chunk size to read from clients. -# Default to 65536. +# (optional) Chunk size to read from clients. +# Defaults to $::os_service_default. # # [*max_containers_per_account*] # (optional) If set to a positive value, will limit container number per account. @@ -170,13 +170,13 @@ class swift::proxy( $log_address = '/dev/log', $log_level = 'INFO', $log_facility = 'LOG_LOCAL2', - $log_handoffs = true, + $log_handoffs = $::os_service_default, $log_name = 'proxy-server', $cors_allow_origin = undef, $strict_cors_mode = true, - $object_chunk_size = 65536, - $client_chunk_size = 65536, - $max_containers_per_account = 0, + $object_chunk_size = $::os_service_default, + $client_chunk_size = $::os_service_default, + $max_containers_per_account = $::os_service_default, $max_containers_whitelist = $::os_service_default, $read_affinity = undef, $write_affinity = undef, diff --git a/spec/classes/swift_proxy_spec.rb b/spec/classes/swift_proxy_spec.rb index f87ed2b9..f7766372 100644 --- a/spec/classes/swift_proxy_spec.rb +++ b/spec/classes/swift_proxy_spec.rb @@ -69,12 +69,12 @@ describe 'swift::proxy' do it { should contain_swift_proxy_config('app:proxy-server/set log_facility').with_value('LOG_LOCAL2') } it { should contain_swift_proxy_config('app:proxy-server/set log_level').with_value('INFO') } it { should contain_swift_proxy_config('app:proxy-server/set log_address').with_value('/dev/log') } - it { should contain_swift_proxy_config('app:proxy-server/log_handoffs').with_value('true') } - it { should contain_swift_proxy_config('app:proxy-server/object_chunk_size').with_value('65536') } - it { should contain_swift_proxy_config('app:proxy-server/client_chunk_size').with_value('65536') } + it { should contain_swift_proxy_config('app:proxy-server/log_handoffs').with_value('') } + it { should contain_swift_proxy_config('app:proxy-server/object_chunk_size').with_value('') } + it { should contain_swift_proxy_config('app:proxy-server/client_chunk_size').with_value('') } it { should contain_swift_proxy_config('app:proxy-server/allow_account_management').with_value('true') } it { should contain_swift_proxy_config('app:proxy-server/account_autocreate').with_value('true') } - it { should contain_swift_proxy_config('app:proxy-server/max_containers_per_account').with_value(0) } + it { should contain_swift_proxy_config('app:proxy-server/max_containers_per_account').with_value('') } it { should contain_swift_proxy_config('app:proxy-server/max_containers_whitelist').with_value('') } it { should contain_service('swift-proxy-server').with_require([ @@ -158,7 +158,7 @@ describe 'swift::proxy' do it { should contain_swift_proxy_config('app:proxy-server/set log_facility').with_value('LOG_LOCAL2') } it { should contain_swift_proxy_config('app:proxy-server/set log_level').with_value('DEBUG') } it { should contain_swift_proxy_config('app:proxy-server/set log_address').with_value('/dev/log') } - it { should contain_swift_proxy_config('app:proxy-server/log_handoffs').with_value('true') } + it { should contain_swift_proxy_config('app:proxy-server/log_handoffs').with_value('') } it { should contain_swift_proxy_config('app:proxy-server/object_chunk_size').with_value('8192') } it { should contain_swift_proxy_config('app:proxy-server/client_chunk_size').with_value('8192') } it { should contain_swift_proxy_config('app:proxy-server/allow_account_management').with_value('false') } @@ -211,6 +211,7 @@ describe 'swift::proxy' do :log_name => 'swift-proxy-server', :log_udp_host => '127.0.0.1', :log_udp_port => '514', + :log_handoffs => true, :read_affinity => 'r1z1=100, r1=200', :write_affinity => 'r1', :write_affinity_node_count => '2 * replicas',