Get initial build to work.

Add .gitreview, Gemfile, .rubocop.yml, Berksfile, Strainerfile

Fixed style and lint errors.

Added empty unit test so chef-unit passes until we get real unit tests

Change-Id: I8f2e48782a5289c82b0d4fc147d95f637be046c6
This commit is contained in:
Craig Bryant 2014-07-16 17:50:16 -06:00
parent a790f35934
commit f7fe1e5744
10 changed files with 73 additions and 19 deletions

4
.gitreview Normal file
View File

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

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 @@
default['mon_agent']['data_bag'] = "mon_agent"
default['mon_agent']['plugin'] = {}
# encoding: UTF-8#
#
default[:mon_agent][:data_bag] = 'mon_agent'
default[:mon_agent][:plugin] = {}

View File

@ -1,8 +1,10 @@
name "mon_agent"
maintainer "HP_Cloud_Monitoring"
maintainer_email "hpcs-mon@hp.com"
description "Installs/Configures mon-agent components"
# encoding: UTF-8#
#
name 'mon_agent'
maintainer 'HP_Cloud_Monitoring'
maintainer_email 'hpcs-mon@hp.com'
description 'Installs/Configures mon-agent components'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "1.1.1"
version '1.1.1'
depends 'python'
recipe "mon_api::default", "Default"
recipe 'mon_api::default', 'Default'

View File

@ -1,4 +1,6 @@
include_recipe "python"
# encoding: UTF-8#
#
include_recipe 'python'
# Pre-reqs that when installed by os package avoid compilation by pip
%w[python-pymongo python-yaml supervisor sysstat].each do |pkg_name|
@ -15,7 +17,7 @@ end
python_pip 'mon-agent' do
action :install
notifies :run, "execute[mon-setup]"
notifies :run, 'execute[mon-setup]'
end
include_recipe 'mon_agent::plugin_cfg'

View File

@ -1,3 +1,4 @@
# encoding: UTF-8#
#
# Cookbook Name:: mon_agent
# Recipe:: plugin_cfg
@ -6,25 +7,25 @@
# Load nagios-plugins package if it's needed
package 'nagios-plugins-basic' do
action :install
only_if { node[:mon_agent][:plugin].has_key?(:nagios_wrapper) }
only_if { node[:mon_agent][:plugin].key?(:nagios_wrapper) }
end
# Configures the plugin yaml files based on node[:mon_agent][:plugin]
# attributes
node[:mon_agent][:plugin].each_key do |plugin|
if not node[:mon_agent][:plugin][plugin].has_key?(:init_config)
node[:mon_agent][:plugin][plugin][:init_config] = {}
unless node[:mon_agent][:plugin][plugin].key?(:init_config)
node.normal[:mon_agent][:plugin][plugin][:init_config] = {}
end
template "/etc/mon-agent/conf.d/#{plugin}.yaml" do
source "plugin_yaml.erb"
source 'plugin_yaml.erb'
action :create
owner node['mon_agent']['owner']
group node['mon_agent']['group']
owner node[:mon_agent][:owner]
group node[:mon_agent][:group]
mode 0644
variables(
:init_config => node[:mon_agent][:plugin][plugin][:init_config],
:instances => node[:mon_agent][:plugin][plugin][:instances]
init_config: node[:mon_agent][:plugin][plugin][:init_config],
instances: node[:mon_agent][:plugin][plugin][:instances]
)
notifies :run, "execute[mon-setup]"
notifies :run, 'execute[mon-setup]'
end
end

2
spec/empty.rb Normal file
View File

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