Add an independent class for [network_api:neutron] parameters
... and improve coverage of the supported parameters. Change-Id: I1c3095561875cfa82e484c69173571ad6ba34428
This commit is contained in:
parent
da4a50abf4
commit
09a2c6b46c
|
@ -106,9 +106,11 @@
|
|||
# (optional) Whether to use durable queues in AMQP.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# DEPRECATED PARAMETERS
|
||||
#
|
||||
# [*neutron_endpoint_type*]
|
||||
# (optional) Endpoint type to use.
|
||||
# Defaults to $::os_service_default.
|
||||
# Defaults to undef
|
||||
#
|
||||
class designate(
|
||||
$package_ensure = present,
|
||||
|
@ -132,7 +134,8 @@ class designate(
|
|||
$notification_topics = 'notifications',
|
||||
$purge_config = false,
|
||||
$amqp_durable_queues = $::os_service_default,
|
||||
$neutron_endpoint_type = $::os_service_default,
|
||||
# DEPRECATED PARAMETERS
|
||||
$neutron_endpoint_type = undef
|
||||
) inherits designate::params {
|
||||
|
||||
if !is_service_default($kombu_ssl_ca_certs) and !$rabbit_use_ssl {
|
||||
|
@ -151,6 +154,11 @@ class designate(
|
|||
|
||||
include designate::deps
|
||||
|
||||
if $neutron_endpoint_type != undef {
|
||||
warning('The neutron_endpoint_type parameter is deprecated. Use the designate::network_api::neutron class.')
|
||||
}
|
||||
include designate::network_api::neutron
|
||||
|
||||
package { 'designate-common':
|
||||
ensure => $package_ensure,
|
||||
name => $common_package_name,
|
||||
|
@ -188,9 +196,8 @@ class designate(
|
|||
|
||||
# default setting
|
||||
designate_config {
|
||||
'DEFAULT/root_helper' : value => $root_helper;
|
||||
'DEFAULT/state_path' : value => $state_path;
|
||||
'network_api:neutron/endpoint_type' : value => $neutron_endpoint_type;
|
||||
'DEFAULT/root_helper': value => $root_helper;
|
||||
'DEFAULT/state_path' : value => $state_path;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
# == Class: designate::network_api::neutron
|
||||
#
|
||||
# Configure the [network_api:neutron] parameters
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*endpoints*]
|
||||
# (Optional) URL to use. Format: <retion>|<url>
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*endpoint_type*]
|
||||
# (Optional) Endpoiint type to use
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
# [*timeout*]
|
||||
# (Optional) Timeout value for connecting to neutorn in seconds.
|
||||
# Defaults to $::os_service_default.
|
||||
#
|
||||
class designate::network_api::neutron (
|
||||
$endpoints = $::os_service_default,
|
||||
$endpoint_type = $::os_service_default,
|
||||
$timeout = $::os_service_default,
|
||||
) {
|
||||
include designate::deps
|
||||
include designate::params
|
||||
|
||||
$endpoint_type_real = pick($::designate::neutron_endpoint_type, $endpoint_type)
|
||||
|
||||
designate_config {
|
||||
'network_api:neutron/endpoints': value => join(any2array($endpoints), ',');
|
||||
'network_api:neutron/endpoint_type': value => $endpoint_type_real;
|
||||
'network_api:neutron/timeout': value => $timeout;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
The new ``designate::network_api::neutron`` class has been added. This
|
||||
class manages parmaeters in the ``[network_api:neutron]`` section.
|
||||
|
||||
deprecations:
|
||||
- |
|
||||
The ``designate::neutron_endpoint_type`` parameter has been deprecated.
|
||||
Use the ``endpoint_type`` parameter of the new
|
||||
``designate::network_api::neutron`` class.
|
|
@ -0,0 +1,60 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe 'designate::network_api::neutron' do
|
||||
shared_examples 'designate::network_api::neutron' do
|
||||
|
||||
context 'with defaults' do
|
||||
let :params do
|
||||
{}
|
||||
end
|
||||
|
||||
it 'configures defaults' do
|
||||
is_expected.to contain_designate_config('network_api:neutron/endpoints').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_designate_config('network_api:neutron/endpoint_type').with_value('<SERVICE DEFAULT>')
|
||||
is_expected.to contain_designate_config('network_api:neutron/timeout').with_value('<SERVICE DEFAULT>')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with parameters set' do
|
||||
let :params do
|
||||
{
|
||||
:endpoints => 'regionOne|http://192.168.1.10:9696,regionTwo|http://192.168.2.10:9696',
|
||||
:endpoint_type => 'internalURL',
|
||||
:timeout => 30,
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures the defined values' do
|
||||
is_expected.to contain_designate_config('network_api:neutron/endpoints').with_value(params[:endpoints])
|
||||
is_expected.to contain_designate_config('network_api:neutron/endpoint_type').with_value(params[:endpoint_type])
|
||||
is_expected.to contain_designate_config('network_api:neutron/timeout').with_value(params[:timeout])
|
||||
end
|
||||
end
|
||||
|
||||
context 'with endpoints in array' do
|
||||
let :params do
|
||||
{
|
||||
:endpoints => ['regionOne|http://192.168.1.10:9696', 'regionTwo|http://192.168.2.10:9696']
|
||||
}
|
||||
end
|
||||
|
||||
it 'configures the endpoints in string' do
|
||||
is_expected.to contain_designate_config('network_api:neutron/endpoints').with_value(
|
||||
'regionOne|http://192.168.1.10:9696,regionTwo|http://192.168.2.10:9696'
|
||||
)
|
||||
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::network_api::neutron'
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue