Use common implementation to manage audit middleware options
Depends-on: https://review.opendev.org/957837 Change-Id: Icff8e7201351666f688374c31d2adac0fbb097cd Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
@@ -9,12 +9,12 @@
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*audit_map_file*]
|
||||
# (Optional) Path to audit map file for ironic-api service.
|
||||
# (Optional) Path to audit map file.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*ignore_req_list*]
|
||||
# (Optional) Comma separated list of Ironic REST API HTTP methods
|
||||
# to be ignored during audit logging.
|
||||
# (Optional) List of REST API HTTP methods to be ignored during audit
|
||||
# logging.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
class ironic::audit (
|
||||
@@ -26,8 +26,11 @@ class ironic::audit (
|
||||
include ironic::deps
|
||||
|
||||
ironic_config {
|
||||
'audit/enabled': value => $enabled;
|
||||
'audit/audit_map_file': value => $audit_map_file;
|
||||
'audit/ignore_req_list': value => join(any2array($ignore_req_list), ',');
|
||||
'audit/enabled': value => $enabled;
|
||||
}
|
||||
|
||||
oslo::audit { 'ironic_config':
|
||||
audit_map_file => $audit_map_file,
|
||||
ignore_req_list => $ignore_req_list,
|
||||
}
|
||||
}
|
||||
|
@@ -11,8 +11,10 @@ describe 'ironic::audit' do
|
||||
|
||||
it 'configures default values' do
|
||||
is_expected.to contain_ironic_config('audit/enabled').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('audit/audit_map_file').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_ironic_config('audit/ignore_req_list').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_oslo__audit('ironic_config').with(
|
||||
:audit_map_file => '<SERVICE DEFAULT>',
|
||||
:ignore_req_list => '<SERVICE DEFAULT>',
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,26 +23,16 @@ describe 'ironic::audit' do
|
||||
{
|
||||
:enabled => true,
|
||||
:audit_map_file => '/etc/ironic/api_audit_map.conf',
|
||||
:ignore_req_list => 'GET,POST',
|
||||
:ignore_req_list => ['GET', 'POST'],
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures specified values' do
|
||||
is_expected.to contain_ironic_config('audit/enabled').with_value(true)
|
||||
is_expected.to contain_ironic_config('audit/audit_map_file').with_value('/etc/ironic/api_audit_map.conf')
|
||||
is_expected.to contain_ironic_config('audit/ignore_req_list').with_value('GET,POST')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with ignore_req_list in array' do
|
||||
let :params do
|
||||
{
|
||||
is_expected.to contain_oslo__audit('ironic_config').with(
|
||||
:audit_map_file => '/etc/ironic/api_audit_map.conf',
|
||||
:ignore_req_list => ['GET', 'POST'],
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures ignore_req_list with a comma separated list' do
|
||||
is_expected.to contain_ironic_config('audit/ignore_req_list').with_value('GET,POST')
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user