Skip to content
This repository has been archived by the owner on Jan 10, 2023. It is now read-only.

Commit

Permalink
Migrate AUFS handling from chef-docker aufs recipe, closes #1
Browse files Browse the repository at this point in the history
  • Loading branch information
bflad committed Mar 30, 2014
0 parents commit 78d81fb
Show file tree
Hide file tree
Showing 33 changed files with 814 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.bundle
.cache
.kitchen/
.kitchen.local.yml
.vagrant
Berksfile.lock
Gemfile.lock
\#*#
34 changes: 34 additions & 0 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
driver_plugin: vagrant

driver_config:
customize:
memory: 1024

platforms:
- name: ubuntu-12.04
driver_config:
box: opscode-ubuntu-12.04
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box
require_chef_omnibus: latest
- name: ubuntu-12.10
driver_config:
box: opscode-ubuntu-12.10
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.10_chef-provisionerless.box
require_chef_omnibus: latest
- name: ubuntu-13.04
driver_config:
box: opscode-ubuntu-13.04
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-13.04_chef-provisionerless.box
require_chef_omnibus: latest
- name: ubuntu-13.10
driver_config:
box: opscode-ubuntu-13.10
box_url: http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-13.10_chef-provisionerless.box
require_chef_omnibus: latest

suites:
- name: aufs-package
run_list:
- recipe[minitest-handler]
- recipe[aufs_test::default]
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
rvm:
- 1.9.3
bundler_args: --without development
before_script:
- bundle exec berks install
script:
# - bundle exec knife cookbook test -a -o .
- bundle exec foodcritic -f any .
- bundle exec rubocop
8 changes: 8 additions & 0 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
site :opscode

metadata

group :integration do
cookbook "minitest-handler"
cookbook "aufs_test", path: "test/cookbooks/aufs_test"
end
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## 0.1.0

