Browse Source

Merge "Add support for audit middleware"

tags/16.1.0
Zuul Gerrit Code Review 2 weeks ago
parent
commit
e28bb7450a
3 changed files with 69 additions and 0 deletions
  1. +31
    -0
      manifests/proxy/audit.pp
  2. +4
    -0
      releasenotes/notes/add-swift-proxy-audit-3ee76986d46aa9f4.yaml
  3. +34
    -0
      spec/classes/swift_proxy_audit_spec.rb

+ 31
- 0
manifests/proxy/audit.pp View File

@@ -0,0 +1,31 @@
# == Class: swift::proxy::audit
#
# Configure audit middleware for Swift proxy.
#
# === Parameters
#
# [*filter_factory*]
# (Optional) The audit filter factory.
# Defaults to 'keystonemiddleware.audit:filter_factory'
#
# [*audit_map_file*]
# (Optional) The audit map file.
# Defaults to '/etc/pycadf/swift_api_audit_map.conf'
#
# == Authors
#
# Christian Schwede <cschwede@redhat.com>
# Tobias Urdin <tobias.urdin@binero.se>
#
class swift::proxy::audit (
$filter_factory = 'keystonemiddleware.audit:filter_factory',
$audit_map_file = '/etc/pycadf/swift_api_audit_map.conf',
) {

include ::swift::deps

swift_proxy_config {
'filter:audit/paste.filter_factory': value => $filter_factory;
'filter:audit/audit_map_file': value => $audit_map_file;
}
}

+ 4
- 0
releasenotes/notes/add-swift-proxy-audit-3ee76986d46aa9f4.yaml View File

@@ -0,0 +1,4 @@
---
features:
- |
Added swift::proxy::audit class to configure audit middleware for Swift proxy.

+ 34
- 0
spec/classes/swift_proxy_audit_spec.rb View File

@@ -0,0 +1,34 @@
require 'spec_helper'

describe 'swift::proxy::audit' do
shared_examples 'swift::proxy::audit' do
context 'when using default parameters' do
it { is_expected.to contain_swift_proxy_config('filter:audit/paste.filter_factory').with_value('keystonemiddleware.audit:filter_factory') }
it { is_expected.to contain_swift_proxy_config('filter:audit/audit_map_file').with_value('/etc/pycadf/swift_api_audit_map.conf') }
end

context 'when overriding default parameters' do
let :params do
{
:filter_factory => 'keystonemiddleware.audit:some_audit',
:audit_map_file => '/etc/some_audit/some_audit.conf'
}
end

it { is_expected.to contain_swift_proxy_config('filter:audit/paste.filter_factory').with_value('keystonemiddleware.audit:some_audit') }
it { is_expected.to contain_swift_proxy_config('filter:audit/audit_map_file').with_value('/etc/some_audit/some_audit.conf') }
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_behaves_like 'swift::proxy::audit'
end
end
end

Loading…
Cancel
Save