From d0b20eb5d986d3f424916b899a9232deb1a365bc Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 4 Dec 2023 15:22:52 +0900 Subject: [PATCH] Drop redundant default of cache_tls_enabled The tls_enabled option defaults to false, so we don't have to make the class parameter default to false explicitly but can use the service default. Change-Id: I023855904460280e86073c0301e420255b25e6f2 --- manifests/containerreconciler.pp | 4 ++-- manifests/internal_client/cache.pp | 16 ++++++++-------- manifests/objectexpirer.pp | 16 ++++++++-------- manifests/proxy/cache.pp | 16 ++++++++-------- spec/classes/swift_containerreconciler_spec.rb | 2 +- spec/classes/swift_internal_client_cache_spec.rb | 5 ++++- spec/classes/swift_objectexpirer_spec.rb | 8 +++++++- spec/classes/swift_proxy_cache_spec.rb | 5 ++++- 8 files changed, 42 insertions(+), 30 deletions(-) diff --git a/manifests/containerreconciler.pp b/manifests/containerreconciler.pp index bc708e4b..766f1553 100644 --- a/manifests/containerreconciler.pp +++ b/manifests/containerreconciler.pp @@ -51,7 +51,7 @@ # [*cache_tls_enabled*] # (Optional) Global toggle for TLS usage when communicating with # the caching servers. -# Default to false +# Defaults to $facts['os_service_default'] # # [*cache_tls_cafile*] # (Optional) Path to a file of concatenated CA certificates in PEM @@ -84,7 +84,7 @@ class swift::containerreconciler( $request_tries = $facts['os_service_default'], $service_provider = $::swift::params::service_provider, $memcache_servers = ['127.0.0.1:11211'], - $cache_tls_enabled = false, + $cache_tls_enabled = $facts['os_service_default'], $cache_tls_cafile = $facts['os_service_default'], $cache_tls_certfile = $facts['os_service_default'], $cache_tls_keyfile = $facts['os_service_default'], diff --git a/manifests/internal_client/cache.pp b/manifests/internal_client/cache.pp index f529d600..dec679bd 100644 --- a/manifests/internal_client/cache.pp +++ b/manifests/internal_client/cache.pp @@ -7,13 +7,13 @@ # [*tls_enabled*] # (Optional) Global toggle for TLS usage when communicating with # the caching servers. -# Default to false +# Defaults to $facts['os_service_default']. # # [*tls_cafile*] # (Optional) Path to a file of concatenated CA certificates in PEM # format necessary to establish the caching server's authenticity. # If tls_enabled is False, this option is ignored. -# Defaults to undef +# Defaults to $facts['os_service_default']. # # [*tls_certfile*] # (Optional) Path to a single file in PEM format containing the @@ -21,14 +21,14 @@ # needed to establish the certificate's authenticity. This file # is only required when client side authentication is necessary. # If tls_enabled is False, this option is ignored. -# Defaults to undef +# Defaults to $facts['os_service_default']. # # [*tls_keyfile*] # (Optional) Path to a single file containing the client's private # key in. Otherwise the private key will be taken from the file # specified in tls_certfile. If tls_enabled is False, this option # is ignored. -# Defaults to undef +# Defaults to $facts['os_service_default']. # # [*memcache_max_connections*] Sets the maximum number of connections to # each memcached server per worker @@ -49,10 +49,10 @@ # class swift::internal_client::cache( $memcache_servers = ['127.0.0.1:11211'], - $tls_enabled = false, - $tls_cafile = undef, - $tls_certfile = undef, - $tls_keyfile = undef, + $tls_enabled = $facts['os_service_default'], + $tls_cafile = $facts['os_service_default'], + $tls_certfile = $facts['os_service_default'], + $tls_keyfile = $facts['os_service_default'], $memcache_max_connections = '2' ) { diff --git a/manifests/objectexpirer.pp b/manifests/objectexpirer.pp index 75727480..8128b8a7 100644 --- a/manifests/objectexpirer.pp +++ b/manifests/objectexpirer.pp @@ -70,13 +70,13 @@ # [*cache_tls_enabled*] # (Optional) Global toggle for TLS usage when communicating with # the caching servers. -# Default to false +# Defaults to $facts['os_service_default']. # # [*cache_tls_cafile*] # (Optional) Path to a file of concatenated CA certificates in PEM # format necessary to establish the caching server's authenticity. # If tls_enabled is False, this option is ignored. -# Defaults to undef +# Defaults to $facts['os_service_default']. # # [*cache_tls_certfile*] # (Optional) Path to a single file in PEM format containing the @@ -84,14 +84,14 @@ # needed to establish the certificate's authenticity. This file # is only required when client side authentication is necessary. # If tls_enabled is False, this option is ignored. -# Defaults to undef +# Defaults to $facts['os_service_default']. # # [*cache_tls_keyfile*] # (Optional) Path to a single file containing the client's private # key in. Otherwise the private key will be taken from the file # specified in tls_certfile. If tls_enabled is False, this option # is ignored. -# Defaults to undef +# Defaults to $facts['os_service_default']. # # [*log_level*] # (optional) Log level. @@ -116,10 +116,10 @@ class swift::objectexpirer( $report_interval = $facts['os_service_default'], $service_provider = $::swift::params::service_provider, $memcache_servers = ['127.0.0.1:11211'], - $cache_tls_enabled = false, - $cache_tls_cafile = undef, - $cache_tls_certfile = undef, - $cache_tls_keyfile = undef, + $cache_tls_enabled = $facts['os_service_default'], + $cache_tls_cafile = $facts['os_service_default'], + $cache_tls_certfile = $facts['os_service_default'], + $cache_tls_keyfile = $facts['os_service_default'], $log_level = 'INFO', $log_facility = 'LOG_LOCAL2', ) inherits swift::params { diff --git a/manifests/proxy/cache.pp b/manifests/proxy/cache.pp index f4b5f007..ecb4c841 100644 --- a/manifests/proxy/cache.pp +++ b/manifests/proxy/cache.pp @@ -7,13 +7,13 @@ # [*tls_enabled*] # (Optional) Global toggle for TLS usage when communicating with # the caching servers. -# Default to false +# Default to $facts['os_service_default'] # # [*tls_cafile*] # (Optional) Path to a file of concatenated CA certificates in PEM # format necessary to establish the caching server's authenticity. # If tls_enabled is False, this option is ignored. -# Defaults to undef +# Default to $facts['os_service_default'] # # [*tls_certfile*] # (Optional) Path to a single file in PEM format containing the @@ -21,14 +21,14 @@ # needed to establish the certificate's authenticity. This file # is only required when client side authentication is necessary. # If tls_enabled is False, this option is ignored. -# Defaults to undef +# Default to $facts['os_service_default'] # # [*tls_keyfile*] # (Optional) Path to a single file containing the client's private # key in. Otherwise the private key will be taken from the file # specified in tls_certfile. If tls_enabled is False, this option # is ignored. -# Defaults to undef +# Default to $facts['os_service_default'] # # [*memcache_max_connections*] Sets the maximum number of connections to # each memcached server per worker @@ -49,10 +49,10 @@ # class swift::proxy::cache( $memcache_servers = ['127.0.0.1:11211'], - $tls_enabled = false, - $tls_cafile = undef, - $tls_certfile = undef, - $tls_keyfile = undef, + $tls_enabled = $facts['os_service_default'], + $tls_cafile = $facts['os_service_default'], + $tls_certfile = $facts['os_service_default'], + $tls_keyfile = $facts['os_service_default'], $memcache_max_connections = '2' ) { diff --git a/spec/classes/swift_containerreconciler_spec.rb b/spec/classes/swift_containerreconciler_spec.rb index 7d7c019b..98bdaff0 100644 --- a/spec/classes/swift_containerreconciler_spec.rb +++ b/spec/classes/swift_containerreconciler_spec.rb @@ -76,7 +76,7 @@ describe 'swift::containerreconciler' do is_expected.to contain_swift_container_reconciler_config( 'filter:cache/memcache_servers').with_value('127.0.0.1:11211') is_expected.to contain_swift_container_reconciler_config( - 'filter:cache/tls_enabled').with_value(false) + 'filter:cache/tls_enabled').with_value('') is_expected.to contain_swift_container_reconciler_config( 'filter:cache/tls_cafile').with_value('') is_expected.to contain_swift_container_reconciler_config( diff --git a/spec/classes/swift_internal_client_cache_spec.rb b/spec/classes/swift_internal_client_cache_spec.rb index 4971a372..0a202161 100644 --- a/spec/classes/swift_internal_client_cache_spec.rb +++ b/spec/classes/swift_internal_client_cache_spec.rb @@ -22,7 +22,10 @@ describe 'swift::internal_client::cache' do it { is_expected.to contain_swift_internal_client_config('filter:cache/use').with_value('egg:swift#memcache') } it { is_expected.to contain_swift_internal_client_config('filter:cache/memcache_servers').with_value('127.0.0.1:11211') } - it { is_expected.to contain_swift_internal_client_config('filter:cache/tls_enabled').with_value(false) } + it { is_expected.to contain_swift_internal_client_config('filter:cache/tls_enabled').with_value('') } + it { is_expected.to contain_swift_internal_client_config('filter:cache/tls_cafile').with_value('') } + it { is_expected.to contain_swift_internal_client_config('filter:cache/tls_certfile').with_value('') } + it { is_expected.to contain_swift_internal_client_config('filter:cache/tls_keyfile').with_value('') } it { is_expected.to contain_swift_internal_client_config('filter:cache/memcache_max_connections').with_value(2) } end diff --git a/spec/classes/swift_objectexpirer_spec.rb b/spec/classes/swift_objectexpirer_spec.rb index 5ec948ac..5de3553b 100644 --- a/spec/classes/swift_objectexpirer_spec.rb +++ b/spec/classes/swift_objectexpirer_spec.rb @@ -38,7 +38,13 @@ describe 'swift::objectexpirer' do is_expected.to contain_swift_object_expirer_config( 'filter:cache/memcache_servers').with_value('127.0.0.1:11211') is_expected.to contain_swift_object_expirer_config( - 'filter:cache/tls_enabled').with_value(false) + 'filter:cache/tls_enabled').with_value('') + is_expected.to contain_swift_object_expirer_config( + 'filter:cache/tls_cafile').with_value('') + is_expected.to contain_swift_object_expirer_config( + 'filter:cache/tls_certfile').with_value('') + is_expected.to contain_swift_object_expirer_config( + 'filter:cache/tls_keyfile').with_value('') end it 'configures object-expirer service' do diff --git a/spec/classes/swift_proxy_cache_spec.rb b/spec/classes/swift_proxy_cache_spec.rb index 595155c2..8eb7cba1 100644 --- a/spec/classes/swift_proxy_cache_spec.rb +++ b/spec/classes/swift_proxy_cache_spec.rb @@ -22,7 +22,10 @@ describe 'swift::proxy::cache' do it { is_expected.to contain_swift_proxy_config('filter:cache/use').with_value('egg:swift#memcache') } it { is_expected.to contain_swift_proxy_config('filter:cache/memcache_servers').with_value('127.0.0.1:11211') } - it { is_expected.to contain_swift_proxy_config('filter:cache/tls_enabled').with_value(false) } + it { is_expected.to contain_swift_proxy_config('filter:cache/tls_enabled').with_value('') } + it { is_expected.to contain_swift_proxy_config('filter:cache/tls_cafile').with_value('') } + it { is_expected.to contain_swift_proxy_config('filter:cache/tls_certfile').with_value('') } + it { is_expected.to contain_swift_proxy_config('filter:cache/tls_keyfile').with_value('') } it { is_expected.to contain_swift_proxy_config('filter:cache/memcache_max_connections').with_value(2) } end