Allow verifying project id of quota definitions
This change introduces some parameters to enable verification of the given project id while updating quota definitions. Change-Id: If45d66fa2f0bc13a77fa95ba2995ae0118f79ac6
This commit is contained in:
parent
ed1edfce77
commit
da4b2f7030
@ -84,6 +84,11 @@
|
||||
# (optional) Admin API extensions.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*quotas_verify_project_id*]
|
||||
# (Optional) Verify that the requested Project ID for quota target is
|
||||
# a valid project in Keystone.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*enable_proxy_headers_parsing*]
|
||||
# (Optional) Enable paste middleware to handle SSL requests through
|
||||
# HTTPProxyToWSGI middleware.
|
||||
@ -117,6 +122,7 @@ class designate::api (
|
||||
$pecan_debug = $::os_service_default,
|
||||
$enabled_extensions_v2 = $::os_service_default,
|
||||
$enabled_extensions_admin = $::os_service_default,
|
||||
$quotas_verify_project_id = $::os_service_default,
|
||||
$enable_proxy_headers_parsing = $::os_service_default,
|
||||
$service_name = $::designate::params::api_service_name,
|
||||
) inherits designate {
|
||||
@ -141,6 +147,7 @@ class designate::api (
|
||||
'service:api/pecan_debug' : value => $pecan_debug;
|
||||
'service:api/enabled_extensions_v2' : value => join(any2array($enabled_extensions_v2), ',');
|
||||
'service:api/enabled_extensions_admin' : value => join(any2array($enabled_extensions_admin), ',');
|
||||
'service:api/quotas_verify_project_id' : value => $quotas_verify_project_id;
|
||||
}
|
||||
|
||||
if $auth_strategy == 'keystone' {
|
||||
|
73
manifests/keystone.pp
Normal file
73
manifests/keystone.pp
Normal file
@ -0,0 +1,73 @@
|
||||
# == Class: designate::keystone
|
||||
#
|
||||
# Configures [keystone] parameters of designate.conf
|
||||
#
|
||||
# === Parameters:
|
||||
#
|
||||
# [*timeout*]
|
||||
# (Optional) Timeout value for connecting to keystone in seconds.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*service_type*]
|
||||
# (Optional) The default service_type for endpoint URL discovery.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*valid_interfaces*]
|
||||
# (Optional) List of interfaces, in order of preference for endpoint URL.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*endpoint_override*]
|
||||
# (Optional) Always use this endpoint URL for requests for this client.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*region_name*]
|
||||
# (Optional) Region name for connecting to keystone in admin context
|
||||
# through the OpenStack Identity service.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*connect_retries*]
|
||||
# (Optional) The maximum number o retries that should be attempted for
|
||||
# connection errors.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*connect_retry_delay*]
|
||||
# (Optional) Delay (in seconds) between two retries that should be attempted
|
||||
# for connection errors.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*status_code_retries*]
|
||||
# (Optional) The maximum number of retries that should be attempted for
|
||||
# retriable HTTP status codes.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
# [*status_code_retry_delay*]
|
||||
# (Optional) Delay (in seconds) between two retries for retriable status
|
||||
# codes.
|
||||
# Defaults to $::os_service_default
|
||||
#
|
||||
class designate::keystone (
|
||||
$timeout = $::os_service_default,
|
||||
$service_type = $::os_service_default,
|
||||
$valid_interfaces = $::os_service_default,
|
||||
$endpoint_override = $::os_service_default,
|
||||
$region_name = $::os_service_default,
|
||||
$connect_retries = $::os_service_default,
|
||||
$connect_retry_delay = $::os_service_default,
|
||||
$status_code_retries = $::os_service_default,
|
||||
$status_code_retry_delay = $::os_service_default,
|
||||
) {
|
||||
|
||||
include designate::deps
|
||||
|
||||
designate_config {
|
||||
'keystone/timeout': value => $timeout;
|
||||
'keystone/service_type': value => $service_type;
|
||||
'keystone/valid_interfaces': value => join(any2array($valid_interfaces), ',');
|
||||
'keystone/endpoint_override': value => $endpoint_override;
|
||||
'keystone/region_name': value => $region_name;
|
||||
'keystone/connect_retries': value => $connect_retries;
|
||||
'keystone/connect_retry_delay': value => $connect_retry_delay;
|
||||
'keystone/status_code_retries': value => $status_code_retries;
|
||||
'keystone/status_code_retry_delay': value => $status_code_retry_delay;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
The new ``designate::api::quotas_verify_project_id`` parameter has been
|
||||
added.
|
||||
|
||||
- |
|
||||
The new ``designate::keystone`` class has been added.
|
@ -48,6 +48,7 @@ describe 'designate::api' do
|
||||
is_expected.to contain_designate_config('service:api/pecan_debug').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_designate_config('service:api/enabled_extensions_v2').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_designate_config('service:api/enabled_extensions_admin').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_designate_config('service:api/quotas_verify_project_id').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to_not contain_designate__keystone__authtoken('designate_config')
|
||||
is_expected.to contain_oslo__middleware('designate_config').with(
|
||||
:enable_proxy_headers_parsing => '<SERVICE DEFAULT>'
|
||||
@ -74,6 +75,7 @@ describe 'designate::api' do
|
||||
:pecan_debug => true,
|
||||
:enabled_extensions_v2 => 'ext1,ext2',
|
||||
:enabled_extensions_admin => 'reports,quotas,zones',
|
||||
:quotas_verify_project_id => false,
|
||||
:enable_proxy_headers_parsing => true,
|
||||
})
|
||||
end
|
||||
@ -95,6 +97,7 @@ describe 'designate::api' do
|
||||
is_expected.to contain_designate_config('service:api/pecan_debug').with_value(params[:pecan_debug])
|
||||
is_expected.to contain_designate_config('service:api/enabled_extensions_v2').with_value(params[:enabled_extensions_v2])
|
||||
is_expected.to contain_designate_config('service:api/enabled_extensions_admin').with_value(params[:enabled_extensions_admin])
|
||||
is_expected.to contain_designate_config('service:api/quotas_verify_project_id').with_value(false)
|
||||
is_expected.to contain_oslo__middleware('designate_config').with(
|
||||
:enable_proxy_headers_parsing => params[:enable_proxy_headers_parsing]
|
||||
)
|
||||
|
60
spec/classes/designate_keystone_spec.rb
Normal file
60
spec/classes/designate_keystone_spec.rb
Normal file
@ -0,0 +1,60 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'designate::keystone' do
|
||||
shared_examples 'designate::keystone' do
|
||||
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
context 'with required parameters' do
|
||||
it 'configures keystone in designate.conf' do
|
||||
should contain_designate_config('keystone/timeout').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/service_type').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/valid_interfaces').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/endpoint_override').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/region_name').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/connect_retries').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/connect_retry_delay').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/status_code_retries').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/status_code_retry_delay').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters' do
|
||||
before do
|
||||
params.merge!({
|
||||
:timeout => 60,
|
||||
:service_type => 'identity',
|
||||
:valid_interfaces => ['internal', 'public'],
|
||||
:endpoint_override => 'http://10.0.0.11:5000/',
|
||||
:region_name => 'RegionOne',
|
||||
})
|
||||
end
|
||||
|
||||
it 'configures keystone in designate.conf' do
|
||||
should contain_designate_config('keystone/timeout').with_value(60)
|
||||
should contain_designate_config('keystone/service_type').with_value('identity')
|
||||
should contain_designate_config('keystone/valid_interfaces').with_value('internal,public')
|
||||
should contain_designate_config('keystone/endpoint_override').with_value('http://10.0.0.11:5000/')
|
||||
should contain_designate_config('keystone/region_name').with_value('RegionOne')
|
||||
should contain_designate_config('keystone/connect_retries').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/connect_retry_delay').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/status_code_retries').with_value('<SERVICE DEFAULT>')
|
||||
should contain_designate_config('keystone/status_code_retry_delay').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
|
||||
|
||||
it_behaves_like 'designate::keystone'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user