Add rmq credentials to each host in proxy

Otherwise it will try to connect with default guest/guest credentials

Change-Id: I097e768afd8783c78caee7aba4ac6600c7e55e47
Closes-bug: #1560055
This commit is contained in:
Kyrylo Galanov
2016-03-25 11:24:08 +01:00
parent 76e1be1657
commit 379d9fc5f5
3 changed files with 7 additions and 3 deletions

View File

@@ -78,6 +78,10 @@ class swift::proxy::ceilometer(
$group = 'ceilometer', $group = 'ceilometer',
) inherits swift { ) inherits swift {
if(is_array($rabbit_hosts)) {
$rabbit_hosts_with_creds = prefix($rabbit_hosts, "${rabbit_user}:${rabbit_password}@")
}
User['swift'] { User['swift'] {
groups +> $group, groups +> $group,
} }

View File

@@ -64,7 +64,7 @@ describe 'swift::proxy::ceilometer' do
it { is_expected.to contain_user('swift').with_groups('www-data') } it { is_expected.to contain_user('swift').with_groups('www-data') }
it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) } it { is_expected.to contain_file(fragment_file).with_content(/[filter:ceilometer]/) }
it { is_expected.to contain_file(fragment_file).with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) } it { is_expected.to contain_file(fragment_file).with_content(/paste.filter_factory = ceilometermiddleware.swift:filter_factory/) }
it { is_expected.to contain_file(fragment_file).with_content(/url = rabbit:\/\/user_1:user_1_passw@127.0.0.1:5672,127.0.0.2:5672\/rabbit/) } it { is_expected.to contain_file(fragment_file).with_content(/url = rabbit:\/\/user_1:user_1_passw@127.0.0.1:5672,user_1:user_1_passw@127.0.0.2:5672\/rabbit/) }
it { is_expected.to contain_file(fragment_file).with_content(/driver = messagingv2/) } it { is_expected.to contain_file(fragment_file).with_content(/driver = messagingv2/) }
it { is_expected.to contain_file(fragment_file).with_content(/topic = notifications/) } it { is_expected.to contain_file(fragment_file).with_content(/topic = notifications/) }
it { is_expected.to contain_file(fragment_file).with_content(/control_exchange = swift/) } it { is_expected.to contain_file(fragment_file).with_content(/control_exchange = swift/) }

View File

@@ -4,8 +4,8 @@ paste.filter_factory = ceilometermiddleware.swift:filter_factory
<% if @rabbit_hosts.nil? %> <% if @rabbit_hosts.nil? %>
url = rabbit://<%= @rabbit_user %>:<%= @rabbit_password %>@<%= @rabbit_host %>:<%= @rabbit_port %>/<%= @rabbit_virtual_host %> url = rabbit://<%= @rabbit_user %>:<%= @rabbit_password %>@<%= @rabbit_host %>:<%= @rabbit_port %>/<%= @rabbit_virtual_host %>
<% else %> <% else %>
<% hosts=Array(@rabbit_hosts).join(",") -%> <% hosts=Array(@rabbit_hosts_with_creds).join(",") -%>
url = rabbit://<%= @rabbit_user %>:<%= @rabbit_password %>@<%= hosts %>/<%= @rabbit_virtual_host %> url = rabbit://<%= hosts %>/<%= @rabbit_virtual_host %>
<% end %> <% end %>
<% if @driver %> <% if @driver %>
driver = <%= @driver %> driver = <%= @driver %>