Brings in Matt's openstack-ops-database work

Just bring in Matt's original work on the ops-database
cookbook.

Corrects what I think was a typo for the database service
role name attribute from openstack::role::database to
openstack::database::server_role

Brings in Berksfile and Gemfile and stubbed specs to pass
gates. Also sets version to 7.0.0 to match semantic versions
of openstack project cookbooks.

Change-Id: Idc02435ff7d3ff4b8a04c2bfc5abbb1e3091cb68
This commit is contained in:
Jay Pipes 2013-05-27 12:05:12 -04:00
parent 13286cf341
commit 4475f41e56
15 changed files with 415 additions and 10 deletions

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
*.swp
*~
.bundle
.cookbooks/
Berksfile.lock

4
.gitreview Normal file
View File

@ -0,0 +1,4 @@
[gerrit]
host=review.openstack.org
port=29418
project=stackforge/cookbook-openstack-ops-database.git

1
Berksfile Normal file
View File

@ -0,0 +1 @@
metadata

View File

@ -1,3 +1,4 @@
## 2013.1.0 ## 7.0.0
* initial release * Initial release intended for Grizzly-based OpenStack releases,
for use with Stackforge upstream repositories.

6
Gemfile Normal file
View File

@ -0,0 +1,6 @@
source "https://rubygems.org"
gem "chef", "~> 10.18.2"
gem "berkshelf", "~> 1.4.0"
gem "chefspec", "~> 1.2.0"
gem "foodcritic", "~> 2.1.0"

198
Gemfile.lock Normal file
View File

