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:
parent
52dd20137d
commit
3fd80c0a3f
|
@ -93,7 +93,7 @@ default['openstack']['block-storage']['mq']['qpid']['tcp_nodelay'] = true
|
||||||
|
|
||||||
# This user's password is stored in an encrypted databag
|
# This user's password is stored in an encrypted databag
|
||||||
# and accessed with openstack-common cookbook library's
|
# 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.
|
# the user, pass, vhost in a wrapper rabbitmq cookbook.
|
||||||
default['openstack']['block-storage']['rabbit']['username'] = 'guest'
|
default['openstack']['block-storage']['rabbit']['username'] = 'guest'
|
||||||
default['openstack']['block-storage']['rabbit']['vhost'] = '/'
|
default['openstack']['block-storage']['rabbit']['vhost'] = '/'
|
||||||
|
|
|
@ -60,7 +60,7 @@ end
|
||||||
|
|
||||||
identity_endpoint = endpoint "identity-api"
|
identity_endpoint = endpoint "identity-api"
|
||||||
identity_admin_endpoint = endpoint "identity-admin"
|
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"
|
execute "cinder-manage db sync"
|
||||||
|
|
||||||
|
|
|
@ -32,14 +32,14 @@ platform_options["cinder_common_packages"].each do |pkg|
|
||||||
end
|
end
|
||||||
|
|
||||||
db_user = node["openstack"]["block-storage"]["db"]["username"]
|
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)
|
sql_connection = db_uri("volume", db_user, db_pass)
|
||||||
|
|
||||||
if node["openstack"]["block-storage"]["mq"]["service_type"] == "rabbitmq"
|
if node["openstack"]["block-storage"]["mq"]["service_type"] == "rabbitmq"
|
||||||
if node["openstack"]["block-storage"]["rabbit"]["ha"]
|
if node["openstack"]["block-storage"]["rabbit"]["ha"]
|
||||||
rabbit_hosts = rabbit_servers
|
rabbit_hosts = rabbit_servers
|
||||||
end
|
end
|
||||||
rabbit_pass = user_password node["openstack"]["block-storage"]["rabbit"]["username"]
|
rabbit_pass = get_password "user", node["openstack"]["block-storage"]["rabbit"]["username"]
|
||||||
end
|
end
|
||||||
|
|
||||||
glance_api_endpoint = endpoint "image-api"
|
glance_api_endpoint = endpoint "image-api"
|
||||||
|
|
|
@ -30,7 +30,7 @@ identity_admin_endpoint = endpoint "identity-admin"
|
||||||
bootstrap_token = secret "secrets", "openstack_identity_bootstrap_token"
|
bootstrap_token = secret "secrets", "openstack_identity_bootstrap_token"
|
||||||
auth_uri = ::URI.decode identity_admin_endpoint.to_s
|
auth_uri = ::URI.decode identity_admin_endpoint.to_s
|
||||||
cinder_api_endpoint = endpoint "volume-api"
|
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"]
|
region = node["openstack"]["block-storage"]["region"]
|
||||||
service_tenant_name = node["openstack"]["block-storage"]["service_tenant_name"]
|
service_tenant_name = node["openstack"]["block-storage"]["service_tenant_name"]
|
||||||
service_user = node["openstack"]["block-storage"]["service_user"]
|
service_user = node["openstack"]["block-storage"]["service_user"]
|
||||||
|
|
|
@ -53,13 +53,13 @@ end
|
||||||
|
|
||||||
case node["openstack"]["block-storage"]["volume"]["driver"]
|
case node["openstack"]["block-storage"]["volume"]["driver"]
|
||||||
when "cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver"
|
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"
|
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"
|
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
|
directory node["openstack"]["block-storage"]["nfs"]["mount_point_base"] do
|
||||||
owner node["openstack"]["block-storage"]["user"]
|
owner node["openstack"]["block-storage"]["user"]
|
||||||
|
|
|
@ -27,17 +27,15 @@ require_relative "support/matcher"
|
||||||
def block_storage_stubs
|
def block_storage_stubs
|
||||||
::Chef::Recipe.any_instance.stub(:rabbit_servers)
|
::Chef::Recipe.any_instance.stub(:rabbit_servers)
|
||||||
.and_return "1.1.1.1:5672,2.2.2.2:5672"
|
.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)
|
::Chef::Recipe.any_instance.stub(:secret)
|
||||||
.with("secrets", "openstack_identity_bootstrap_token")
|
.with("secrets", "openstack_identity_bootstrap_token")
|
||||||
.and_return "bootstrap-token"
|
.and_return "bootstrap-token"
|
||||||
::Chef::Recipe.any_instance.stub(:db_password).and_return ''
|
::Chef::Recipe.any_instance.stub(:get_password)
|
||||||
::Chef::Recipe.any_instance.stub(:user_password).and_return ''
|
.with("user", "guest")
|
||||||
::Chef::Recipe.any_instance.stub(:user_password)
|
|
||||||
.with("guest")
|
|
||||||
.and_return "rabbit-pass"
|
.and_return "rabbit-pass"
|
||||||
::Chef::Recipe.any_instance.stub(:service_password).and_return ''
|
::Chef::Recipe.any_instance.stub(:get_password)
|
||||||
::Chef::Recipe.any_instance.stub(:service_password)
|
.with("service", "openstack-block-storage")
|
||||||
.with("openstack-block-storage")
|
|
||||||
.and_return "cinder-pass"
|
.and_return "cinder-pass"
|
||||||
::Chef::Application.stub(:fatal!)
|
::Chef::Application.stub(:fatal!)
|
||||||
end
|
end
|
||||||
|
|
|
@ -64,7 +64,7 @@ describe "openstack-block-storage::volume" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "configures netapp dfm password" do
|
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"
|
.and_return "netapp-pass"
|
||||||
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
|
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
|
||||||
n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver"
|
n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.netapp.iscsi.NetAppISCSIDriver"
|
||||||
|
@ -76,7 +76,7 @@ describe "openstack-block-storage::volume" do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "configures rbd password" do
|
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"
|
.and_return "rbd-pass"
|
||||||
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
|
chef_run = ::ChefSpec::Runner.new ::UBUNTU_OPTS do |n|
|
||||||
n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.RBDDriver"
|
n.set["openstack"]["block-storage"]["volume"]["driver"] = "cinder.volume.drivers.RBDDriver"
|
||||||
|
|
Loading…
Reference in New Issue