Add oslo.middleware defines
This patch aims to add defines related to oslo.middleware. oslo.middleware has three sections by now: - oslo_middleware - cors Co-Authored-By: Alex Schultz <aschultz@mirantis.com> Change-Id: Ib9e2936c589ed6d35fe93f962c6e154b56fa2122
This commit is contained in:
parent
32b8e5d164
commit
cafe848a0a
60
manifests/cors.pp
Normal file
60
manifests/cors.pp
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# == Define: oslo::cors
|
||||||
|
#
|
||||||
|
# Configure oslo_middleware options in cors section
|
||||||
|
#
|
||||||
|
# This resource configures oslo.middleware cors resources for an OpenStack
|
||||||
|
# service. It will manage the [cors]/[cors.$subdomain] section in the given config resource.
|
||||||
|
#
|
||||||
|
# === Parameters:
|
||||||
|
#
|
||||||
|
# [*allowed_origin*]
|
||||||
|
# (Optional) Indicate whether this resource may be shared with the domain
|
||||||
|
# received in the requests "origin" header.
|
||||||
|
# (string value)
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*allow_credentials*]
|
||||||
|
# (Optional) Indicate that the actual request can include user credentials.
|
||||||
|
# (boolean value)
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*expose_headers*]
|
||||||
|
# (Optional) Indicate which headers are safe to expose to the API.
|
||||||
|
# (list value)
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*max_age*]
|
||||||
|
# (Optional) Maximum cache age of CORS preflight requests.
|
||||||
|
# (integer value)
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*allow_methods*]
|
||||||
|
# (Optional) Indicate which methods can be used during the actual request.
|
||||||
|
# (list value)
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
# [*allow_headers*]
|
||||||
|
# (Optional) Indicate which header field names may be used during the actual
|
||||||
|
# request.
|
||||||
|
# (list value)
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
define oslo::cors(
|
||||||
|
$allowed_origin = $::os_service_default,
|
||||||
|
$allow_credentials = $::os_service_default,
|
||||||
|
$expose_headers = $::os_service_default,
|
||||||
|
$max_age = $::os_service_default,
|
||||||
|
$allow_methods = $::os_service_default,
|
||||||
|
$allow_headers = $::os_service_default,
|
||||||
|
) {
|
||||||
|
|
||||||
|
$cors_options = {
|
||||||
|
'cors/allowed_origin' => { value => $allowed_origin },
|
||||||
|
'cors/allow_credentials' => { value => $allow_credentials },
|
||||||
|
'cors/expose_headers' => { value => $expose_headers },
|
||||||
|
'cors/max_age' => { value => $max_age },
|
||||||
|
'cors/allow_methods' => { value => $allow_methods },
|
||||||
|
'cors/allow_headers' => { value => $allow_headers }
|
||||||
|
}
|
||||||
|
create_resources($name, $cors_options)
|
||||||
|
}
|
22
manifests/middleware.pp
Normal file
22
manifests/middleware.pp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
# == Define: oslo::middleware
|
||||||
|
#
|
||||||
|
# Configure oslo_middleware options
|
||||||
|
#
|
||||||
|
# This resource configures oslo.middleware resources for an OpenStack service.
|
||||||
|
# It will manage the [oslo_middleware] section in the given config resource.
|
||||||
|
#
|
||||||
|
# === Parameters:
|
||||||
|
#
|
||||||
|
# [*max_request_body_size*]
|
||||||
|
# (Optional) Make exception message format errors fatal.
|
||||||
|
# (integer value)
|
||||||
|
# Defaults to $::os_service_default.
|
||||||
|
#
|
||||||
|
define oslo::middleware(
|
||||||
|
$max_request_body_size = $::os_service_default,
|
||||||
|
) {
|
||||||
|
$middleware_options = {
|
||||||
|
'oslo_middleware/max_request_body_size' => { value => $max_request_body_size }
|
||||||
|
}
|
||||||
|
create_resources($name, $middleware_options)
|
||||||
|
}
|
33
spec/defines/oslo_cors_spec.rb
Normal file
33
spec/defines/oslo_cors_spec.rb
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'oslo::cors' do
|
||||||
|
|
||||||
|
let (:title) { 'keystone_config' }
|
||||||
|
|
||||||
|
shared_examples 'shared examples' do
|
||||||
|
|
||||||
|
context 'with default parameters' do
|
||||||
|
it 'configure cors default params' do
|
||||||
|
is_expected.to contain_keystone_config('cors/allowed_origin').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_keystone_config('cors/allow_credentials').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_keystone_config('cors/expose_headers').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_keystone_config('cors/max_age').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_keystone_config('cors/allow_methods').with_value('<SERVICE DEFAULT>')
|
||||||
|
is_expected.to contain_keystone_config('cors/allow_headers').with_value('<SERVICE DEFAULT>')
|
||||||
|
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
|
||||||
|
|
||||||
|
include_examples 'shared examples'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
39
spec/defines/oslo_middleware_spec.rb
Normal file
39
spec/defines/oslo_middleware_spec.rb
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
require 'spec_helper'
|
||||||
|
|
||||||
|
describe 'oslo::middleware' do
|
||||||
|
|
||||||
|
let (:title) { 'keystone_config' }
|
||||||
|
|
||||||
|
shared_examples 'shared examples' do
|
||||||
|
|
||||||
|
context 'with default parameters' do
|
||||||
|
it 'configure oslo_middleware default params' do
|
||||||
|
is_expected.to contain_keystone_config('oslo_middleware/max_request_body_size').with_value('<SERVICE DEFAULT>')
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with overridden parameters' do
|
||||||
|
let :params do
|
||||||
|
{ :max_request_body_size => 114600,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
it 'configure oslo_middleware with overriden values' do
|
||||||
|
is_expected.to contain_keystone_config('oslo_middleware/max_request_body_size').with_value(114600)
|
||||||
|
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
|
||||||
|
|
||||||
|
include_examples 'shared examples'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user