* Enhancement: [#1][]: Migrate AUFS handling from chef-docker aufs recipe

[#1]: https://github.com/bflad/chef-aufs/issues/1
176 changes: 176 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
# Contributing to @bflad Cookbooks

Below is a modified version of Opscode's CONTRIBUTING.md in their public cookbooks. Thanks to them for the great documentation!

## Quick-contribute

* Use the testing methods and tools outlined below
* Use Github issues and pull requests when possible

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

## The Apache License

Licensing is very important to open source projects, it helps ensure
the software continues to be available under the terms that the author
desired. Chef uses the Apache 2.0 license to strike a balance between
open contribution and allowing you to use the software however you
would like to.

The license tells you what rights you have that are provided by the
copyright holder. It is important that the contributor fully
understands what rights they are licensing and agrees to them.
Sometimes the copyright holder isn't the contributor, most often when
the contributor is doing work for a company.

## Using git

You can get a quick copy of the repository for this cookbook by
running `git clone
git://github.com/bflad/chef-COOKBOOKNAME.git`.

For collaboration purposes, it is best if you create a Github account
and fork the repository to your own account. Once you do this you will
be able to push your changes to your Github repository for others to
see and use.

If you have another repository in your GitHub account named the same
as the cookbook, we suggest you suffix the repository with -cookbook.

### Branches and Commits

You should submit your patch as a git branch named after the ticket,
such as GH-1337. This is called a _topic branch_ and allows users to
associate a branch of code with the ticket.

It is a best practice to have your commit message have a _summary
line_ that includes the ticket number, 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.

[GH-1757] - platform_family and style

* use platform_family for platform checking
* update notifies syntax to "resource_type[resource_name]" instead of
resources() lookup
* GH-692 - delete config files dropped off by packages in conf.d
* dropped debian 4 support because all other platforms have the same
values, and it is older than "old stable" debian release

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

All of my open source cookbook projects are available on
[Github](http://github.com/bflad).

I don't require you to use Github, and I will even take patch diffs
attached to issues. 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.

### More information

Additional help with git is available on the
[Working with Git](http://wiki.opscode.com/display/chef/Working+with+Git)
wiki page.

## 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 Kitchenfile, 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.

## Release Cycle

The versioning for my projects is X.Y.Z and uses [Semantic Versioning](http://semver.org/).

* X is a major release, which may not be fully compatible with prior
major releases
* Y is a minor release, which adds both new features and bug fixes
* Z is a patch release, which adds just bug fixes

## Working with the community

These resources will help you learn more about Chef and connect to
other members of the Chef community:

* [chef](http://lists.opscode.com/sympa/info/chef) and
[chef-dev](http://lists.opscode.com/sympa/info/chef-dev) mailing
lists
* #chef and #chef-hacking IRC channels on irc.freenode.net
* [Community Cookbook site](http://community.opscode.com)
* [Chef wiki](http://wiki.opscode.com/display/chef)
* Opscode Chef [product page](http://www.opscode.com/chef)

## 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, Opscode
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.
Opscode will update the CHANGELOG.md when releasing a new version of
the cookbook.
21 changes: 21 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
source "https://rubygems.org"

gem 'berkshelf', '~> 2.0'
gem 'chefspec', '~> 3.1'
gem 'foodcritic', '~> 3.0'
gem 'rubocop', '~> 0.17'

# group :development do
# gem 'guard', '~> 2.0'
# gem 'guard-kitchen'
# gem 'guard-rubocop', '~> 1.0'
# gem 'guard-rspec', '~> 3.0'
# gem 'rb-inotify', :require => false
# gem 'rb-fsevent', :require => false
# gem 'rb-fchange', :require => false
# end

group :integration do
gem 'test-kitchen', '~> 1.0.0'
gem 'kitchen-vagrant', '~> 0.14'
end
12 changes: 12 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# A sample Guardfile
# 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
11 changes: 11 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
58 changes: 58 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# chef-aufs [![Build Status](https://secure.travis-ci.org/bflad/chef-aufs.png?branch=master)](http://travis-ci.org/bflad/chef-aufs)

## Description

Installs/Configures AUFS.

## Requirements

### Chef

* Chef 11+

### Platforms

* Ubuntu 12.04, 12.10, 13.04, 13.10

### Cookbooks

[Opscode Cookbooks](https://github.com/opscode-cookbooks/)

* [apt](https://github.com/opscode-cookbooks/apt)

Third-Party Cookbooks

* [modules](https://github.com/Youscribe/modules-cookbook)

## Attributes

None currently.

## Recipes

* `recipe[aufs]` Installs/Configures AUFS
* `recipe[aufs::module]` Loads AUFS Linux module
* `recipe[aufs::package]` Installs AUFS via package

## Usage

### Default Installation

* Add `recipe[aufs]` to your node's run list

## Testing and Development

* Quickly testing with Vagrant: [VAGRANT.md](VAGRANT.md)
* Full development and testing workflow with Test Kitchen and friends: [TESTING.md](TESTING.md)

## Contributing

Please see contributing information in: [CONTRIBUTING.md](CONTRIBUTING.md)

## Maintainers

* Brian Flad (<bflad417@gmail.com>)

## License

Please see licensing information in: [LICENSE](LICENSE)
41 changes: 41 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env rake

task :default => 'foodcritic'

desc "Runs foodcritic linter"
task :foodcritic do
Rake::Task[:prepare_sandbox].execute

if Gem::Version.new("1.9.2") <= Gem::Version.new(RUBY_VERSION.dup)
sh "foodcritic -f any #{sandbox_path}"
else
puts "WARN: foodcritic run is skipped as Ruby #{RUBY_VERSION} is < 1.9.2."
end
end

desc "Runs knife cookbook test"
task :knife do
Rake::Task[:prepare_sandbox].execute

sh "bundle exec knife cookbook test cookbook -c test/.chef/knife.rb -o #{sandbox_path}/../"
end

task :prepare_sandbox do
files = %w{*.md *.rb attributes definitions libraries files providers recipes resources templates}

rm_rf sandbox_path
mkdir_p sandbox_path
cp_r Dir.glob("{#{files.join(',')}}"), sandbox_path
end

begin
require 'kitchen/rake_tasks'
Kitchen::RakeTasks.new
rescue LoadError
puts ">>>>> Kitchen gem not loaded, omitting tasks" unless ENV['CI']
end

private
def sandbox_path
File.join(File.dirname(__FILE__), %w(tmp cookbooks cookbook))
end
Loading

0 comments on commit 78d81fb

Please sign in to comment.