Merge "Add support for [healthcheck] enable_by_file_paths"

This commit is contained in:
Zuul 2024-07-20 18:08:15 +00:00 committed by Gerrit Code Review
commit cf57c9e3df
3 changed files with 21 additions and 0 deletions

View File

@ -32,6 +32,11 @@
# is running on a port. Expects a "port:path" list of strings. # is running on a port. Expects a "port:path" list of strings.
# Defaults to $facts['os_service_default'] # Defaults to $facts['os_service_default']
# #
# [*enable_by_file_paths*]
# (Optional) Check the presence of files. Used by EnableByFilesHealthcheck
# plugin.
# Defaults to $facts['os_service_default']
#
define oslo::healthcheck( define oslo::healthcheck(
$detailed = $facts['os_service_default'], $detailed = $facts['os_service_default'],
$backends = $facts['os_service_default'], $backends = $facts['os_service_default'],
@ -39,11 +44,13 @@ define oslo::healthcheck(
$ignore_proxied_requests = $facts['os_service_default'], $ignore_proxied_requests = $facts['os_service_default'],
$disable_by_file_path = $facts['os_service_default'], $disable_by_file_path = $facts['os_service_default'],
$disable_by_file_paths = $facts['os_service_default'], $disable_by_file_paths = $facts['os_service_default'],
$enable_by_file_paths = $facts['os_service_default'],
) { ) {
$backends_real = join(any2array($backends), ',') $backends_real = join(any2array($backends), ',')
$allowed_source_ranges_real = join(any2array($allowed_source_ranges), ',') $allowed_source_ranges_real = join(any2array($allowed_source_ranges), ',')
$disable_by_file_paths_real = join(any2array($disable_by_file_paths), ',') $disable_by_file_paths_real = join(any2array($disable_by_file_paths), ',')
$enable_by_file_paths_real = join(any2array($enable_by_file_paths), ',')
$healthcheck_options = { $healthcheck_options = {
'healthcheck/detailed' => { value => $detailed }, 'healthcheck/detailed' => { value => $detailed },
@ -52,6 +59,7 @@ define oslo::healthcheck(
'healthcheck/ignore_proxied_requests' => { value => $ignore_proxied_requests }, 'healthcheck/ignore_proxied_requests' => { value => $ignore_proxied_requests },
'healthcheck/disable_by_file_path' => { value => $disable_by_file_path }, 'healthcheck/disable_by_file_path' => { value => $disable_by_file_path },
'healthcheck/disable_by_file_paths' => { value => $disable_by_file_paths_real }, 'healthcheck/disable_by_file_paths' => { value => $disable_by_file_paths_real },
'healthcheck/enable_by_file_paths' => { value => $enable_by_file_paths_real },
} }
create_resources($name, $healthcheck_options) create_resources($name, $healthcheck_options)
} }

View File

@ -0,0 +1,5 @@
---
features:
- |
The new ``oslo::healthcheck::enable_by_file_paths`` parameter has been
added.

View File

@ -18,6 +18,7 @@ describe 'oslo::healthcheck' do
is_expected.to contain_keystone_config('healthcheck/ignore_proxied_requests').with_value('<SERVICE DEFAULT>') is_expected.to contain_keystone_config('healthcheck/ignore_proxied_requests').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('healthcheck/disable_by_file_path').with_value('<SERVICE DEFAULT>') is_expected.to contain_keystone_config('healthcheck/disable_by_file_path').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('healthcheck/disable_by_file_paths').with_value('<SERVICE DEFAULT>') is_expected.to contain_keystone_config('healthcheck/disable_by_file_paths').with_value('<SERVICE DEFAULT>')
is_expected.to contain_keystone_config('healthcheck/enable_by_file_paths').with_value('<SERVICE DEFAULT>')
end end
end end
@ -32,6 +33,10 @@ describe 'oslo::healthcheck' do
'5000:/etc/keystone/healthcheck/public-disabled', '5000:/etc/keystone/healthcheck/public-disabled',
'35357:/etc/keystone/healthcheck/admin-disabled' '35357:/etc/keystone/healthcheck/admin-disabled'
], ],
:enable_by_file_paths => [
'/etc/keystone/healthcheck/enabled0',
'/etc/keystone/healthcheck/enabled1'
],
:ignore_proxied_requests => false, :ignore_proxied_requests => false,
} }
end end
@ -51,6 +56,9 @@ describe 'oslo::healthcheck' do
is_expected.to contain_keystone_config('healthcheck/disable_by_file_paths').with_value( is_expected.to contain_keystone_config('healthcheck/disable_by_file_paths').with_value(
'5000:/etc/keystone/healthcheck/public-disabled,35357:/etc/keystone/healthcheck/admin-disabled' '5000:/etc/keystone/healthcheck/public-disabled,35357:/etc/keystone/healthcheck/admin-disabled'
) )
is_expected.to contain_keystone_config('healthcheck/enable_by_file_paths').with_value(
'/etc/keystone/healthcheck/enabled0,/etc/keystone/healthcheck/enabled1'
)
end end
end end
end end