forked from cogini/chef-cookbooks
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
25 changed files
with
399 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,31 @@ | ||
source "https://rubygems.org" | ||
source 'https://rubygems.org' | ||
|
||
gem 'berkshelf', '~> 2.0' | ||
gem 'foodcritic', '~> 3.0' | ||
gem 'thor-foodcritic', '~> 1.1' | ||
gem 'rubocop', '~> 0.12' | ||
gem 'berkshelf', '~> 2.0.14' | ||
|
||
group :unit do | ||
gem 'foodcritic', '~> 3.0' | ||
gem 'rubocop', '~> 0.18.0' | ||
gem 'chefspec', '~> 3.2.0' | ||
end | ||
|
||
group :integration do | ||
gem 'test-kitchen', '~> 1.1' | ||
gem 'kitchen-vagrant' | ||
end | ||
|
||
group :release do | ||
gem 'stove', '~> 1.1' | ||
gem 'rspec_junit_formatter' | ||
gem 'rubocop-checkstyle_formatter' | ||
end | ||
|
||
group :development do | ||
gem 'guard' | ||
gem 'guard-rubocop' | ||
gem 'guard-foodcritic' | ||
gem 'guard', '~> 1.8' | ||
gem 'guard-rubocop', '~> 0.2' | ||
gem 'guard-foodcritic', '~> 1.0' | ||
gem 'guard-kitchen', '~> 0.0' | ||
gem 'guard-rspec', '~> 3.0' | ||
gem 'rb-fsevent', :require => false | ||
gem 'rb-inotify', :require => false | ||
gem 'terminal-notifier-guard', :require => false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,29 @@ | ||
# More info at https://github.com/guard/guard#readme | ||
|
||
guard 'kitchen' do | ||
watch(%r{test/.+}) | ||
watch(%r{^recipes/(.+)\.rb$}) | ||
watch(%r{^attributes/(.+)\.rb$}) | ||
watch(%r{^files/(.+)}) | ||
watch(%r{^templates/(.+)}) | ||
watch(%r{^providers/(.+)\.rb}) | ||
watch(%r{^resources/(.+)\.rb}) | ||
end | ||
|
||
guard :rubocop do | ||
watch(%r{.+\.rb$}) | ||
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) } | ||
end | ||
|
||
guard :foodcritic, :cli => "--epic-fail any --tags ~FC007 --tags ~FC015 --tags ~FC023", :cookbook_paths => "." do | ||
guard :foodcritic, :cli => "--epic-fail any --tags ~FC007 --tags ~FC015 --tags ~FC023", :cookbook_paths => ".", :all_on_start => false do | ||
watch(%r{attributes/.+\.rb$}) | ||
watch(%r{providers/.+\.rb$}) | ||
watch(%r{recipes/.+\.rb$}) | ||
watch(%r{resources/.+\.rb$}) | ||
end | ||
|
||
guard :rspec, cmd: 'bundle exec rspec', :all_on_start => false do | ||
watch(%r{^spec/(.+)_spec\.rb$}) | ||
watch(%r{^(recipes)/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" } | ||
watch('spec/spec_helper.rb') { 'spec' } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
case platform_family | ||
when 'debian', 'rhel' | ||
if platform_family?('debian', 'rhel') | ||
default['sysctl']['conf_dir'] = '/etc/sysctl.d' | ||
else | ||
default['sysctl']['conf_dir'] = nil | ||
end | ||
default['sysctl']['params'] = {} | ||
default['sysctl']['allow_sysctl_conf'] = false | ||
|
||
# Default is 32MB which is too low to be useful | ||
default['sysctl']['params']['kernel']['shmmax'] = 67108864 # 64MB |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
if defined?(ChefSpec) | ||
ChefSpec::Runner.define_runner_method :sysctl_param | ||
|
||
# @example This is an example | ||
# expect(chef_run.to apply_sysctl_param('foo') | ||
# | ||
# @param [String] resource_name | ||
# the resource name | ||
# | ||
# @return [ChefSpec::Matchers::ResourceMatcher] | ||
# | ||
def apply_sysctl_param(resource_name) | ||
ChefSpec::Matchers::ResourceMatcher.new(:sysctl_param, :apply, resource_name) | ||
end | ||
|
||
def remove_sysctl_param(resource_name) | ||
ChefSpec::Matchers::ResourceMatcher.new(:sysctl_param, :remove, resource_name) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
name 'sysctl' | ||
maintainer 'OneHealth Solutions, Inc.' | ||
maintainer_email '[email protected]' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,45 +4,39 @@ | |
# | ||
# Copyright 2011, Fewbytes Technologies LTD | ||
# Copyright 2012, Chris Roberts <[email protected]> | ||
# Copyright 2013, OneHealth Solutions, Inc. | ||
# Copyright 2013-2014, OneHealth Solutions, Inc. | ||
# | ||
|
||
template '/etc/rc.d/init.d/procps' do | ||
source 'procps.init-rhel.erb' | ||
mode '0755' | ||
only_if { platform_family?('rhel', 'pld') } | ||
end | ||
|
||
service 'procps' | ||
include_recipe 'sysctl::service' | ||
|
||
sysctl_path = | ||
if node['sysctl']['conf_dir'] | ||
directory node['sysctl']['conf_dir'] do | ||
owner 'root' | ||
group 'root' | ||
mode 0755 | ||
action :create | ||
end | ||
File.join(node['sysctl']['conf_dir'], '99-chef-attributes.conf') | ||
else | ||
node['sysctl']['allow_sysctl_conf'] ? '/etc/sysctl.conf' : nil | ||
end | ||
|
||
if sysctl_path | ||
template sysctl_path do | ||
if Sysctl.config_file(node) | ||
# this is called by the sysctl_param lwrp to trigger template creation | ||
ruby_block 'save-sysctl-params' do | ||
action :nothing | ||
block do | ||
end | ||
notifies :create, "template[#{Sysctl.config_file(node)}]", :delayed | ||
end | ||
|
||
# this needs to have an action in case node.sysctl.params has changed | ||
# and also needs to be called for persistence on lwrp changes via the | ||
# ruby_block | ||
template Sysctl.config_file(node) do | ||
action :create | ||
source 'sysctl.conf.erb' | ||
mode '0644' | ||
notifies :start, 'service[procps]', :immediately | ||
only_if do | ||
node['sysctl']['params'] && !node['sysctl']['params'].empty? | ||
end | ||
end | ||
|
||
ruby_block 'sysctl config notifier' do | ||
block do | ||
true | ||
end | ||
notifies :create, "template[#{sysctl_path}]", :immediately | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# | ||
# Cookbook Name:: sysctl | ||
# Recipe:: service | ||
# | ||
# Copyright 2013-2014, OneHealth Solutions, Inc. | ||
# | ||
|
||
template '/etc/rc.d/init.d/procps' do | ||
source 'procps.init-rhel.erb' | ||
mode '0755' | ||
only_if { platform_family?('rhel', 'pld') } | ||
end | ||
|
||
service 'procps' do | ||
supports :restart => true, :reload => true, :status => false | ||
action :enable | ||
end |
Oops, something went wrong.