diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..9101e9a --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=stackforge/cookbook-monasca-api 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/backup.rb b/attributes/backup.rb index f91142e..5c80c49 100644 --- a/attributes/backup.rb +++ b/attributes/backup.rb @@ -1,2 +1,4 @@ +# encoding: UTF-8# +# # Logs to backup -node.default[:mon_log_backup][:logs][:som_api] = [ '/var/log/som-api/' ] +node.default[:mon_log_backup][:logs][:som_api] = ['/var/log/som-api/'] diff --git a/attributes/default.rb b/attributes/default.rb index 04e9795..1e6c3ff 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8# +# node.default[:mon_api][:group] = 'mon_api' node.default[:mon_api][:owner] = 'mon_api' -node.default[:mon_api][:data_bag] = 'mon_api' \ No newline at end of file +node.default[:mon_api][:data_bag] = 'mon_api' diff --git a/attributes/ufw.rb b/attributes/ufw.rb index e39bc27..21e9bbd 100644 --- a/attributes/ufw.rb +++ b/attributes/ufw.rb @@ -1,14 +1,16 @@ +# encoding: UTF-8# +# default[:som_api][:firewall][:rules] = [ - :https => { - :port => "443", - :protocol => "tcp" + https: { + port: '443', + protocol: 'tcp' }, - :https_8080 => { - :port => "8080", - :protocol => "tcp" + https_8080: { + port: '8080', + protocol: 'tcp' }, - :http_8081 => { - :port => "8081", - :protocol => "tcp" + http_8081: { + port: '8081', + protocol: 'tcp' } ] diff --git a/metadata.rb b/metadata.rb index 3aedce0..961dd32 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,7 +1,9 @@ +# encoding: UTF-8# +# name 'mon_api' -maintainer "MON Team" -maintainer_email "hpcs-mon-som@hp.com" -license "All rights reserved" -description "Installs/Configures mon_api" +maintainer 'MON Team' +maintainer_email 'hpcs-mon-som@hp.com' +license 'All rights reserved' +description 'Installs/Configures mon_api' long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) -version "0.0.10" +version '0.0.10' diff --git a/recipes/default.rb b/recipes/default.rb index 3565d26..64b4cf8 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,4 +1,5 @@ -#require 'zlib' +# encoding: UTF-8# +# package 'mon-api' do action :upgrade @@ -9,12 +10,12 @@ service 'mon-api' do provider Chef::Provider::Service::Upstart end -directory "/var/log/mon-api" do - recursive true - owner node[:mon_api][:owner] - group node[:mon_api][:group] - mode 0755 - action :create +directory '/var/log/mon-api' do + recursive true + owner node[:mon_api][:owner] + group node[:mon_api][:group] + mode 0755 + action :create end creds = data_bag_item(node[:mon_api][:data_bag], 'mon_credentials') @@ -26,30 +27,24 @@ template '/etc/mon/mon-api-config.yml' do owner 'root' group node[:mon_api][:group] mode '640' - source "mon-service-config.yml.erb" + source 'mon-service-config.yml.erb' variables( - :creds => creds, - :setting => setting + creds: creds, + setting: setting ) - notifies :restart, "service[mon-api]" + notifies :restart, 'service[mon-api]' end - - - -cookbook_file "/etc/ssl/hpmiddleware-keystore.jks" do +cookbook_file '/etc/ssl/hpmiddleware-keystore.jks' do source 'hpmiddleware-keystore-production.jks' owner 'root' group node[:mon_api][:group] mode '640' end -cookbook_file "/etc/ssl/hpmiddleware-truststore.jks" do - source "hpmiddleware-truststore.jks" +cookbook_file '/etc/ssl/hpmiddleware-truststore.jks' do + source 'hpmiddleware-truststore.jks' owner 'root' group node[:mon_api][:group] mode '640' 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.