Use get_password method to obtain qpid password

Currently, qpid's password is stored in an attribute in the common
cookbook.  This change causes the password to be looked up via
get_password method, which is how we obtain the rabbitmq password.

Change-Id: Ia617f406041da7d03867be5b347fdbb52e1fb2e3
Implements: blueprint use-data-bag-for-qpid-password
This commit is contained in:
Matt Thompson 2014-03-06 14:26:23 +00:00
parent 4fff740949
commit a619d75301
3 changed files with 13 additions and 8 deletions

View File

@ -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,

View File

@ -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'

View File

@ -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)