Fill sslProfile only when it is defined

Currently when it is not defined the config contains sslProfile: undef which
makes nterior QDR communication malf`unctioning.

Change-Id: I62edac42204b28d9a81789723b331c79aa3358a6
(cherry picked from commit b66ee38e82)
This commit is contained in:
Martin Magr 2019-11-12 10:23:17 +01:00 committed by Martin Mágr
parent 602547e0a6
commit 048561a9fb
2 changed files with 34 additions and 30 deletions

View File

@ -136,17 +136,22 @@ class tripleo::profile::base::metrics::qdr (
if $step >= 1 {
$interior_nodes = any2array(split($interior_mesh_nodes, ','))
if ssl_internal_profile_name {
$node_base = {'sslProfile' => $ssl_internal_profile_name}
} else {
$node_base = {}
}
if $router_mode == 'edge' {
if length($interior_nodes) > 0 {
# ignore explicitly set connectors and connect just to one of the interior nodes (choose randomly)
$all_connectors = [
$all_connectors = [merge($node_base,
{'host' => $interior_nodes[fqdn_rand(length($interior_nodes))],
'port' => '5668',
'role' => 'edge',
'verifyHostname' => false,
'saslMechanisms' => 'ANONYMOUS',
'sslProfile' => $ssl_internal_profile_name}
]
'saslMechanisms' => 'ANONYMOUS'}
)]
} else {
# in case we don't have interior_nodes, eg. we run in all-edge mode
$all_connectors = $connectors
@ -155,21 +160,20 @@ class tripleo::profile::base::metrics::qdr (
$internal_listeners = []
} else {
# provide listener for edge node and listener for other interior nodes (if required)
$edge_listener = {'host' => $listener_addr,
'port' => '5668',
'role' => 'edge',
'authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS',
'sslProfile' => $ssl_internal_profile_name}
$edge_listener = merge($node_base,
{'host' => $listener_addr,
'port' => '5668',
'role' => 'edge',
'authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS'})
if length($interior_nodes) > 1 {
$internal_listeners = [
$edge_listener,
{'host' => $listener_addr,
merge($node_base, {'host' => $listener_addr,
'port' => '5667',
'role' => 'inter-router',
'authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS',
'sslProfile' => $ssl_internal_profile_name}
'saslMechanisms' => 'ANONYMOUS'})
]
# build mesh with other interior nodes
$internal_connectors = $interior_nodes.reduce([]) |$memo, $node| {
@ -178,11 +182,11 @@ class tripleo::profile::base::metrics::qdr (
} elsif true in $memo {
$memo
} else {
$memo << {'host' => $node,
'port' => '5667',
'role' => 'inter-router',
'verifyHostname' => false,
'sslProfile' => $ssl_internal_profile_name}
$memo << merge($node_base,
{'host' => $node,
'port' => '5667',
'role' => 'inter-router',
'verifyHostname' => false})
}
} - true
} else {

View File

@ -123,10 +123,10 @@ describe 'tripleo::profile::base::metrics::qdr' do
it 'should set edge listener, interior listener and no connectors' do
is_expected.to contain_class('qdr').with(
:extra_listeners => [
{'host' => 'node1.example.com','port' => '5668','role' => 'edge','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'},
{'host' => 'node1.example.com','port' => '5667','role' => 'inter-router','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}],
{'sslProfile' => 'sslProfile', 'host' => 'node1.example.com', 'port' => '5668',
'role' => 'edge', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'},
{'sslProfile' => 'sslProfile', 'host' => 'node1.example.com', 'port' => '5667',
'role' => 'inter-router', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}],
:connectors => [],
)
end
@ -148,10 +148,10 @@ describe 'tripleo::profile::base::metrics::qdr' do
it 'should set up edge listener, interior listener and one interior connector to node1' do
is_expected.to contain_class('qdr').with(
:extra_listeners => [
{'host' => 'node2.example.com','port' => '5668','role' => 'edge','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'},
{'host' => 'node2.example.com','port' => '5667','role' => 'inter-router','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}],
{'sslProfile' => 'sslProfile', 'host' => 'node2.example.com', 'port' => '5668',
'role' => 'edge', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'},
{'sslProfile' => 'sslProfile', 'host' => 'node2.example.com', 'port' => '5667',
'role' => 'inter-router', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}],
:connectors => [
{'host' => 'node1.example.com','role' => 'inter-router','port' => '5667',
'verifyHostname' => 'false','sslProfile' => 'sslProfile'}],
@ -175,10 +175,10 @@ describe 'tripleo::profile::base::metrics::qdr' do
it 'should set up edge listener, interior listener and two interior connectors to node1 and node2' do
is_expected.to contain_class('qdr').with(
:extra_listeners => [
{'host' => 'node3.example.com','port' => '5668','role' => 'edge','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'},
{'host' => 'node3.example.com','port' => '5667','role' => 'inter-router','authenticatePeer' => 'no',
'saslMechanisms' => 'ANONYMOUS','sslProfile' => 'sslProfile'}],
{'sslProfile' => 'sslProfile', 'host' => 'node3.example.com', 'port' => '5668',
'role' => 'edge', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'},
{'sslProfile' => 'sslProfile', 'host' => 'node3.example.com', 'port' => '5667',
'role' => 'inter-router', 'authenticatePeer' => 'no', 'saslMechanisms' => 'ANONYMOUS'}],
:connectors => [
{"host"=>"node1.example.com", "role"=>"inter-router", "port"=>"5667",
"verifyHostname" => 'false',"sslProfile" => "sslProfile"},