Add support for audit middleware options
Change-Id: Ic65828ddf8a8631e5ce1db56cd50aeda3eeb9656
This commit is contained in:
33
manifests/audit.pp
Normal file
33
manifests/audit.pp
Normal file
@@ -0,0 +1,33 @@
|
||||
# == Class: octavia::audit
|
||||
#
|
||||
# Configure audit middleware options
|
||||
#
|
||||
# == Params
|
||||
#
|
||||
# [*enabled*]
|
||||
# (Optional) Enable auditing of API requests
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*audit_map_file*]
|
||||
# (Optional) Path to audit map file for octavia-api service.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*ignore_req_list*]
|
||||
# (Optional) Comma separated list of octavia REST API HTTP methods
|
||||
# to be ignored during audit logging.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class octavia::audit (
|
||||
$enabled = $::os_service_default,
|
||||
$audit_map_file = $::os_service_default,
|
||||
$ignore_req_list = $::os_service_default,
|
||||
) {
|
||||
|
||||
include octavia::deps
|
||||
|
||||
octavia_config {
|
||||
'audit/enabled': value => $enabled;
|
||||
'audit/audit_map_file': value => $audit_map_file;
|
||||
'audit/ignore_req_list': value => join(any2array($ignore_req_list), ',');
|
||||
}
|
||||
}
|
||||
5
releasenotes/notes/audit-opts-1cb6a5b4058f8469.yaml
Normal file
5
releasenotes/notes/audit-opts-1cb6a5b4058f8469.yaml
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``octavia::audit`` class has been added. This class manages options
|
||||
of the audit middleware.
|
||||
60
spec/classes/octavia_audit_spec.rb
Normal file
60
spec/classes/octavia_audit_spec.rb
Normal file
@@ -0,0 +1,60 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'ironic::audit' do
|
||||
|
||||
shared_examples_for 'ironic::audit' do
|
||||
|
||||
context 'with default parameters' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
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>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with specific parameters' do
|
||||
let :params do
|
||||
{
|
||||
:enabled => true,
|
||||
:audit_map_file => '/etc/ironic/api_audit_map.conf',
|
||||
: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
|
||||
{
|
||||
: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
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_configures 'ironic::audit'
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user