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: Ifdb5c7b3f590431aaa7ffc021cdee34899ac8c15
Partial-Bug: #1195915
This commit is contained in:
Andy McCrae 2014-01-15 10:43:05 +00:00
parent 52dd20137d
commit 3fd80c0a3f
7 changed files with 15 additions and 17 deletions

View File

@ -93,7 +93,7 @@ default['openstack']['block-storage']['mq']['qpid']['tcp_nodelay'] = true
# This user's password is stored in an encrypted databag
# and accessed with openstack-common cookbook library's
# user_password routine. You are expected to create
# get_password routine. You are expected to create
# the user, pass, vhost in a wrapper rabbitmq cookbook.
default['openstack']['block-storage']['rabbit']['username'] = 'guest'
default['openstack']['block-storage']['rabbit']['vhost'] = '/'

View File

@ -60,7 +60,7 @@ end
identity_endpoint = endpoint "identity-api"
identity_admin_endpoint = endpoint "identity-admin"
service_pass = service_password "openstack-block-storage"
service_pass = get_password "service", "openstack-block-storage"
execute "cinder-manage db sync"

View File

@ -32,14 +32,14 @@ platform_options["cinder_common_packages"].each do |pkg|
end
db_user = node["openstack"]["block-storage"]["db"]["username"]
db_pass = db_password "cinder"
db_pass = get_password "db", "cinder"
sql_connection = db_uri("volume", db_user, db_pass)
if node["openstack"]["block-storage"]["mq"]["service_type"] == "rabbitmq"
if node["openstack"]["block-storage"]["rabbit"]["ha"]
rabbit_hosts = rabbit_servers
end
rabbit_pass = user_password node["openstack"]["block-storage"]["rabbit"]["username"]
rabbit_pass = get_password "user", node["openstack"]["block-storage"]["rabbit"]["username"]
end
glance_api_endpoint = endpoint "image-api"

View File

@ -30,7 +30,7 @@ identity_admin_endpoint = endpoint "identity-admin"
bootstrap_token = secret "secrets", "openstack_identity_bootstrap_token"
auth_uri = ::URI.decode identity_admin_endpoint.to_s
cinder_api_endpoint = endpoint "volume-api"
service_pass = service_password "openstack-block-storage"
service_pass = get_password "service", "openstack-block-storage"
region = node["openstack"]["block-storage"]["region"]
service_tenant_name = node["openstack"]["block-storage"]["service_tenant_name"]
service_user = node["openstack"]["block-storage"]["service_user"]

View File

@ -53,13 +53,13 @@ end
case node["openstack"]["block-storage"]["volume"]["driver"]
when "cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver"
node.override["openstack"]["block-storage"]["netapp"]["dfm_password"] = service_password "netapp"
node.override["openstack"]["block-storage"]["netapp"]["dfm_password"] = get_password "service", "netapp"
when "cinder.volume.drivers.RBDDriver"
node.override["openstack"]["block-storage"]["rbd_secret_uuid"] = service_password "rbd"
node.override["openstack"]["block-storage"]["rbd_secret_uuid"] = get_password "service", "rbd"
when "cinder.volume.drivers.netapp.nfs.NetAppDirect7modeNfsDriver"
node.override["openstack"]["block-storage"]["netapp"]["netapp_server_password"] = service_password "netapp-filer"
node.override["openstack"]["block-storage"]["netapp"]["netapp_server_password"] = get_password "service", "netapp-filer"
directory node["openstack"]["block-storage"]["nfs"]["mount_point_base"] do
owner node["openstack"]["block-storage"]["user"]

View File

@ -27,17 +27,15 @@ require_relative "support/matcher"
def block_storage_stubs
::Chef::Recipe.any_instance.stub(:rabbit_servers)
.and_return "1.1.1.1:5672,2.2.2.2:5672"
::Chef::Recipe.any_instance.stub(:get_password).and_return ''
::Chef::Recipe.any_instance.stub(:secret)
.with("secrets", "openstack_identity_bootstrap_token")
.and_return "bootstrap-token"
::Chef::Recipe.any_instance.stub(:db_password).and_return ''
::Chef::Recipe.any_instance.stub(:user_password).and_return ''
::Chef::Recipe.any_instance.stub(:user_password)
.with("guest")
::Chef::Recipe.any_instance.stub(:get_password)
.with("user", "guest")
.and_return "rabbit-pass"
::Chef::Recipe.any_instance.stub(:service_password).and_return ''
::Chef::Recipe.any_instance.stub(:service_password)
.with("openstack-block-storage")
::Chef::Recipe.any_instance.stub(:get_password)
.with("service", "openstack-block-storage")
.and_return "cinder-pass"
::Chef::Application.stub(:fatal!)
end

View File

@ -64,7 +64,7 @@ describe "openstack-block-storage::volume" do
end
it "configures netapp dfm password" do
::Chef::Recipe.any_instance.stub(:service_password).with("netapp")
::Chef::Recipe.any_instance.stub(:get_password).with("service", "netapp")
.and_return "netapp-pass"
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver"
@ -76,7 +76,7 @@ describe "openstack-block-storage::volume" do
end
it "configures rbd password" do
::Chef::Recipe.any_instance.stub(:service_password).with("rbd")
::Chef::Recipe.any_instance.stub(:get_password).with("service", "rbd")
.and_return "rbd-pass"
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.RBDDriver"