Showing with 166 additions and 88 deletions.
  1. +3 −0 .gitignore
  2. +13 −14 .gitlab-ci.yml
  3. +5 −0 .pdkignore
  4. +0 −23 .project
  5. +13 −2 .rubocop.yml
  6. +3 −0 .sync.yml
  7. +20 −18 .travis.yml
  8. +6 −0 .vscode/extensions.json
  9. +9 −0 CHANGELOG.md
  10. +1 −0 CODEOWNERS
  11. +13 −12 Gemfile
  12. +1 −1 README.md
  13. +2 −0 REFERENCE.md
  14. +13 −3 Rakefile
  15. +1 −0 data/common.yaml
  16. +21 −0 hiera.yaml
  17. +11 −6 lib/puppet/provider/zfs/zfs.rb
  18. +9 −1 lib/puppet/provider/zpool/zpool.rb
  19. +6 −0 lib/puppet/type/zfs.rb
  20. +5 −5 metadata.json
  21. +1 −0 spec/default_facts.yml
  22. +8 −1 spec/spec_helper.rb
  23. +1 −1 spec/unit/provider/zfs/zfs_spec.rb
  24. +1 −1 spec/unit/type/zfs_spec.rb
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
.rspec
appveyor.yml
27 changes: 13 additions & 14 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,27 @@ before_script:
- bundle -v
- bundle install --without system_tests --path vendor/bundle --jobs $(nproc)

parallel_spec-Ruby 2.1.9-Puppet ~> 4.0:
stage: unit
image: ruby:2.1.9
syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.5.3-Puppet ~> 6:
stage: syntax
image: ruby:2.5.3
script:
- bundle exec rake parallel_spec
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
variables:
PUPPET_GEM_VERSION: '~> 4.0'
RUBYGEMS_VERSION: '2.7.8'
PUPPET_GEM_VERSION: '~> 6'

syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop-Ruby 2.4.4-Puppet ~> 5.5:
stage: syntax
image: ruby:2.4.4
parallel_spec-Ruby 2.5.3-Puppet ~> 6:
stage: unit
image: ruby:2.5.3
script:
- bundle exec rake syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
- bundle exec rake parallel_spec
variables:
PUPPET_GEM_VERSION: '~> 5.5'
PUPPET_GEM_VERSION: '~> 6'

parallel_spec-Ruby 2.4.4-Puppet ~> 5.5:
parallel_spec-Ruby 2.4.5-Puppet ~> 5:
stage: unit
image: ruby:2.4.4
image: ruby:2.4.5
script:
- bundle exec rake parallel_spec
variables:
PUPPET_GEM_VERSION: '~> 5.5'
PUPPET_GEM_VERSION: '~> 5'

5 changes: 5 additions & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
/convert_report.txt
/update_report.txt
.DS_Store
.project
.envrc
/inventory.yaml
/appveyor.yml
/.fixtures.yml
/Gemfile
Expand All @@ -30,8 +33,10 @@
/.gitlab-ci.yml
/.pdkignore
/Rakefile
/rakelib/
/.rspec
/.rubocop.yml
/.travis.yml
/.yardopts
/spec/
/.vscode/
23 changes: 0 additions & 23 deletions .project

This file was deleted.

15 changes: 13 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
---
require: rubocop-rspec
require:
- rubocop-rspec
- rubocop-i18n
AllCops:
DisplayCopNames: true
TargetRubyVersion: '2.1'
Expand All @@ -19,10 +21,13 @@ AllCops:
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
GetText:
Enabled: false
GetText/DecorateString:
Description: We don't want to decorate test output.
Exclude:
- spec/*
- spec/**/*
Enabled: false
RSpec/BeforeAfterAll:
Description: Beware of using after(:all) as it may cause state to leak between tests.
A necessary evil in acceptance testing.
Expand Down Expand Up @@ -86,6 +91,12 @@ Style/MethodCalledOnDoEndBlock:
Enabled: true
Style/StringMethods:
Enabled: true
GetText/DecorateFunctionMessage:
Enabled: false
GetText/DecorateStringFormattingUsingInterpolation:
Enabled: false
GetText/DecorateStringFormattingUsingPercent:
Enabled: false
Layout/EndOfLine:
Enabled: false
Layout/IndentHeredoc:
Expand Down
3 changes: 3 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ spec/spec_helper.rb:
required:
- '.rspec'
- 'appveyor.yml'

