Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #2

Merged
merged 13 commits into from
Nov 13, 2017
1 change: 1 addition & 0 deletions .delivery/project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
remote_file = "https://raw.githubusercontent.com/chef-cookbooks/community_cookbook_tools/master/delivery/project.toml"
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ vendor/
.coverage/
.zero-knife.rb
Policyfile.lock.json
Cheffile.lock
.librarian/

# vagrant stuff
.vagrant/
Expand Down
17 changes: 8 additions & 9 deletions .kitchen.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
---
driver:
name: vagrant

provisioner:
name: chef_zero
product: chef-client
channel: stable
version: 12.21.12
deprecations_as_errors: true

verifier:
name: inspec

platforms:
- name: ubuntu-16.04
- name: freebsd-10.4
- name: freebsd-11.1
- name: freebsd-10
- name: freebsd-11
- name: solaris-11
driver:
box: chef/solaris-11.3
- name: ubuntu-16.04

suites:
- name: default
run_list:
- recipe[zfs_test::default]
attributes:
- recipe[test::default]
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,15 @@ addons:
# Don't `bundle install` which takes about 1.5 mins
install: echo "skip bundle install"

branches:
only:
- master

before_script:
- eval "$(/opt/chefdk/bin/chef shell-init bash)"

script:
- /opt/chefdk/embedded/bin/chef --version
- /opt/chefdk/embedded/bin/cookstyle --version
- /opt/chefdk/embedded/bin/foodcritic --version
- /opt/chefdk/bin/chef exec rake
- chef --version
- cookstyle --version
- foodcritic --version
- chef exec delivery local all
3 changes: 1 addition & 2 deletions Berksfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@ source 'https://supermarket.chef.io'
metadata

group :integration do
cookbook 'zfs_test', path: './test/fixtures/zfs_test'
cookbook 'chef_zpool', git: 'https://github.com/chef-cookbooks/zpool', branch: 'Issue-5/refactor-for-chef-13'
cookbook 'test', path: './test/fixtures/test'
end
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# chef_zfs Cookbook CHANGELOG

This file is used to list changes made in each version of the chef_zfs cookbook.

2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Please refer to
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# This gemfile provides additional gems for testing and releasing this cookbook
# It is meant to be installed on top of ChefDK which provides the majority
# of the necessary gems for testing this cookbook
#
# Run 'chef exec bundle install' to install these dependencies

source 'https://rubygems.org'

gem 'community_cookbook_releaser'
70 changes: 55 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,43 @@
[![Build Status](https://secure.travis-ci.org/marthag8/zfs.png)](http://travis-ci.org/marthag8/zfs)
# chef_zpool Cookbook

Description
===========
[![Build Status](https://travis-ci.org/chef-cookbooks/chef_zfs.svg?branch=master)](https://travis-ci.org/chef-cookbooks/chef_zfs) [![Cookbook Version](https://img.shields.io/cookbook/v/chef_zfs.svg)](https://supermarket.chef.io/cookbooks/chef_zfs)

Manage ZFS filesystems.
A resource for managing ZFS filesystems. This cookbook is forked from the original zfs cookbook by Martha Greenberg at <https://github.com/marthag8/zfs>.

Requirements
============
## Requirements

A valid zpool. This can be managed with the zpool cookbook.
### Platforms

Properties
==========
- Ubuntu
- FreeBSD
- Solaris

- `properties`: ZFS properties are set as an Hrray of Hashes to configure the filesystems using the single `properties` attribute.
### Chef

- Chef 12.7+

Usage
=====
### Cookbooks

- none

## Resources

### zfs

#### Actions

- `:create`
- `:upgrade`
- `:destroy`

#### Properties

- `properties`: ZFS properties are set as an Hrray of Hashes to configure the filesystems using the single `properties` attribute.

#### Examples

##### Creating a ZFS Filesytem

### Creating a ZFS Filesytem
```ruby
zfs "tank/test" do
properties [
Expand All @@ -31,7 +49,7 @@ zfs "tank/test" do
end
```

### Upgrading a ZFS to the latest filesystem version:
##### Upgrading a ZFS to the latest filesystem version:

```ruby
zfs "tank/test" do
Expand All @@ -50,7 +68,7 @@ zfs "tank/test" do
end
```

### Destroying a ZFS Filesystem
##### Destroying a ZFS Filesystem

```ruby
zfs "tank/test" do
Expand All @@ -73,3 +91,25 @@ zfs filesystem.name do
action :destroy
end
```

## Maintainers

This cookbook is maintained by Chef's Community Cookbook Engineering team. Our goal is to improve cookbook quality and to aid the community in contributing to cookbooks. To learn more about our team, process, and design goals see our [team documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/COOKBOOK_TEAM.MD). To learn more about contributing to cookbooks like this see our [contributing documentation](https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/CONTRIBUTING.MD), or if you have general questions about this cookbook come chat with us in #cookbok-engineering on the [Chef Community Slack](http://community-slack.chef.io/)

## License

**Copyright:** 2012-2017, Martha Greenberg **Copyright:** 2017, Chef Software, Inc.

```
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.
```
30 changes: 0 additions & 30 deletions Rakefile

This file was deleted.

2 changes: 2 additions & 0 deletions TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Please refer to
https://github.com/chef-cookbooks/community_cookbook_documentation/blob/master/TESTING.MD
21 changes: 6 additions & 15 deletions chefignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,19 @@ a.out

# Testing #
###########
.watchr
.rspec
spec/*
spec/fixtures/*
test/*
features/*
examples/*
Guardfile
Procfile
.kitchen*
.rubocop.yml
spec/*
Rakefile
.travis.yml
.foodcritic
.codeclimate.yml
appveyor.yml

# SCM #
#######
Expand All @@ -82,20 +79,14 @@ Berksfile.lock
cookbooks/*
tmp

# Policyfile #
##############
Policyfile.rb
Policyfile.lock.json

# Cookbooks #
#############
CONTRIBUTING*
CHANGELOG*
TESTING*

# Strainer #
############
Colanderfile
Strainerfile
.colander
.strainer

# Vagrant #
###########
.vagrant
Vagrantfile
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@
supports os
end

chef_version '>= 12.11'
chef_version '>= 12.7'
11 changes: 4 additions & 7 deletions resources/default.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# -*- encoding: utf-8 -*-
#
# Author:: Ryan Hass (<[email protected]>)
# Author:: Ryan Hass (<[email protected]>)
# Author:: Martha Greenberg (<[email protected]>)
#
# Copyright (C) 2017, Chef Software Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -17,9 +16,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

require 'mixlib/shellout'

provides :zfs
resource_name :zfs
property :properties, Array

load_current_value do
Expand All @@ -32,11 +29,11 @@
zfs_set_properties(name, new_resource.properties) unless new_resource.properties.nil?
else
cmd = %w(zfs create)
properties.each do |setting|
new_resource.properties.each do |setting|
key = setting.keys.first
cmd << '-o'
cmd << "#{key}=#{setting[key]}"
end unless properties.nil?
end unless new_resource.properties.nil?
cmd << new_resource.name

execute 'zfs_create' do
Expand Down
Empty file added spec/.gitkeep
Empty file.
6 changes: 6 additions & 0 deletions test/fixtures/test/metadata.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name 'test'
license 'Apache-2.0'
version '0.1.0'

depends 'chef_zfs'
depends 'chef_zpool'
Loading