Added files to get build to work

Try and create Berksfile that will work with berkshelf 2 or 3

Fixed style issues

Also, added .gitreview file

Change-Id: I47caf4930ac18bcfc62737e851fff1fe15dd9c9f
This commit is contained in:
Tim Kuhlman 2014-08-11 10:19:16 -06:00
parent 329ba259a5
commit 51fd328fef
10 changed files with 50 additions and 12 deletions

4
.gitreview Normal file
View File

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

7
Berksfile Normal file
View File

@ -0,0 +1,7 @@
require 'rubygems'
if Gem::Specification::find_by_name('berkshelf').version.to_s[0] == '3'
source 'https://api.berkshelf.com'
end
metadata

11
Gemfile Normal file
View File

@ -0,0 +1,11 @@
source 'https://rubygems.org'
gem 'chef', '~> 11.8'
gem 'json', '<= 1.7.7' # chef 11 dependency
gem 'berkshelf', '~> 2.0.18'
gem 'hashie', '~> 2.0'
gem 'chefspec', '~> 3.4.0'
gem 'rspec', '~> 2.14.1'
gem 'foodcritic', '~> 3.0.3'
gem 'strainer'
gem 'rubocop', '~> 0.18.1'

5
Strainerfile Normal file
View File

@ -0,0 +1,5 @@
# Strainerfile
rubocop: rubocop $SANDBOX/$COOKBOOK
knife test: knife cookbook test $COOKBOOK
foodcritic: foodcritic -f any -t ~FC003 -t ~FC023 $SANDBOX/$COOKBOOK
chefspec: rspec $SANDBOX/$COOKBOOK/spec

View File

@ -6,5 +6,5 @@ maintainer_email 'monasca@lists.launchpad.net'
license 'All rights reserved' license 'All rights reserved'
description 'Installs/Configures monasca_schema' description 'Installs/Configures monasca_schema'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '0.1.0' version '0.1.1'
depends 'influxdb' depends 'influxdb'

View File

@ -1 +1,3 @@
# encoding: UTF-8#
#
# Unused # Unused

View File

@ -1,3 +1,5 @@
# encoding: UTF-8#
#
# Create an influxdb database and users # Create an influxdb database and users
# Leverages the cookbook from https://github.com/SimpleFinance/chef-influxdb # Leverages the cookbook from https://github.com/SimpleFinance/chef-influxdb
@ -9,7 +11,7 @@ influxdb_database 'mon' do
action :create action :create
end end
['mon_api', 'mon_persister'].each do |user| %w[mon_api mon_persister].each do |user|
influxdb_user user do influxdb_user user do
action :create action :create
password 'password' password 'password'

View File

@ -1,3 +1,5 @@
# encoding: UTF-8#
#
# Temporary way of loading in the mysql schema # Temporary way of loading in the mysql schema
bash 'mon_schema' do bash 'mon_schema' do
@ -10,5 +12,5 @@ cookbook_file '/var/lib/mysql/mon.sql' do
owner 'root' owner 'root'
group 'root' group 'root'
source 'mysql/mon.sql' source 'mysql/mon.sql'
notifies :run, "bash[mon_schema]" notifies :run, 'bash[mon_schema]'
end end

View File

@ -1,24 +1,28 @@
# encoding: UTF-8#
#
# Lays down a db creation script and default schema # Lays down a db creation script and default schema
# There is a bug where $HOME is not set currectly for exec, I use sudo to avoid this # There is a bug where $HOME is not set currectly for exec, I use sudo to
# https://tickets.opscode.com/browse/CHEF-2288 # avoid this https://tickets.opscode.com/browse/CHEF-2288
bash 'create_mon_db' do bash 'create_mon_db' do
action :nothing action :nothing
user 'root' user 'root'
code <<-EOH code <<-EOH
ulimit -n 65536 # The max files open limit must be set for db creation to work. ulimit -n 65536 # Max files open limit must be set for db creation to work.
sudo -Hu dbadmin /var/vertica/create_mon_db.sh sudo -Hu dbadmin /var/vertica/create_mon_db.sh
EOH EOH
end end
# Note: As projections based on k-safety are added this file list will need modification based on a clustered or not setup # Note: As projections based on k-safety are added this file list will need
%w[ mon_grants.sql mon_schema.sql mon_metrics_schema.sql mon_alarms_schema.sql mon_users.sql ].each do |filename| # modification based on a clustered or not setup
%w[ mon_grants.sql mon_schema.sql mon_metrics_schema.sql
mon_alarms_schema.sql mon_users.sql ].each do |filename|
cookbook_file "/var/vertica/#{filename}" do cookbook_file "/var/vertica/#{filename}" do
action :create action :create
source "vertica/#{filename}" source "vertica/#{filename}"
owner node[:vertica][:dbadmin_user] owner node[:vertica][:dbadmin_user]
group node[:vertica][:dbadmin_group] group node[:vertica][:dbadmin_group]
mode "644" mode '644'
end end
end end
@ -33,7 +37,6 @@ cookbook_file '/var/vertica/create_mon_db.sh' do
source "vertica/#{setup_script}" source "vertica/#{setup_script}"
owner node[:vertica][:dbadmin_user] owner node[:vertica][:dbadmin_user]
group node[:vertica][:dbadmin_group] group node[:vertica][:dbadmin_group]
mode "755" mode '755'
notifies :run, "bash[create_mon_db]" notifies :run, 'bash[create_mon_db]'
end end

2
spec/empty.rb Normal file
View File

@ -0,0 +1,2 @@
# encoding: UTF-8
# No unit tests at this time.