diff --git a/recipes/common.rb b/recipes/common.rb index 4e188a7..1ecac8e 100644 --- a/recipes/common.rb +++ b/recipes/common.rb @@ -71,11 +71,15 @@ if node['openstack']['orchestration']['api']['auth']['version'] != 'v2.0' auth_uri = auth_uri.gsub('/v2.0', '') end -if node['openstack']['mq']['orchestration']['service_type'] == 'rabbitmq' +mq_service_type = node['openstack']['mq']['orchestration']['service_type'] + +if mq_service_type == 'rabbitmq' if node['openstack']['mq']['orchestration']['rabbit']['ha'] rabbit_hosts = rabbit_servers end - rabbit_pass = get_password 'user', node['openstack']['mq']['orchestration']['rabbit']['userid'] + mq_password = get_password 'user', node['openstack']['mq']['orchestration']['rabbit']['userid'] +elsif mq_service_type == 'qpid' + mq_password = get_password 'user', node['openstack']['mq']['orchestration']['qpid']['username'] end directory '/etc/heat' do @@ -104,7 +108,8 @@ template '/etc/heat/heat.conf' do owner node['openstack']['orchestration']['user'] mode 00644 variables( - rabbit_password: rabbit_pass, + mq_service_type: mq_service_type, + mq_password: mq_password, rabbit_hosts: rabbit_hosts, auth_uri: auth_uri, identity_admin_endpoint: identity_admin_endpoint, diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0431b50..a9e334a 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -31,7 +31,7 @@ def orchestration_stubs # rubocop:disable MethodLength .and_return 'heat' ::Chef::Recipe.any_instance.stub(:get_password) .with('user', 'guest') - .and_return 'rabbit-pass' + .and_return 'mq-pass' ::Chef::Recipe.any_instance.stub(:get_password) .with('user', 'admin-user') .and_return 'admin-pass' diff --git a/templates/default/heat.conf.erb b/templates/default/heat.conf.erb index 43efa3d..3b51bf7 100644 --- a/templates/default/heat.conf.erb +++ b/templates/default/heat.conf.erb @@ -357,7 +357,7 @@ rpc_response_timeout=<%= node["openstack"]["orchestration"]["rpc_response_timeou # SSL certification authority file (valid only if SSL enabled) # (string value) #kombu_ssl_ca_certs= -<% if node["openstack"]["mq"]["orchestration"]["service_type"] == "rabbitmq" %> +<% if @mq_service_type == "rabbitmq" %> <% if node["openstack"]["mq"]["orchestration"]["rabbit"]["ha"] -%> rabbit_hosts=<%= @rabbit_hosts %> #### (ListOpt) RabbitMQ HA cluster host:port pairs @@ -382,7 +382,7 @@ rabbit_use_ssl=<%= node["openstack"]["mq"]["orchestration"]["rabbit"]["use_ssl"] rabbit_userid=<%= node["openstack"]["mq"]["orchestration"]["rabbit"]["userid"] %> #### (StrOpt) the RabbitMQ userid -rabbit_password=<%= @rabbit_password %> +rabbit_password=<%= @mq_password %> #### (StrOpt) the RabbitMQ password rabbit_virtual_host=<%= node["openstack"]["mq"]["orchestration"]["rabbit"]["vhost"] %> @@ -410,7 +410,7 @@ rabbit_virtual_host=<%= node["openstack"]["mq"]["orchestration"]["rabbit"]["vhos # # Options defined in heat.openstack.common.rpc.impl_qpid # -<% if node["openstack"]["mq"]["orchestration"]["service_type"] == "qpid" %> +<% if @mq_service_type == "qpid" %> rpc_backend=heat.openstack.common.rpc.impl_qpid @@ -427,7 +427,7 @@ qpid_port=<%= node["openstack"]["mq"]["orchestration"]["qpid"]["port"] %> qpid_username=<%= node["openstack"]["mq"]["orchestration"]["qpid"]["username"] %> # Password for qpid connection (string value) -qpid_password=<%= node["openstack"]["mq"]["orchestration"]["qpid"]["password"] %> +qpid_password=<%= @mq_password %> # Space separated list of SASL mechanisms to use for auth # (string value)