Initial basic cookbook files

This is the first commit to setup basic cookbook files for
cookbook-openstack-bare-metal.
This cookbook begins with Kilo release.

Change-Id: I4a59357eb9e13912d97a195c0d2494d4f17aad11
This commit is contained in:
wenchma 2015-01-06 11:03:39 +08:00
parent 5e68273665
commit 001ae7fe6d
11 changed files with 256 additions and 0 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
.bundle/
berks-cookbooks/
.kitchen
.vagrant
.coverage/
*.swp
Berksfile.lock
Gemfile.lock
Vagrantfile

25
.rubocop.yml Normal file
View File

@ -0,0 +1,25 @@
AllCops:
Includes:
- metadata.rb
- Gemfile
- attributes/**
- libraries/**
- providers/**
- recipes/**
- resources/**
- spec/**
Encoding:
Exclude:
- metadata.rb
- Gemfile
- berks-cookbooks/**
NumericLiterals:
Enabled: false
LineLength:
Enabled: false
WordArray:
MinSize: 3

6
Berksfile Normal file
View File

@ -0,0 +1,6 @@
source "https://supermarket.getchef.com"
metadata
cookbook "openstack-common",
github: "stackforge/cookbook-openstack-common"

13
CHANGELOG.md Normal file
View File

@ -0,0 +1,13 @@
cookbook-openstack-bare-metal CHANGELOG
=======================================
This file is used to list changes made in each version of the cookbook-openstack-bare-metal cookbook.
11.0.0
-----
- Initial release of cookbook-openstack-bare-metal for Kilo
- - -
Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.

36
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,36 @@
Contributing
============
How To Get Started
------------------
If you would like to contribute to the development of OpenStack Chef Cookbooks,
you must follow the steps in this page:
http://docs.openstack.org/infra/manual/developers.html
Gerrit Workflow
---------------
Once those steps have been completed, changes to OpenStack
should be submitted for review via the Gerrit tool, following
the workflow documented at:
http://docs.openstack.org/infra/manual/developers.html#development-workflow
Pull requests submitted through GitHub will be ignored.
Bugs
----
Bugs should be filed on Launchpad, not GitHub:
https://bugs.launchpad.net/openstack-chef
Contacts
--------
Mailing list: groups.google.com/group/opscode-chef-openstack
IRC: #openstack-chef is our channel on irc.freenode.net
Wiki: https://wiki.openstack.org/wiki/Chef/GettingStarted and https://docs.getchef.com/openstack.html
Twitter: @chefopenstack

11
Gemfile Normal file
View File

@ -0,0 +1,11 @@
source 'https://rubygems.org'
gem 'chef', '~> 11.16.0'
gem 'json', '<= 1.7.7' # chef 11 dependency
gem 'berkshelf', '~> 3.1.5'
gem 'hashie', '~> 2.0'
gem 'chefspec', '~> 4.0.0'
gem 'rspec', '~> 3.0.0'
gem 'fauxhai', '>= 2.1.0'
gem 'foodcritic', '~> 4.0.0'
gem 'rubocop', '~> 0.18.1'

55
README.md Normal file
View File

@ -0,0 +1,55 @@
cookbook-openstack-bare-metal Cookbook
======================================
This cookbook installs the OpenStack Bare Metal service **Ironic** as part of
the OpenStack reference deployment Chef for OpenStack. Ironic is currently
installed from packages.
https://wiki.openstack.org/wiki/Ironic
Requirements
------------
Chef 11 or higher required (for Chef environment use).
Attributes
----------
TODO: List your cookbook attributes here.
Usage
-----
#### cookbook-openstack-bare-metal::default
TODO: Write usage instructions for each cookbook.
Contributing
------------
Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) for instructions for contributing.
Testing
-------
Please refer to the [TESTING.md](TESTING.md) for instructions for testing the cookbook.
License and Authors
-------------------
| | |
|:---------------------|:---------------------------------------------------|
| **Author** | Wen Cheng Ma(<wenchma@cn.ibm.com>) |
| | |
| **Copyright** | Copyright (c) 2014-2015, IBM, Corp. |
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.

40
Rakefile Normal file
View File

@ -0,0 +1,40 @@
task default: ["test"]
task :test => [:lint, :style, :unit]
desc "Bundler preparation"
task :bundler_prep do
mkdir_p '.bundle'
sh %{bundle install --path=.bundle --jobs 1 --retry 3 --verbose}
end
desc "Bershelf preparation"
task :berks_prep => :bundler_prep do
sh %{bundle exec berks vendor}
end
desc "Foodcritic linting"
task :lint => :bundler_prep do
sh %{bundle exec foodcritic --epic-fail any --tags ~FC003 --tags ~FC023 .}
end
desc "Rubocop style checking"
task :style => :bundler_prep do
sh %{bundle exec rubocop}
end
desc "Unit testing"
task :unit => :berks_prep do
sh %{bundle exec rspec --format documentation}
end
desc "Clean up working directory"
task :clean do
rm_rf [
'.bundle',
'berks-cookbooks',
'Gemfile.lock',
'Berksfile.lock'
]
end

30
TESTING.md Normal file
View File

@ -0,0 +1,30 @@
# Testing the Cookbook #
This cookbook uses [bundler](http://gembundler.com/) and [berkshelf](http://berkshelf.com/) to isolate dependencies. Make sure you have `ruby 1.9.x`, `bundler`, `rake`, build essentials and the header files for `gecode` installed before continuing. Make sure that you're using gecode version 3. More info [here](https://github.com/opscode/dep-selector-libgecode/tree/0bad63fea305ede624c58506423ced697dd2545e#using-a-system-gecode-instead).
We have three test suites which you can run individually (there are three rake tasks):
$ rake lint
$ rake style
$ rake unit
or altogether:
$ rake test
The `rake` tasks will take care of installing the needed gem dependencies and cookbooks with `berkshelf`.
## Rubocop ##
[Rubocop](https://github.com/bbatsov/rubocop) is a static Ruby code analyzer, based on the community [Ruby style guide](https://github.com/bbatsov/ruby-style-guide). We are attempting to adhere to this where applicable, slowly cleaning up the cookbooks until we can turn on Rubocop for gating the commits.
## Foodcritic ##
[Foodcritic](http://acrmp.github.io/foodcritic/) is a lint tool for Chef cookbooks. We ignore the following rules:
* [FC003](http://acrmp.github.io/foodcritic/#FC003) These cookbooks are not intended for Chef Solo.
* [FC023](http://acrmp.github.io/foodcritic/#FC023) Prefer conditional attributes.
## Chefspec
[ChefSpec](https://github.com/sethvargo/chefspec/) is a unit testing framework for testing Chef cookbooks. ChefSpec makes it easy to write examples and get fast feedback on cookbook changes without the need for virtual machines or cloud servers.

9
metadata.rb Normal file
View File

@ -0,0 +1,9 @@
name 'openstack-bare-metal'
maintainer 'openstack-chef'
maintainer_email 'opscode-chef-openstack@googlegroups.com'
license 'Apache 2.0'
description 'Installs/Configures OpenStack Bare Metal service Ironic'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version '11.0.0'
depends 'openstack-common', '~> 10.0'

22
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,22 @@
# encoding: UTF-8
require 'chefspec'
require 'chefspec/berkshelf'
require 'chef/application'
LOG_LEVEL = :fatal
SUSE_OPTS = {
platform: 'suse',
version: '11.3',
log_level: ::LOG_LEVEL
}
REDHAT_OPTS = {
platform: 'redhat',
version: '7.0',
log_level: ::LOG_LEVEL
}
UBUNTU_OPTS = {
platform: 'ubuntu',
version: '14.04',
log_level: ::LOG_LEVEL
}