diff --git a/.gitreview b/.gitreview new file mode 100644 index 0000000..b38d733 --- /dev/null +++ b/.gitreview @@ -0,0 +1,4 @@ +[gerrit] +host=review.openstack.org +port=29418 +project=stackforge/cookbook-monasca-notification 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 6373e8a..a0321a2 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][:mon_notification] = [ '/var/log/mon-notification/notification.log' ] +node.default[:mon_log_backup][:logs][:mon_notification] = + ['/var/log/mon-notification/notification.log'] diff --git a/attributes/default.rb b/attributes/default.rb index 1a8b081..a563421 100644 --- a/attributes/default.rb +++ b/attributes/default.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8 +# default[:mon_notification][:user] = 'mon-notification' default[:mon_notification][:group] = 'mon-notification' default[:mon_notification][:conf_dir] = '/etc/mon' diff --git a/attributes/monitor.rb b/attributes/monitor.rb index 558eddf..3f401ec 100644 --- a/attributes/monitor.rb +++ b/attributes/monitor.rb @@ -1,3 +1,4 @@ +# encoding: UTF-8 # Have ossec watch the log node.default[:ossec][:watched][:mon_notification] = { '/var/log/mon-notification/notification.log' => :syslog diff --git a/metadata.rb b/metadata.rb index 9ef3072..0b376ef 100644 --- a/metadata.rb +++ b/metadata.rb @@ -1,3 +1,5 @@ +# encoding: UTF-8 +# name 'mon_notification' maintainer 'HP Monitoring' maintainer_email 'hpcs-mon@hp.com' diff --git a/recipes/default.rb b/recipes/default.rb index 83780f9..3de8501 100644 --- a/recipes/default.rb +++ b/recipes/default.rb @@ -1,4 +1,6 @@ -include_recipe "python" +# encoding: UTF-8 +# +include_recipe 'python' # preferable for the OS to install this then to have pip compile %w[ python-mysqldb libmysqlclient-dev ].each do |pkg_name| @@ -47,7 +49,7 @@ directory node[:mon_notification][:log_dir] do mode 0775 end -# todo - setup an encrypted data bag for credentials +# TODO: setup an encrypted data bag for credentials hosts = data_bag_item(node[:mon_notification][:data_bag], 'hosts') template "#{node[:mon_notification][:conf_dir]}/notification.yaml" do action :create @@ -56,7 +58,7 @@ template "#{node[:mon_notification][:conf_dir]}/notification.yaml" do group node[:mon_notification][:group] mode 0640 variables( - :hosts => hosts + hosts: hosts ) - notifies :restart, "service[mon-notification]" + notifies :restart, 'service[mon-notification]' 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.