@ -0,0 +1,198 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (3.2.13)
i18n (= 0.6.1)
multi_json (~> 1.0)
addressable (2.3.4)
akami (1.2.0)
gyoku (>= 0.4.0)
nokogiri (>= 1.4.0)
berkshelf (1.4.4)
activesupport (>= 3.2.0)
addressable
celluloid (>= 0.14.0)
chozo (>= 0.6.1)
faraday (>= 0.8.5)
hashie (>= 2.0.2)
json (>= 1.5.0)
minitar
mixlib-config (~> 1.1)
mixlib-shellout (~> 1.1)
multi_json (~> 1.5)
retryable
ridley (~> 0.12.1)
solve (>= 0.4.2)
thor (~> 0.18.0)
yajl-ruby
builder (3.2.0)
bunny (0.7.9)
celluloid (0.14.0)
timers (>= 1.0.0)
chef (10.18.2)
bunny (>= 0.6.0, < 0.8.0)
erubis
highline (>= 1.6.9)
json (>= 1.4.4, <= 1.6.1)
mixlib-authentication (>= 1.3.0)
mixlib-cli (>= 1.1.0)
mixlib-config (>= 1.1.2)
mixlib-log (>= 1.3.0)
mixlib-shellout
moneta (< 0.7.0)
net-ssh (~> 2.2.2)
net-ssh-multi (~> 1.1.0)
ohai (>= 0.6.0)
rest-client (>= 1.0.4, < 1.7.0)
treetop (~> 1.4.9)
uuidtools
yajl-ruby (~> 1.1)
chefspec (1.2.0)
chef (>= 10.0)
erubis
fauxhai (>= 0.1.1, < 2.0)
minitest-chef-handler (>= 0.6.0)
rspec (~> 2.0)
chozo (0.6.1)
activesupport (>= 3.2.0)
hashie (>= 2.0.2)
multi_json (>= 1.3.0)
ci_reporter (1.8.4)
builder (>= 2.1.2)
diff-lcs (1.2.4)
erubis (2.7.0)
faraday (0.8.7)
multipart-post (~> 1.1)
fauxhai (1.1.0)
httparty
net-ssh
ohai
ffi (1.8.1)
foodcritic (2.1.0)
erubis
gherkin (~> 2.11.7)
nokogiri (~> 1.5.4)
rak (~> 1.4)
treetop (~> 1.4.10)
yajl-ruby (~> 1.1.0)
gherkin (2.11.8)
multi_json (~> 1.3)
gssapi (1.0.3)
ffi (>= 1.0.1)
gyoku (1.0.0)
builder (>= 2.1.2)
hashie (2.0.5)
highline (1.6.19)
httparty (0.11.0)
multi_json (~> 1.0)
multi_xml (>= 0.5.2)
httpclient (2.2.0.2)
httpi (0.9.7)
rack
i18n (0.6.1)
ipaddress (0.8.0)
json (1.6.1)
little-plugger (1.1.3)
logging (1.6.2)
little-plugger (>= 1.1.3)
mime-types (1.23)
minitar (0.5.4)
minitest (4.7.4)
minitest-chef-handler (1.0.1)
chef
ci_reporter
minitest (~> 4.7.3)
mixlib-authentication (1.3.0)
mixlib-log
mixlib-cli (1.3.0)
mixlib-config (1.1.2)
mixlib-log (1.6.0)
mixlib-shellout (1.1.0)
moneta (0.6.0)
multi_json (1.7.4)
multi_xml (0.5.3)
multipart-post (1.2.0)
net-http-persistent (2.8)
net-ssh (2.2.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
net-ssh-multi (1.1)
net-ssh (>= 2.1.4)
net-ssh-gateway (>= 0.99.0)
nokogiri (1.5.9)
nori (1.1.5)
ohai (6.16.0)
ipaddress
mixlib-cli
mixlib-config
mixlib-log
mixlib-shellout
systemu
yajl-ruby
polyglot (0.3.3)
rack (1.5.2)
rak (1.4)
rest-client (1.6.7)
mime-types (>= 1.16)
retryable (1.3.3)
ridley (0.12.3)
addressable
celluloid (~> 0.14.0)
chozo (>= 0.6.0)
erubis
faraday (>= 0.8.4)
mixlib-authentication (>= 1.3.0)
mixlib-config (>= 1.1.0)
mixlib-log (>= 1.3.0)
mixlib-shellout (>= 1.1.0)
net-http-persistent (>= 2.8)
net-ssh
retryable
solve (>= 0.4.4)
winrm (~> 1.1.0)
rspec (2.13.0)
rspec-core (~> 2.13.0)
rspec-expectations (~> 2.13.0)
rspec-mocks (~> 2.13.0)
rspec-core (2.13.1)
rspec-expectations (2.13.0)
diff-lcs (>= 1.1.3, < 2.0)
rspec-mocks (2.13.1)
rubyntlm (0.1.1)
savon (0.9.5)
akami (~> 1.0)
builder (>= 2.1.2)
gyoku (>= 0.4.0)
httpi (~> 0.9)
nokogiri (>= 1.4.0)
nori (~> 1.0)
wasabi (~> 1.0)
solve (0.4.4)
json
systemu (2.5.2)
thor (0.18.1)
timers (1.1.0)
treetop (1.4.12)
polyglot
polyglot (>= 0.3.1)
uuidtools (2.1.4)
wasabi (1.0.0)
nokogiri (>= 1.4.0)
winrm (1.1.2)
gssapi (~> 1.0.0)
httpclient (~> 2.2.0.2)
logging (~> 1.6.1)
nokogiri (~> 1.5.0)
rubyntlm (~> 0.1.1)
savon (= 0.9.5)
uuidtools (~> 2.1.2)
yajl-ruby (1.1.0)
PLATFORMS
ruby
DEPENDENCIES
berkshelf (~> 1.4.0)
chef (~> 10.18.2)
chefspec (~> 1.2.0)
foodcritic (~> 2.1.0)

View File

@ -15,23 +15,42 @@ Chef 11 with Ruby 1.9.x required.
The following cookbooks are dependencies: The following cookbooks are dependencies:
* database * database
* mysql
* openssl
# Resources/Providers # # Resources/Providers #
None None
# Recipes #
## default ##
- configures the database selected by attributes
# Attributes #
# Templates # # Templates #
None None
# Recipes #
## client ##
- database client configuration, selected by attributes
## server ##
- database server configuration, selected by attributes
## mysql-client ##
- calls mysql::ruby and mysql::client and installs 'mysql_python_packages'
## mysql-server ##
- configures the mysql server for OpenStack
# Attributes #
* `openstack['database']['server_role']` - which role should other nodes search on to find the database service, defaults to 'os-ops-database'
* `openstack['database']['service']` - which service to use, defaults to 'mysql'
* `openstack['database']['platform']['mysql_python_packages']` - platform-specific mysql python packages to install
License and Author License and Author
================== ==================
@ -44,6 +63,7 @@ License and Author
| **Author** | William Kelly (<william.kelly@rackspace.com>) | | **Author** | William Kelly (<william.kelly@rackspace.com>) |
| **Author** | Darren Birkett (<darren.birkett@rackspace.co.uk>) | | **Author** | Darren Birkett (<darren.birkett@rackspace.co.uk>) |
| **Author** | Evan Callicoat (<evan.callicoat@rackspace.com>) | | **Author** | Evan Callicoat (<evan.callicoat@rackspace.com>) |
| **Author** | Matt Thompson (<matt.thompson@rackspace.co.uk>) |
| **Author** | Matt Ray (<matt@opscode.com>) | | **Author** | Matt Ray (<matt@opscode.com>) |
| | | | | |
| **Copyright** | Copyright (c) 2012-2013, Rackspace US, Inc. | | **Copyright** | Copyright (c) 2012-2013, Rackspace US, Inc. |

11
attributes/default.rb Normal file
View File

@ -0,0 +1,11 @@
default['openstack']['database']['server_role'] = 'os-ops-database'
default['openstack']['database']['service'] = 'mysql'
# platform defaults
case platform
when 'fedora', 'redhat', 'centos' # :pragma-foodcritic: ~FC024 - won't fix this
default['openstack']['database']['platform']['mysql_python_packages'] = [ 'MySQL-python' ]
when 'ubuntu'
default['openstack']['database']['platform']['mysql_python_packages'] = [ 'python-mysqldb' ]
end

16
metadata.rb Normal file
View File

@ -0,0 +1,16 @@
name "openstack-ops-database"
maintainer "Opscode, Inc."
maintainer_email "matt@opscode.com"
license "Apache 2.0"
description "Provides the shared database configuration for Chef for OpenStack."
version "7.0.0"
recipe "client", "Installs client CLI package for the database used by the deployment."
recipe "server", "Installs and configures server packages for the database used by the deployment."
%w{ ubuntu redhat fedora centos }.each do |os|
supports os
end
depends "database", ">= 1.3.12"
depends "mysql", ">= 3.0.0"

20
recipes/client.rb Normal file
View File

@ -0,0 +1,20 @@
#
# Cookbook Name:: openstack-ops-database
# Recipe:: client
#
# Copyright 2013, Opscode, Inc.
#
# 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.
#
include_recipe "openstack-ops-database::#{node['openstack']['database']['service']}-client"

23
recipes/mysql-client.rb Normal file
View File

@ -0,0 +1,23 @@
#
# Cookbook Name:: openstack-ops-database
# Recipe:: mysql-client
#
# Copyright 2013, Opscode, Inc.
#
# 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.
#
include_recipe "mysql::ruby"
include_recipe "mysql::client"
node.default['openstack']['packages']['ops-database::mysql-client'] = node['openstack']['database']['platform']['mysql_python_packages']

63
recipes/mysql-server.rb Normal file
View File

@ -0,0 +1,63 @@
#
# Cookbook Name:: openstack-ops-database
# Recipe:: mysql-server
#
# Copyright 2013, Opscode, Inc.
# Copyright 2012-2013, Rackspace US, Inc.
#
# 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.
#
# override default attributes in the upstream mysql cookbook
node.set["mysql"]["bind_address"] = bind_ip = "0.0.0.0"
node.set['mysql']['tunable']['innodb_thread_concurrency'] = "0"
node.set['mysql']['tunable']['innodb_commit_concurrency'] = "0"
node.set['mysql']['tunable']['innodb_read_io_threads'] = "4"
node.set['mysql']['tunable']['innodb_flush_log_at_trx_commit'] = "2"
include_recipe "openstack-ops-database::mysql-client"
include_recipe "mysql::server"
mysql_connection_info = {:host => "localhost",
:username => 'root',
:password => node['mysql']['server_root_password']}
# removing insecure default mysql users
mysql_database_user 'drop empty localhost user' do
username ''
host 'localhost'
connection mysql_connection_info
action :drop
end
# removing insecure default mysql users
mysql_database_user 'drop empty hostname user' do
username ''
host node['hostname']
connection mysql_connection_info
action :drop
end
# drop the test database
mysql_database 'test' do
connection mysql_connection_info
action :drop
end
# flush the privileges
mysql_database "FLUSH privileges" do
connection mysql_connection_info
sql "FLUSH privileges"
action :nothing
subscribes :query, "mysql_database[test]"
end

20
recipes/server.rb Normal file
View File

@ -0,0 +1,20 @@
#
# Cookbook Name:: openstack-ops-database
# Recipe:: server
#
# Copyright 2013, Opscode, Inc.
#
# 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.
#
include_recipe "openstack-ops-database::#{node['openstack']['database']['service']}-server"

4
spec/default_spec.rb Normal file
View File

@ -0,0 +1,4 @@
require "spec_helper"
describe "openstack-ops-database::default" do
end

13
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,13 @@
require "chefspec"
::LOG_LEVEL = :fatal
::REDHAT_OPTS = {
:platform => "redhat",
:version => "6.3",
:log_level => ::LOG_LEVEL
}
::UBUNTU_OPTS = {
:platform => "ubuntu",
:version => "12.04",
:log_level => ::LOG_LEVEL
}