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: I75a9449a28cfc294eacbdc0003a8b7de2613290e
This commit is contained in:
Craig Bryant 2014-07-16 16:25:01 -06:00
parent 6e84937a64
commit 5ce5e04f51
11 changed files with 61 additions and 5 deletions

4
.gitreview Normal file
View File

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

24
.rubocop.yml Normal file
View File

@ -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

1
Berksfile Normal file
View File

@ -0,0 +1 @@
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

@ -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']

View File

@ -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'

View File

@ -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

View File

@ -1,3 +1,5 @@
# encoding: UTF-8
#
name 'mon_notification'
maintainer 'HP Monitoring'
maintainer_email 'hpcs-mon@hp.com'

View File

@ -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

2
spec/empty.rb Normal file
View File

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