Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
phunehehe committed Dec 25, 2013
1 parent ef4af35 commit c24ccf9
Show file tree
Hide file tree
Showing 29 changed files with 963 additions and 0 deletions.
18 changes: 18 additions & 0 deletions sysctl/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.vagrant
Berksfile.lock
*~
*#
.#*
\#*#
.*.sw[a-z]
*.un~
/cookbooks

# Bundler
Gemfile.lock
bin/*
.bundle/*
ruby/

.kitchen/
.kitchen.local.yml
62 changes: 62 additions & 0 deletions sysctl/.kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
driver:
name: vagrant

provisioner:
name: chef_solo
data_bags_path: "data_bags"
roles_path: "roles"
environments_path: "environments"
require_chef_omnibus: true

platforms:
- name: canonical-ubuntu-12.04
driver:
box: canonical-ubuntu-12.04
box_url: https://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box
- name: ubuntu-12.04
- name: ubuntu-10.04
- name: debian-7.1.0
- name: centos-6.5
driver:
box: opscode-centos-6.5
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-6.5_chef-provisionerless.box
- name: centos-5.10
driver:
box: opscode-centos-5.10
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_centos-5.10_chef-provisionerless.box
- name: scientific-6.4
driver:
box: lyte-scientific-6-minimal
box_url: http://lyte.id.au/vagrant/sl6-64-lyte.box
- name: canonical-ubuntu-14.04
driver:
box: canonical-ubuntu-14.04
box_url: https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box
- name: fedora-18
- name: fedora-20

suites:
- name: default
run_list:
- recipe[sysctl_test]
attributes:
sysctl:
params:
vm:
swappiness: 19
net:
ipv4:
tcp_fin_timeout: 29
- name: override_conf
run_list:
- recipe[sysctl_test]
attributes:
sysctl:
allow_sysctl_conf: true
params:
vm:
swappiness: 19
net:
ipv4:
tcp_fin_timeout: 29
16 changes: 16 additions & 0 deletions sysctl/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
AllCops:
Excludes:
- test/**
- vendor/**
- ruby/**

AlignParameters:
Enabled: false
Encoding:
Enabled: false
HashSyntax:
Enabled: false
LineLength:
Enabled: false
MethodLength:
Max: 30
10 changes: 10 additions & 0 deletions sysctl/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
language: ruby
rvm:
- 1.9.3
- 2.0.0
before_script:
- bundle exec berks install
bundler_args: --without integration development
script:
- bundle exec foodcritic -f any . --tags ~FC007 --tags ~FC015 --tags ~FC023
- bundle exec rubocop
20 changes: 20 additions & 0 deletions sysctl/Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
site :opscode
#chef_api :config

metadata

group :test do
cookbook "apt"
cookbook "yum"
cookbook "minitest-handler"

cookbook "sysctl_test", :path => "./test/kitchen/cookbooks/sysctl_test"
# https://github.com/opscode/test-kitchen/issues/28
# require 'pathname'
# cb_dir = ::File.join('.', 'test', 'kitchen', 'cookbooks')
# if ::File.exist?(cb_dir)
# Pathname.new(cb_dir).children.select(&:directory?).each do |c|
# cookbook c.basename.to_s, :path => ::File.join(cb_dir, c.basename.to_s).to_s
# end
# end
end
48 changes: 48 additions & 0 deletions sysctl/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
## v0.3.5

* Scientific Linux 6 support confirmed
* [GH-16] Document and test lwrp action :nothing
* Update to test kitchen 1.1
* Update to vagrant 1.4
* Added CentOS 5.10 and 6.5 test boxes

## v0.3.4

* [GH-9] Make changes available immediately (Warren Vosper)
* [GH-8] Added PLD Linux support (not regularily tested) (Elan Ruusam?e)
* Switch to rubocop over tailor
* Modernize Gemfile dependencies and add Guard for development
* Fix FC048: Prefer Mixlib::ShellOut

## v0.3.3

* More explicitly define conflicting cookbooks and operating systems in metadata.rb
* [GH-6] Fixed any params with spaces throw errors (Mike Pavlenko)

## v0.3.2

* [GH-5] Fixed ImmutableAttributeModification (Mark Pimentel)
* Added LWRP integration tests for test kitchen
* LWRP now sets attributes on the node via node.default, not node.set allowing easier overrides by other cookbooks

## v0.3.1

* Added attribute integration tests for test kitchen
* Added alpha RHEL/CentOS support
* Added Travis CI Builds
* Cleaned up foodcritic and tailor complaints

## v0.3.0

There is a lot of talk about making one sysctl cookbook. Let's make it happen.

* BREAKING CHANGE: use sysctl.params instead of sysctl.attributes to match LWRP and sysctl standard naming
* [GH-1] Remove 69-chef-static.conf
* New Maintainer: Sander van Zoest, OneHealth
* Update Development environment with Berkshelf, Vagrant, Test-Kitchen

## v0.2.0:

* [FB-3] - Notify procps start immediately
* [FB-4] - Dynamic configuration file. Add LWRP.
* [FB-5] - Allow Bignums as values
105 changes: 105 additions & 0 deletions sysctl/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Contributing to OneHealth Cookbooks

We are glad you want to contribute to OneHealth Cookbooks! The first
step is the desire to improve the project.

## Quick-contribute

* Create an issue on the github [issue tracker](https://github.com/onehealth-cookbooks/sysctl/issues)
* Link to your patch as a rebased git branch or pull request from the ticket

We regularly review contributions and will get back to you if we have
any suggestions or concerns.

### Branches and Commits

You should submit your patch as a git branch named after the change.

It is a best practice to have your commit message have a _summary
line_, followed by an empty line and then a brief description of
the commit. This also helps other contributors understand the
purpose of changes to the code.

Remember that not all users use Chef in the same way or on the same
operating systems as you, so it is helpful to be clear about your use
case and change so they can understand it even when it doesn't apply
to them.

### Github and Pull Requests

We don't require you to use Github, and we will even take patch diffs
attached to tickets on the issue tracker. However Github has a lot of
convenient features, such as being able to see a diff of changes
between a pull request and the main repository quickly without
downloading the branch.

## Functional and Unit Tests

This cookbook is set up to run tests under
[Opscode's test-kitchen](https://github.com/opscode/test-kitchen). It
uses minitest-chef to run integration tests after the node has been
converged to verify that the state of the node.

Test kitchen should run completely without exception using the default
[baseboxes provided by Opscode](https://github.com/opscode/bento).
Because Test Kitchen creates VirtualBox machines and runs through
every configuration in the .kitchen.yml file, it may take some time for
these tests to complete.

If your changes are only for a specific recipe, run only its
configuration with Test Kitchen. If you are adding a new recipe, or
other functionality such as a LWRP or definition, please add
appropriate tests and ensure they run with Test Kitchen.

If any don't pass, investigate them before submitting your patch.

Any new feature should have unit tests included with the patch with
good code coverage to help protect it from future changes. Similarly,
patches that fix a bug or regression should have a _regression test_.
Simply put, this is a test that would fail without your patch but
passes with it. The goal is to ensure this bug doesn't regress in the
future. Consider a regular expression that doesn't match a certain
pattern that it should, so you provide a patch and a test to ensure
that the part of the code that uses this regular expression works as
expected. Later another contributor may modify this regular expression
in a way that breaks your use cases. The test you wrote will fail,
signalling to them to research your ticket and use case and accounting
for it.

If you need help writing tests, please ask on the Chef Developer's
mailing list, or the #chef-hacking IRC channel.

## Cookbook Contribution Do's and Don't's

Please do include tests for your contribution. If you need help, ask
on the
[chef-dev mailing list](http://lists.opscode.com/sympa/info/chef-dev)
or the
[#chef-hacking IRC channel](http://community.opscode.com/chat/chef-hacking).
Not all platforms that a cookbook supports may be supported by Test
Kitchen. Please provide evidence of testing your contribution if it
isn't trivial so we don't have to duplicate effort in testing. Chef
10.14+ "doc" formatted output is sufficient.

Please do indicate new platform (families) or platform versions in the
commit message, and update the relevant ticket. If a contribution adds
new platforms or platform versions, indicate such in the body of the commit message(s).

Please do use [foodcritic](http://acrmp.github.com/foodcritic) to
lint-check the cookbook. Except FC007, it should pass all correctness
rules. FC007 is okay as long as the dependent cookbooks are *required*
for the default behavior of the cookbook, such as to support an
uncommon platform, secondary recipe, etc.

Please do ensure that your changes do not break or modify behavior for
other platforms supported by the cookbook. For example if your changes
are for Debian, make sure that they do not break on CentOS.

Please do not modify the version number in the metadata.rb, the maintainer
will select the appropriate version based on the release cycle
information above.

Please do not update the CHANGELOG.md for a new version. Not all
changes to a cookbook may be merged and released in the same versions.
OneHealth will update the CHANGELOG.md when releasing a new version of
the cookbook.
19 changes: 19 additions & 0 deletions sysctl/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
source "https://rubygems.org"

gem 'berkshelf', '~> 2.0'
gem 'foodcritic', '~> 3.0'
gem 'thor-foodcritic', '~> 1.1'
gem 'rubocop', '~> 0.12'

group :integration do
gem 'test-kitchen', '~> 1.1'
gem 'kitchen-vagrant'
end

group :development do
gem 'guard'
gem 'guard-rubocop'
gem 'guard-foodcritic'
gem 'rb-fsevent', :require => false
gem 'rb-inotify', :require => false
end
13 changes: 13 additions & 0 deletions sysctl/Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# More info at https://github.com/guard/guard#readme

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
watch(%r{attributes/.+\.rb$})
watch(%r{providers/.+\.rb$})
watch(%r{recipes/.+\.rb$})
watch(%r{resources/.+\.rb$})
end
Loading

0 comments on commit c24ccf9

Please sign in to comment.