Move to use "get_password" instead of "{user,service,db}_password"

The user_password, service_password and db_password functions are redundant
since they simply call "secret". Creates a get_password function that will
accept a "type" of db, service or user.

All instances of these calls have been changed to call get_password

Change-Id: Ic73c99034638ec092192d11e37671edbba0e48ef
Partial-Bug: #1195915
This commit is contained in:
Andy McCrae 2014-01-15 12:00:27 +00:00
parent 3bb10f3819
commit fbcfd04ff3
2 changed files with 6 additions and 5 deletions

View File

@ -25,7 +25,7 @@ end
rabbit_server_role = node["openstack"]["mq"]["server_role"]
user = node["openstack"]["mq"]["user"]
pass = user_password user
pass = get_password "user", user
vhost = node["openstack"]["mq"]["vhost"]
bind_interface = node["openstack"]["mq"]["bind_interface"]
listen_address = address_for node["openstack"]["mq"]["bind_interface"]
@ -42,7 +42,7 @@ node.override["rabbitmq"]["use_distro_version"] = true
# Clustering
if node["openstack"]["mq"]["cluster"]
node.override["rabbitmq"]["cluster"] = node["openstack"]["mq"]["cluster"]
node.override["rabbitmq"]["erlang_cookie"] = service_password "rabbit_cookie"
node.override["rabbitmq"]["erlang_cookie"] = get_password "service", "rabbit_cookie"
qs = "roles:#{rabbit_server_role} AND chef_environment:#{node.chef_environment}"
node.override["rabbitmq"]["cluster_disk_nodes"] = search(:node, qs).map do |n|
"#{user}@#{n['hostname']}"

View File

@ -27,9 +27,10 @@ def ops_messaging_stubs
{ 'hostname' => 'host2' },
{ 'hostname' => 'host1' }
]
::Chef::Recipe.any_instance.stub(:user_password).
::Chef::Recipe.any_instance.stub(:get_password).
with("user", anything()).
and_return "rabbit-pass"
::Chef::Recipe.any_instance.stub(:service_password).
with("rabbit_cookie").
::Chef::Recipe.any_instance.stub(:get_password).
with("service", "rabbit_cookie").
and_return "erlang-cookie"
end