From 51fd328fef6beb037ad93128a56f134ee32cea09 Mon Sep 17 00:00:00 2001 From: Tim Kuhlman Date: Mon, 11 Aug 2014 10:19:16 -0600 Subject: [PATCH] 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 --- .gitreview | 4 ++++ Berksfile | 7 +++++++ Gemfile | 11 +++++++++++ Strainerfile | 5 +++++ metadata.rb | 2 +- recipes/default.rb | 2 ++ recipes/influxdb.rb | 4 +++- recipes/mysql.rb | 4 +++- recipes/vertica.rb | 21 ++++++++++++--------- spec/empty.rb | 2 ++ 10 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 .gitreview create mode 100644 Berksfile create mode 100644 Gemfile create mode 100644 Strainerfile create mode 100644 spec/empty.rb diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..b39c80b --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=stackforge/cookbook-monasca-schema diff --git a/Berksfile b/Berksfile new file mode 100644 index 0000000..a685ac4 --- /dev/null +++ b/Berksfile @@ -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 diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..eeb359d --- /dev/null +++ b/Gemfile @@ -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' diff --git a/Strainerfile b/Strainerfile new file mode 100644 index 0000000..cf2ff52 --- /dev/null +++ b/Strainerfile @@ -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 diff --git a/metadata.rb b/metadata.rb index b9792d8..d0e4ee8 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,5 +6,5 @@ maintainer_email 'monasca@lists.launchpad.net' license 'All rights reserved' description 'Installs/Configures monasca_schema' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version '0.1.0' +version '0.1.1' depends 'influxdb' diff --git a/recipes/default.rb b/recipes/default.rb index 953cda3..4b97e7d 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1 +1,3 @@ +# encoding: UTF-8# +# # Unused diff --git a/recipes/influxdb.rb b/recipes/influxdb.rb index cbab562..3f9003e 100644 --- a/recipes/influxdb.rb +++ b/recipes/influxdb.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8# +# # Create an influxdb database and users # Leverages the cookbook from https://github.com/SimpleFinance/chef-influxdb @@ -9,7 +11,7 @@ influxdb_database 'mon' do action :create end -['mon_api', 'mon_persister'].each do |user| +%w[mon_api mon_persister].each do |user| influxdb_user user do action :create password 'password' diff --git a/recipes/mysql.rb b/recipes/mysql.rb index 14ea386..ef6b1aa 100644 --- a/recipes/mysql.rb +++ b/recipes/mysql.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8# +# # Temporary way of loading in the mysql schema bash 'mon_schema' do @@ -10,5 +12,5 @@ cookbook_file '/var/lib/mysql/mon.sql' do owner 'root' group 'root' source 'mysql/mon.sql' - notifies :run, "bash[mon_schema]" + notifies :run, 'bash[mon_schema]' end diff --git a/recipes/vertica.rb b/recipes/vertica.rb index 5649910..6dc6dab 100644 --- a/recipes/vertica.rb +++ b/recipes/vertica.rb @@ -1,24 +1,28 @@ +# encoding: UTF-8# +# # 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 -# https://tickets.opscode.com/browse/CHEF-2288 +# There is a bug where $HOME is not set currectly for exec, I use sudo to +# avoid this https://tickets.opscode.com/browse/CHEF-2288 bash 'create_mon_db' do action :nothing user 'root' 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 EOH end -# Note: As projections based on k-safety are added this file list will need 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| +# Note: As projections based on k-safety are added this file list will need +# 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 action :create source "vertica/#{filename}" owner node[:vertica][:dbadmin_user] group node[:vertica][:dbadmin_group] - mode "644" + mode '644' end end @@ -33,7 +37,6 @@ cookbook_file '/var/vertica/create_mon_db.sh' do source "vertica/#{setup_script}" owner node[:vertica][:dbadmin_user] group node[:vertica][:dbadmin_group] - mode "755" - notifies :run, "bash[create_mon_db]" + mode '755' + notifies :run, 'bash[create_mon_db]' end - diff --git a/spec/empty.rb b/spec/empty.rb new file mode 100644 index 0000000..fc2f6d6 --- /dev/null +++ b/spec/empty.rb @@ -0,0 +1,2 @@ +# encoding: UTF-8 +# No unit tests at this time.