Rakefile:
changelog_version_tag_pattern: '%s'
38 changes: 20 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
dist: trusty
dist: xenial
language: ruby
cache: bundler
before_install:
Expand All @@ -12,32 +12,34 @@ script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- 2.5.1
env:
global:
- BEAKER_PUPPET_COLLECTION=puppet6 PUPPET_GEM_VERSION="~> 6.0"
- 2.5.3
stages:
- static
- spec
- acceptance
-
if: tag =~ ^v\d
name: deploy
matrix:
fast_finish: true
include:
-
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
-
env: CHECK=parallel_spec
env: CHECK="check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop syntax lint metadata_lint"
stage: static
-
env: PUPPET_GEM_VERSION="~> 5.0" CHECK=parallel_spec
rvm: 2.4.4
rvm: 2.4.5
stage: spec
-
env: PUPPET_GEM_VERSION="~> 6.0" CHECK=parallel_spec
rvm: 2.5.3
stage: spec
-
env: DEPLOY_TO_FORGE=yes
stage: deploy
branches:
only:
- master
- /^v\d/
notifications:
email: false
deploy:
provider: puppetforge
user: puppet
password:
secure: ""
on:
tags: true
all_branches: true
condition: "$DEPLOY_TO_FORGE = yes"
6 changes: 6 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"recommendations": [
"jpogran.puppet-vscode",
"rebornix.Ruby"
]
}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## [1.0.3](https://github.com/puppetlabs/puppetlabs-zfs_core/tree/1.0.3) (2019-10-31)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-zfs_core/compare/1.0.2...1.0.3)

### Added

