Broke out db requirements. Attempting to pullout RCBops utils

This commit is contained in:
Abel 2012-11-27 10:19:52 -08:00
parent b4c29d1f78
commit 246534aa6c
2 changed files with 49 additions and 22 deletions

43
recipes/db.rb Normal file
View File

@ -0,0 +1,43 @@
#
# Cookbook Name:: cinder
# Recipe:: db
#
# Copyright 2012, AT&T
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This recipe should be placed in the run_list of the node that
# runs the database server that houses the Nova main database
class ::Chef::Recipe
include ::Openstack
include ::Opscode::OpenSSL::Password
end
# TODO(jaypipes): This is retarded, but nothing runs without this. The
# database cookbook should handle this crap, but it doesn't. :(
include_recipe "mysql::client"
include_recipe "mysql::ruby"
# Allow for using a well known db password
if node["developer_mode"]
node.set_unless["openstack"]["cinder"]["db"]["password"] = "cinder"
else
node.set_unless["openstack"]["cinder"]["db"]["password"] = secure_password
end
db_create_with_user("image",
node["openstack"]["cinder"]["db"]["username"],
node["openstack"]["cinder"]["db"]["password"]
)

View File

@ -19,33 +19,17 @@
# limitations under the License.
#
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
# Allow for using a well known db password
if node["developer_mode"]
node.set_unless["openstack"]["cinder"]["db"]["password"] = "cinder"
else
node.set_unless["openstack"]["cinder"]["db"]["password"] = secure_password
class ::Chef::Recipe
include ::Openstack
end
# Allow for using a well known db password
# Allow for using a well known service password
if node["developer_mode"]
node.set_unless["openstack"]["cinder"]["service_pass"] = "cinder"
else
node.set_unless["openstack"]["cinder"]["service_pass"] = secure_password
end
#creates db and user
#function defined in osops-utils/libraries
create_db_and_user("mysql",
node["openstack"]["cinder"]["db"]["name"],
node["openstack"]["cinder"]["db"]["username"],
node["openstack"]["cinder"]["db"]["password"])
include_recipe "mysql::client"
include_recipe "osops-utils"
include_recipe "osops-utils::repo"
platform_options = node["openstack"]["cinder"]["platform"]
platform_options["cinder_packages"].each do |pkg|
@ -83,11 +67,11 @@ end
mysql_info = get_settings_by_role("mysql-master", "mysql")
rabbit_info = get_settings_by_role("rabbitmq-server", "rabbitmq") # FIXME: access
ks_admin_endpoint = get_access_endpoint("keystone", "keystone", "admin-api")
ks_service_endpoint = get_access_endpoint("keystone", "keystone","service-api")
ks_admin_endpoint = endpoint("keystone", "keystone", "admin-api")
ks_service_endpoint = endpoint("keystone", "keystone","service-api")
keystone = get_settings_by_role("keystone", "keystone")
glance = get_settings_by_role("glance-api", "glance")
glance_api_endpoint = get_access_endpoint("glance-api", "glance", "api")
glance_api_endpoint = endpoint("glance-api", "glance", "api")
api_endpoint = get_bind_endpoint("cinder", "volume")
if glance["api"]["swift_store_auth_address"].nil?