Add support for read_only middleware
Change-Id: I82726ab76587a134f9267521821b48e8a1a05936
This commit is contained in:
parent
0e3f254347
commit
1b5eceeb36
27
manifests/proxy/read_only.pp
Normal file
27
manifests/proxy/read_only.pp
Normal file
@ -0,0 +1,27 @@
|
||||
# == Class: swift::proxy::read_only
|
||||
#
|
||||
# Configure read_only middleware
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*read_only*]
|
||||
# (optional) Turn on global read only.
|
||||
# Defauls to $facts['os_service_default']
|
||||
#
|
||||
# [*allow_deletes*]
|
||||
# (optional) Allow deletes.
|
||||
# Defauls to $facts['os_service_default']
|
||||
#
|
||||
class swift::proxy::read_only(
|
||||
$read_only = $facts['os_service_default'],
|
||||
$allow_deletes = $facts['os_service_default']
|
||||
) {
|
||||
|
||||
include swift::deps
|
||||
|
||||
swift_proxy_config {
|
||||
'filter:read_only/use': value => 'egg:swift#read_only';
|
||||
'filter:read_only/read_only': value => $read_only;
|
||||
'filter:read_only/allow_deletes': value => $allow_deletes;
|
||||
}
|
||||
}
|
4
releasenotes/notes/read_only-f0e5b52bfcbbe99d.yaml
Normal file
4
releasenotes/notes/read_only-f0e5b52bfcbbe99d.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``swift::proxy::read_only`` class has been added.
|
36
spec/classes/swift_proxy_read_only_spec.rb
Normal file
36
spec/classes/swift_proxy_read_only_spec.rb
Normal file
@ -0,0 +1,36 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'swift::proxy::read_only' do
|
||||
shared_examples 'swift::proxy::read_only' do
|
||||
context 'when using default parameters' do
|
||||
it { is_expected.to contain_swift_proxy_config('filter:read_only/use').with_value('egg:swift#read_only') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:read_only/read_only').with_value('<SERVICE DEFAULT>') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:read_only/allow_deletes').with_value('<SERVICE DEFAULT>') }
|
||||
end
|
||||
|
||||
context 'when overriding default parameters' do
|
||||
let :params do
|
||||
{
|
||||
:read_only => true,
|
||||
:allow_deletes => false,
|
||||
}
|
||||
end
|
||||
|
||||
it { is_expected.to contain_swift_proxy_config('filter:read_only/use').with_value('egg:swift#read_only') }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:read_only/read_only').with_value(true) }
|
||||
it { is_expected.to contain_swift_proxy_config('filter:read_only/allow_deletes').with_value(false) }
|
||||
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::read_only'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user