Add transport_url handling
Change-Id: I1868473bff4f6e4b91354d8da34d35bf488ab948 Closes-Bug: 1670324
This commit is contained in:
parent
a523491b99
commit
af56ea08c9
@ -6,20 +6,30 @@ $detach_rabbitmq_plugin = hiera($plugin_name, undef)
|
||||
if ($detach_rabbitmq_plugin) {
|
||||
$hiera_plugins_dir = '/etc/hiera/plugins'
|
||||
$plugin_yaml = "${hiera_plugins_dir}/${plugin_name}.yaml"
|
||||
|
||||
$amqp_port = hiera('amqp_port', '5673')
|
||||
$amqp_hosts = hiera('amqp_hosts')
|
||||
|
||||
$network_metadata = hiera_hash('network_metadata')
|
||||
$rabbitmq_roles = [ 'primary-standalone-rabbitmq', 'standalone-rabbitmq' ]
|
||||
$rabbit_nodes = get_nodes_hash_by_roles($network_metadata, $rabbitmq_roles)
|
||||
$rabbitmq_roles = [ 'primary-standalone-rabbitmq', 'standalone-rabbitmq' ]
|
||||
$rabbit_nodes = get_nodes_hash_by_roles($network_metadata, $rabbitmq_roles)
|
||||
|
||||
$rabbit_address_map = get_node_to_ipaddr_map_by_network_role(
|
||||
$rabbit_nodes,
|
||||
'mgmt/messaging'
|
||||
)
|
||||
$rabbit_hash = hiera_hash('rabbit', {})
|
||||
|
||||
$rabbit_nodes_ips = values($rabbit_address_map)
|
||||
$rabbit_nodes_names = keys($rabbit_address_map)
|
||||
if !$rabbit_hash['user'] {
|
||||
$real_rabbit_hash = merge($rabbit_hash, { 'user' => 'nova' })
|
||||
} else {
|
||||
$real_rabbit_hash = $rabbit_hash
|
||||
}
|
||||
|
||||
$amqp_hosts = $rabbit_nodes_ips
|
||||
$amqp_port = hiera('amqp_port', '5673')
|
||||
$rabbit_user = $real_rabbit_hash['user']
|
||||
$rabbit_password = $real_rabbit_hash['password']
|
||||
$transport_url = os_transport_url({
|
||||
'transport' => 'rabbit',
|
||||
'hosts' => strip(split($amqp_hosts,',')),
|
||||
'username' => $rabbit_user,
|
||||
'password' => $rabbit_password,
|
||||
})
|
||||
|
||||
case hiera_array('roles', 'none') {
|
||||
/standalone-rabbitmq/: {
|
||||
@ -36,9 +46,9 @@ if ($detach_rabbitmq_plugin) {
|
||||
|
||||
$calculated_content = inline_template('<%
|
||||
require "yaml"
|
||||
amqp_hosts = @amqp_hosts.map {|x| x + ":" + @amqp_port}.join(",")
|
||||
data = {
|
||||
"amqp_hosts" => amqp_hosts,
|
||||
"amqp_hosts" => @amqp_hosts,
|
||||
"transport_url" => @transport_url,
|
||||
"rabbit" => {
|
||||
"enabled" => @rabbit_enabled,
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user