From 921642edb856f6b137d57dd2bd650d5fcdebae23 Mon Sep 17 00:00:00 2001 From: Craig Bryant Date: Tue, 15 Jul 2014 15:38:44 -0600 Subject: [PATCH] Get initial build to work. Add .gitreview, Gemfile, .rubocop.yml, Berksfile, Strainerfile Fixed style errors. Added empty unit test so chef-unit passes until we get real unit tests Change-Id: Ifac43dd25c20f67cbd699f50e01c4e157342e87d --- .gitreview | 4 ++++ .rubocop.yml | 24 ++++++++++++++++++++++++ Berksfile | 1 + Gemfile | 11 +++++++++++ Strainerfile | 5 +++++ attributes/default.rb | 2 ++ metadata.rb | 6 ++++-- recipes/default.rb | 14 ++++++++------ spec/empty.rb | 2 ++ 9 files changed, 61 insertions(+), 8 deletions(-) create mode 100644 .gitreview create mode 100644 .rubocop.yml 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..be7183e --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=stackforge/cookbook-monasca-thresh diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..5500e6d --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,24 @@ +AllCops: + Includes: + - metadata.rb + - Gemfile + - attributes/** + - libraries/** + - providers/** + - recipes/** + - resources/** + - spec/** + +Encoding: + Exclude: + - metadata.rb + - Gemfile + +NumericLiterals: + Enabled: false + +LineLength: + Enabled: false + +WordArray: + MinSize: 3 diff --git a/Berksfile b/Berksfile new file mode 100644 index 0000000..850a120 --- /dev/null +++ b/Berksfile @@ -0,0 +1 @@ +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/attributes/default.rb b/attributes/default.rb index 883031d..d0ef9ed 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1 +1,3 @@ +# encoding: UTF-8 +# default[:mon_thresh][:data_bag] = 'mon_thresh' diff --git a/metadata.rb b/metadata.rb index 8d696f2..d212c5e 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,6 +1,8 @@ +# encoding: UTF-8 +# name 'mon_thresh' -maintainer "Monitoring Team" -maintainer_email "hpcs-mon@hp.com" +maintainer 'Monitoring Team' +maintainer_email 'hpcs-mon@hp.com' license 'All rights reserved' description 'Installs/Configures mon_thresh' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) diff --git a/recipes/default.rb b/recipes/default.rb index 5fb2c21..1bfd150 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,5 +1,7 @@ +# encoding: UTF-8 +# # The user/group thresh are created by the package, as well as /etc/mon/ -package 'mon-thresh' do #The package depends on openjdk-7-jre-headless +package 'mon-thresh' do # The package depends on openjdk-7-jre-headless action :upgrade end @@ -7,8 +9,8 @@ service 'mon-thresh' do action :enable end -# todo - an encrypted credentials data bag -credentials = { 'mysql' => { 'user' => 'thresh', 'password' => 'password'}} +# TODO: an encrypted credentials data bag +credentials = { 'mysql' => { 'user' => 'thresh', 'password' => 'password' } } settings = data_bag_item(node[:mon_thresh][:data_bag], 'mon_thresh') template '/etc/mon/mon-thresh-config.yml' do @@ -18,8 +20,8 @@ template '/etc/mon/mon-thresh-config.yml' do mode '640' source 'mon-thresh-config.yml.erb' variables( - :credentials => credentials, - :settings => settings + credentials: credentials, + settings: settings ) - notifies :restart, "service[mon-thresh]" + notifies :restart, 'service[mon-thresh]' 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.