Get initial build to work.

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

Fixed style errors.

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

Change-Id: I59d8567111c387b25dc215dc1309f03a1516ce3d
This commit is contained in:
Craig Bryant 2014-07-16 18:29:25 -06:00
parent 629c083fee
commit e3639c85f5
11 changed files with 86 additions and 36 deletions

4
.gitreview Normal file
View File

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

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 # 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/']

View File

@ -1,3 +1,5 @@
# encoding: UTF-8#
#
node.default[:mon_api][:group] = 'mon_api' node.default[:mon_api][:group] = 'mon_api'
node.default[:mon_api][:owner] = 'mon_api' node.default[:mon_api][:owner] = 'mon_api'
node.default[:mon_api][:data_bag] = 'mon_api' node.default[:mon_api][:data_bag] = 'mon_api'

View File

@ -1,14 +1,16 @@
# encoding: UTF-8#
#
default[:som_api][:firewall][:rules] = [ default[:som_api][:firewall][:rules] = [
:https => { https: {
:port => "443", port: '443',
:protocol => "tcp" protocol: 'tcp'
}, },
:https_8080 => { https_8080: {
:port => "8080", port: '8080',
:protocol => "tcp" protocol: 'tcp'
}, },
:http_8081 => { http_8081: {
:port => "8081", port: '8081',
:protocol => "tcp" protocol: 'tcp'
} }
] ]

View File

@ -1,7 +1,9 @@
# encoding: UTF-8#
#
name 'mon_api' name 'mon_api'
maintainer "MON Team" maintainer 'MON Team'
maintainer_email "hpcs-mon-som@hp.com" maintainer_email 'hpcs-mon-som@hp.com'
license "All rights reserved" license 'All rights reserved'
description "Installs/Configures mon_api" description 'Installs/Configures mon_api'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version "0.0.10" version '0.0.10'

View File

@ -1,4 +1,5 @@
#require 'zlib' # encoding: UTF-8#
#
package 'mon-api' do package 'mon-api' do
action :upgrade action :upgrade
@ -9,7 +10,7 @@ service 'mon-api' do
provider Chef::Provider::Service::Upstart provider Chef::Provider::Service::Upstart
end end
directory "/var/log/mon-api" do directory '/var/log/mon-api' do
recursive true recursive true
owner node[:mon_api][:owner] owner node[:mon_api][:owner]
group node[:mon_api][:group] group node[:mon_api][:group]
@ -26,30 +27,24 @@ template '/etc/mon/mon-api-config.yml' do
owner 'root' owner 'root'
group node[:mon_api][:group] group node[:mon_api][:group]
mode '640' mode '640'
source "mon-service-config.yml.erb" source 'mon-service-config.yml.erb'
variables( variables(
:creds => creds, creds: creds,
:setting => setting setting: setting
) )
notifies :restart, "service[mon-api]" notifies :restart, 'service[mon-api]'
end end
cookbook_file '/etc/ssl/hpmiddleware-keystore.jks' do
cookbook_file "/etc/ssl/hpmiddleware-keystore.jks" do
source 'hpmiddleware-keystore-production.jks' source 'hpmiddleware-keystore-production.jks'
owner 'root' owner 'root'
group node[:mon_api][:group] group node[:mon_api][:group]
mode '640' mode '640'
end end
cookbook_file "/etc/ssl/hpmiddleware-truststore.jks" do cookbook_file '/etc/ssl/hpmiddleware-truststore.jks' do
source "hpmiddleware-truststore.jks" source 'hpmiddleware-truststore.jks'
owner 'root' owner 'root'
group node[:mon_api][:group] group node[:mon_api][:group]
mode '640' mode '640'
end end

2
spec/empty.rb Normal file
View File

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