Configure ratelimit middleware regardless of auth strategy
Technically ratelimit middleware can be used without keystone (for example if basic auth middleware is used). This allows configuring the middleware when a different auth method is used. This also makes sure the unused options are removed. Change-Id: I727b386a07a471598deafc0e29a48f25f8478fc2
This commit is contained in:
parent
c6e82df318
commit
b97d79e08d
@ -153,12 +153,17 @@ server.")
|
||||
'DEFAULT/auth_strategy': value => $auth_strategy;
|
||||
}
|
||||
include manila::keystone::authtoken
|
||||
}
|
||||
|
||||
if ($ratelimits != undef) {
|
||||
manila_api_paste_ini {
|
||||
'filter:ratelimit/paste.filter_factory': value => $ratelimits_factory;
|
||||
'filter:ratelimit/limits': value => $ratelimits;
|
||||
}
|
||||
if $ratelimits != undef {
|
||||
manila_api_paste_ini {
|
||||
'filter:ratelimit/paste.filter_factory': value => $ratelimits_factory;
|
||||
'filter:ratelimit/limits': value => $ratelimits;
|
||||
}
|
||||
} else {
|
||||
manila_api_paste_ini {
|
||||
'filter:ratelimit/paste.filter_factory': ensure => absent;
|
||||
'filter:ratelimit/limits': ensure => absent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,6 +36,8 @@ describe 'manila::api' do
|
||||
)
|
||||
is_expected.to contain_manila_config('DEFAULT/default_share_type').with(:value => '<SERVICE DEFAULT>')
|
||||
is_expected.to contain_manila_config('DEFAULT/osapi_share_workers').with(:value => '2')
|
||||
is_expected.to contain_manila_api_paste_ini('filter:ratelimit/paste.filter_factory').with_ensure('absent')
|
||||
is_expected.to contain_manila_api_paste_ini('filter:ratelimit/limits').with_ensure('absent')
|
||||
end
|
||||
|
||||
it 'should run db sync' do
|
||||
@ -142,6 +144,9 @@ describe 'manila::api' do
|
||||
end
|
||||
|
||||
it { is_expected.to contain_class('manila::policy') }
|
||||
it { is_expected.to contain_manila_api_paste_ini('filter:ratelimit/paste.filter_factory').with(
|
||||
:value => 'manila.api.v1.limits:RateLimitingMiddleware.factory'
|
||||
)}
|
||||
it { is_expected.to contain_manila_api_paste_ini('filter:ratelimit/limits').with(
|
||||
:value => '(GET, "*", .*, 100, MINUTE);(POST, "*", .*, 200, MINUTE)'
|
||||
)}
|
||||
|
Loading…
x
Reference in New Issue
Block a user