- \(MODULES-8823\) Add support for overlay option in zfs on Linux [\#22](https://github.com/puppetlabs/puppetlabs-zfs_core/pull/22) ([GabrielNagy](https://github.com/GabrielNagy))
- Use "zpool status -P" instead of "zpool status" [\#14](https://github.com/puppetlabs/puppetlabs-zfs_core/pull/14) ([bluthg](https://github.com/bluthg))

## [1.0.2](https://github.com/puppetlabs/puppetlabs-zfs_core/tree/1.0.2) (2019-02-12)

[Full Changelog](https://github.com/puppetlabs/puppetlabs-zfs_core/compare/1.0.1...1.0.2)
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @puppetlabs/night-s-watch
25 changes: 13 additions & 12 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,19 @@ ruby_version_segments = Gem::Version.new(RUBY_VERSION.dup).segments
minor_version = ruby_version_segments[0..1].join('.')

group :development do
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "puppet-module-posix-default-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-strings", require: false
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
gem "fast_gettext", '1.1.0', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.1.0')
gem "fast_gettext", require: false if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.1.0')
gem "json_pure", '<= 2.0.1', require: false if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new('2.0.0')
gem "json", '= 1.8.1', require: false if Gem::Version.new(RUBY_VERSION.dup) == Gem::Version.new('2.1.9')
gem "json", '= 2.0.4', require: false if Gem::Requirement.create('~> 2.4.2').satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "json", '= 2.1.0', require: false if Gem::Requirement.create(['>= 2.5.0', '< 2.7.0']).satisfied_by?(Gem::Version.new(RUBY_VERSION.dup))
gem "rb-readline", '= 0.5.5', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-posix-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
gem "puppet-module-posix-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", '~> 0.3', require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-strings", require: false
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
end
group :system_tests do
gem "puppet-module-posix-system-r#{minor_version}", require: false, platforms: [:ruby]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ Puppet Labs modules on the Puppet Forge are open projects, and community contrib

We want to keep it as easy as possible to contribute changes so that our modules work in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things.

For more information, see our [module contribution guide.](https://docs.puppetlabs.com/forge/contributing.html)
For more information, see our [module contribution guide.](https://puppet.com/docs/puppet/latest/contributing.html)
2 changes: 2 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ Default value: present
##### `disk`

The disk(s) for this pool. Can be an array or a space separated string.
Use disk/device names as displayed by "zpool status". On Linux/ZOL, use
full device pathes as displayed by "zpool status -P".

##### `mirror`

Expand Down
16 changes: 13 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
Expand All @@ -14,15 +15,24 @@ end

def changelog_project
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = nil || JSON.load(File.read('metadata.json'))['name']
raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil?

returnVal = nil
returnVal ||= begin
metadata_source = JSON.load(File.read('metadata.json'))['source']
metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})

metadata_source_match && metadata_source_match[1]
end

raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?

puts "GitHubChangelogGenerator project:#{returnVal}"
returnVal
end

def changelog_future_release
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = JSON.load(File.read('metadata.json'))['version']
returnVal = "%s" % JSON.load(File.read('metadata.json'))['version']
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator future_release:#{returnVal}"
returnVal
Expand Down
1 change: 1 addition & 0 deletions data/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
---
21 changes: 21 additions & 0 deletions hiera.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
version: 5

defaults: # Used for any hierarchy level that omits these keys.
datadir: data # This path is relative to hiera.yaml's directory.
data_hash: yaml_data # Use the built-in YAML backend.

hierarchy:
- name: "osfamily/major release"
paths:
- "os/%{facts.os.family}/%{facts.os.release.major}.yaml"
# Used for Solaris
- "os/%{facts.os.family}/%{facts.kernelrelease}.yaml"
# Used to distinguish between Debian and Ubuntu
- "os/%{facts.os.name}/%{facts.os.release.major}.yaml"
- name: "osfamily"
paths:
- "os/%{facts.os.family}.yaml"
- "os/%{facts.os.name}.yaml"
- name: 'common'
path: 'common.yaml'
17 changes: 11 additions & 6 deletions lib/puppet/provider/zfs/zfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,17 @@ def container_property
end
end

[:aclinherit, :atime, :canmount, :checksum,
:compression, :copies, :dedup, :devices, :exec, :logbias,
:mountpoint, :nbmand, :primarycache, :quota, :readonly,
:recordsize, :refquota, :refreservation, :reservation,
:secondarycache, :setuid, :sharenfs, :sharesmb,
:snapdir, :version, :volsize, :vscan, :xattr].each do |field|
zfs_properties = [:aclinherit, :atime, :canmount, :checksum,
:compression, :copies, :dedup, :devices, :exec, :logbias,
:mountpoint, :nbmand, :primarycache, :quota, :readonly,
:recordsize, :refquota, :refreservation, :reservation,
:secondarycache, :setuid, :sharenfs, :sharesmb,
:snapdir, :version, :volsize, :vscan, :xattr]

# The overlay property is only supported on Linux
zfs_properties << :overlay if Facter.value(:kernel) == 'Linux'

zfs_properties.each do |field|
define_method(field) do
zfs(:get, '-H', '-o', 'value', field, @resource[:name]).strip
end
Expand Down
10 changes: 9 additions & 1 deletion lib/puppet/provider/zpool/zpool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,15 @@ def process_zpool_data(pool_array)
def get_pool_data
# https://docs.oracle.com/cd/E19082-01/817-2271/gbcve/index.html
# we could also use zpool iostat -v mypool for a (little bit) cleaner output
out = execute("zpool status #{@resource[:pool]}", failonfail: false, combine: false)
zpool_opts = case Facter.value(:kernel)
# use full device names ("-P") on Linux/ZOL to prevent
# mismatches between creation and display paths:
when 'Linux'
'-P'
else
''
end
out = execute("zpool status #{zpool_opts} #{@resource[:pool]}", failonfail: false, combine: false)
zpool_data = out.lines.select { |line| line.index("\t") == 0 }.map { |l| l.strip.split("\s")[0] }
zpool_data.shift
zpool_data
Expand Down
6 changes: 6 additions & 0 deletions lib/puppet/type/zfs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ module Puppet
desc 'The nbmand property. Valid values are `on`, `off`.'
end

if Facter.value(:kernel) == 'Linux'
newproperty(:overlay) do
desc 'The overlay property. Valid values are `on`, `off`.'
end
end

newproperty(:primarycache) do
desc 'The primarycache property. Valid values are `all`, `none`, `metadata`.'
end
Expand Down
Loading