New Upstream Release - puppet-module-camptocamp-kmod
Ready changes
Summary
Merged new upstream version: 2.5.0 (was: 2.1.1).
Resulting package
Built on 2023-04-10T09:20 (took 9m10s)
The resulting binary packages can be installed (if you have the apt repository enabled) by running one of:
apt install -t fresh-releases puppet-module-camptocamp-kmod
Lintian Result
Diff
diff --git a/.fixtures.yml b/.fixtures.yml
index f172a19..cd875ab 100644
--- a/.fixtures.yml
+++ b/.fixtures.yml
@@ -1,4 +1,8 @@
fixtures:
+ forge_modules:
+ augeas_core:
+ repo: "puppetlabs/augeas_core"
+ puppet_version: '>= 6.0.0'
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
symlinks:
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..9032a01
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,5 @@
+*.rb eol=lf
+*.erb eol=lf
+*.pp eol=lf
+*.sh eol=lf
+*.epp eol=lf
diff --git a/.gitignore b/.gitignore
index 65839fa..2767022 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,27 @@
-pkg/
-Gemfile.lock
-vendor/
-spec/fixtures/
-.vagrant/
-.bundle/
-coverage/
-log/
-.*.swp
-*~
+.git/
+.*.sw[op]
+.metadata
+.yardoc
+.yardwarns
+*.iml
+/.bundle/
+/.idea/
+/.vagrant/
+/coverage/
+/bin/
+/doc/
+/Gemfile.local
+/Gemfile.lock
+/junit/
+/log/
+/pkg/
+/spec/fixtures/manifests/
+/spec/fixtures/modules/
+/tmp/
+/vendor/
+/convert_report.txt
+/update_report.txt
+.DS_Store
+.project
+.envrc
+/inventory.yaml
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..81e6d76
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,41 @@
+---
+stages:
+ - syntax
+ - unit
+
+cache:
+ paths:
+ - vendor/bundle
+
+before_script:
+ - bundle -v
+ - rm Gemfile.lock || true
+ - gem update --system $RUBYGEMS_VERSION
+ - gem --version
+ - bundle -v
+ - bundle install --without system_tests --path vendor/bundle --jobs $(nproc)
+
+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 syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
+ variables:
+ PUPPET_GEM_VERSION: '~> 6'
+
+parallel_spec-Ruby 2.5.3-Puppet ~> 6:
+ stage: unit
+ image: ruby:2.5.3
+ script:
+ - bundle exec rake parallel_spec
+ variables:
+ PUPPET_GEM_VERSION: '~> 6'
+
+parallel_spec-Ruby 2.4.5-Puppet ~> 5:
+ stage: unit
+ image: ruby:2.4.5
+ script:
+ - bundle exec rake parallel_spec
+ variables:
+ PUPPET_GEM_VERSION: '~> 5'
+
diff --git a/.pdkignore b/.pdkignore
new file mode 100644
index 0000000..e6215cd
--- /dev/null
+++ b/.pdkignore
@@ -0,0 +1,42 @@
+.git/
+.*.sw[op]
+.metadata
+.yardoc
+.yardwarns
+*.iml
+/.bundle/
+/.idea/
+/.vagrant/
+/coverage/
+/bin/
+/doc/
+/Gemfile.local
+/Gemfile.lock
+/junit/
+/log/
+/pkg/
+/spec/fixtures/manifests/
+/spec/fixtures/modules/
+/tmp/
+/vendor/
+/convert_report.txt
+/update_report.txt
+.DS_Store
+.project
+.envrc
+/inventory.yaml
+/appveyor.yml
+/.fixtures.yml
+/Gemfile
+/.gitattributes
+/.gitignore
+/.gitlab-ci.yml
+/.pdkignore
+/Rakefile
+/rakelib/
+/.rspec
+/.rubocop.yml
+/.travis.yml
+/.yardopts
+/spec/
+/.vscode/
diff --git a/.puppet-lint.rc b/.puppet-lint.rc
index d8f5c59..cc96ece 100644
--- a/.puppet-lint.rc
+++ b/.puppet-lint.rc
@@ -1,5 +1 @@
---fail-on-warnings
--relative
---no-80chars
---no-documentation
---no-class_inherits_from_params_class-check
diff --git a/.rspec b/.rspec
new file mode 100644
index 0000000..16f9cdb
--- /dev/null
+++ b/.rspec
@@ -0,0 +1,2 @@
+--color
+--format documentation
diff --git a/.rubocop.yml b/.rubocop.yml
new file mode 100644
index 0000000..bab25db
--- /dev/null
+++ b/.rubocop.yml
@@ -0,0 +1,133 @@
+---
+require:
+- rubocop-rspec
+- rubocop-i18n
+AllCops:
+ DisplayCopNames: true
+ TargetRubyVersion: '2.1'
+ Include:
+ - "./**/*.rb"
+ Exclude:
+ - bin/*
+ - ".vendor/**/*"
+ - "**/Gemfile"
+ - "**/Rakefile"
+ - pkg/**/*
+ - spec/fixtures/**/*
+ - vendor/**/*
+ - "**/Puppetfile"
+ - "**/Vagrantfile"
+ - "**/Guardfile"
+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/**/*
+ 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.
+ Exclude:
+ - spec/acceptance/**/*.rb
+RSpec/HookArgument:
+ Description: Prefer explicit :each argument, matching existing module's style
+ EnforcedStyle: each
+Style/BlockDelimiters:
+ Description: Prefer braces for chaining. Mostly an aesthetical choice. Better to
+ be consistent then.
+ EnforcedStyle: braces_for_chaining
+Style/ClassAndModuleChildren:
+ Description: Compact style reduces the required amount of indentation.
+ EnforcedStyle: compact
+Style/EmptyElse:
+ Description: Enforce against empty else clauses, but allow `nil` for clarity.
+ EnforcedStyle: empty
+Style/FormatString:
+ Description: Following the main puppet project's style, prefer the % format format.
+ EnforcedStyle: percent
+Style/FormatStringToken:
+ Description: Following the main puppet project's style, prefer the simpler template
+ tokens over annotated ones.
+ EnforcedStyle: template
+Style/Lambda:
+ Description: Prefer the keyword for easier discoverability.
+ EnforcedStyle: literal
+Style/RegexpLiteral:
+ Description: Community preference. See https://github.com/voxpupuli/modulesync_config/issues/168
+ EnforcedStyle: percent_r
+Style/TernaryParentheses:
+ Description: Checks for use of parentheses around ternary conditions. Enforce parentheses
+ on complex expressions for better readability, but seriously consider breaking
+ it up.
+ EnforcedStyle: require_parentheses_when_complex
+Style/TrailingCommaInArguments:
+ Description: Prefer always trailing comma on multiline argument lists. This makes
+ diffs, and re-ordering nicer.
+ EnforcedStyleForMultiline: comma
+Style/TrailingCommaInLiteral:
+ Description: Prefer always trailing comma on multiline literals. This makes diffs,
+ and re-ordering nicer.
+ EnforcedStyleForMultiline: comma
+Style/SymbolArray:
+ Description: Using percent style obscures symbolic intent of array's contents.
+ EnforcedStyle: brackets
+RSpec/MessageSpies:
+ EnforcedStyle: receive
+Style/Documentation:
+ Exclude:
+ - lib/puppet/parser/functions/**/*
+ - spec/**/*
+Style/WordArray:
+ EnforcedStyle: brackets
+Style/CollectionMethods:
+ Enabled: true
+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:
+ Enabled: false
+Metrics/AbcSize:
+ Enabled: false
+Metrics/BlockLength:
+ Enabled: false
+Metrics/ClassLength:
+ Enabled: false
+Metrics/CyclomaticComplexity:
+ Enabled: false
+Metrics/MethodLength:
+ Enabled: false
+Metrics/ModuleLength:
+ Enabled: false
+Metrics/ParameterLists:
+ Enabled: false
+Metrics/PerceivedComplexity:
+ Enabled: false
+RSpec/DescribeClass:
+ Enabled: false
+RSpec/ExampleLength:
+ Enabled: false
+RSpec/MessageExpectation:
+ Enabled: false
+RSpec/MultipleExpectations:
+ Enabled: false
+RSpec/NestedGroups:
+ Enabled: false
+Style/AsciiComments:
+ Enabled: false
+Style/IfUnlessModifier:
+ Enabled: false
+Style/SymbolProc:
+ Enabled: false
diff --git a/.sync.yml b/.sync.yml
index d629485..cc377c9 100644
--- a/.sync.yml
+++ b/.sync.yml
@@ -1,3 +1,10 @@
---
.travis.yml:
- forge_password: "QvaBWqv7ZaB34BzONHPxZy+1OW+eBP4dZmhDobAVFD20kOP4O4QHdCe9kS3y3JRXrNW3wuiuegNzoKb+JvqQrZPQF3Ea0DO4uCPVrnVbrnmGC0p7v2VDA1tsb2snnSMa5mC6+3wYMwS27zRSQ7vN3AwDKMdp/jcPbTEpnv/+314="
+ user: camptocamp
+ secure: "QvaBWqv7ZaB34BzONHPxZy+1OW+eBP4dZmhDobAVFD20kOP4O4QHdCe9kS3y3JRXrNW3wuiuegNzoKb+JvqQrZPQF3Ea0DO4uCPVrnVbrnmGC0p7v2VDA1tsb2snnSMa5mC6+3wYMwS27zRSQ7vN3AwDKMdp/jcPbTEpnv/+314="
+ branches:
+ - master
+ - /^\d/
+ deploy_to_forge:
+ enabled: true
+ tag_regex: "^\\d"
diff --git a/.travis.yml b/.travis.yml
index e5397c5..42aaf0e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,22 +1,46 @@
---
+dist: xenial
language: ruby
-sudo: false
cache: bundler
+before_install:
+ - bundle -v
+ - rm -f Gemfile.lock
+ - gem update --system $RUBYGEMS_VERSION
+ - gem --version
+ - bundle -v
+script:
+ - 'bundle exec rake $CHECK'
bundler_args: --without system_tests
-script: ["bundle exec rake validate", "bundle exec rake lint", "bundle exec rake spec SPEC_OPTS='--format documentation'", "bundle exec rake metadata"]
+rvm:
+ - 2.5.3
+stages:
+ - static
+ - spec
+ - acceptance
+ -
+ if: tag =~ ^\d
+ name: deploy
matrix:
fast_finish: true
include:
- - rvm: 1.8.7
- env: PUPPET_GEM_VERSION="~> 3.0" FACTER_GEM_VERSION="~> 1.7.0"
- - rvm: 1.9.3
- env: PUPPET_GEM_VERSION="~> 3.0"
- - rvm: 2.0.0
- env: PUPPET_GEM_VERSION="~> 3.0"
- - rvm: 2.0.0
- env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes"
- - rvm: 2.1.6
- env: PUPPET_GEM_VERSION="~> 4.0"
+ -
+ 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.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
+ - /^\d/
notifications:
email: false
deploy:
@@ -26,7 +50,5 @@ deploy:
secure: "QvaBWqv7ZaB34BzONHPxZy+1OW+eBP4dZmhDobAVFD20kOP4O4QHdCe9kS3y3JRXrNW3wuiuegNzoKb+JvqQrZPQF3Ea0DO4uCPVrnVbrnmGC0p7v2VDA1tsb2snnSMa5mC6+3wYMwS27zRSQ7vN3AwDKMdp/jcPbTEpnv/+314="
on:
tags: true
- # all_branches is required to use tags
all_branches: true
- # Only publish if our main Ruby target builds
- rvm: 1.9.3
+ condition: "$DEPLOY_TO_FORGE = yes"
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 0000000..6177782
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,6 @@
+{
+ "recommendations": [
+ "jpogran.puppet-vscode",
+ "rebornix.Ruby"
+ ]
+}
diff --git a/.yardopts b/.yardopts
new file mode 100644
index 0000000..29c933b
--- /dev/null
+++ b/.yardopts
@@ -0,0 +1 @@
+--markup markdown
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 54daf6d..455366e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,27 @@
+## 2020-03-09 - Release 2.5.0
+
+* Add support for EL8 [GH #59]
+
+## 2020-01-07 - Release 2.4.0
+
+* Remove augeasversion check [GH #53]
+* Convert to PDK [GH #54]
+
+## 2019-07-30 - Release 2.3.1
+
+* Allow stdlib 6
+
+## 2019-03-01 - Release 2.3.0
+
+* Add hiera class parameters and update documentation [GH #47]
+* kmod::load: load modules the systemd way if the system runs systemd [GH #48]
+* Adapt tests for Puppet 6
+
+## 2017-08-09 - Release 2.2.0
+
+* Add ArchLinux support [GH #39, #40]
+* Fix ensure=absent in alias [GH #42]
+
## 2015-08-27 - Release 2.1.0
Add minimal SuSE support
diff --git a/Gemfile b/Gemfile
index 0cb5933..2aeab8e 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,47 +1,72 @@
-source ENV['GEM_SOURCE'] || "https://rubygems.org"
-
-group :development, :unit_tests do
- gem 'rake', :require => false
- gem 'rspec', '< 3.2', :require => false if RUBY_VERSION =~ /^1.8/
- gem 'rspec-puppet', :require => false
- gem 'puppetlabs_spec_helper', :require => false
- gem 'metadata-json-lint', :require => false
- gem 'puppet-lint', :require => false
- gem 'puppet-lint-unquoted_string-check', :require => false
- gem 'puppet-lint-empty_string-check', :require => false
- gem 'puppet-lint-spaceship_operator_without_tag-check', :require => false
- gem 'puppet-lint-variable_contains_upcase', :require => false
- gem 'puppet-lint-absolute_classname-check', :require => false
- gem 'puppet-lint-undef_in_function-check', :require => false
- gem 'puppet-lint-leading_zero-check', :require => false
- gem 'puppet-lint-trailing_comma-check', :require => false
- gem 'puppet-lint-file_ensure-check', :require => false
- gem 'puppet-lint-version_comparison-check', :require => false
- gem 'puppet-lint-fileserver-check', :require => false
- gem 'puppet-lint-file_source_rights-check', :require => false
- gem 'puppet-lint-alias-check', :require => false
- gem 'rspec-puppet-facts', :require => false
- gem 'github_changelog_generator', :require => false, :git => 'https://github.com/raphink/github-changelog-generator.git', :branch => 'dev/all_patches' if RUBY_VERSION !~ /^1.8/
- gem 'puppet-blacksmith', :require => false if RUBY_VERSION !~ /^1.8/
+source ENV['GEM_SOURCE'] || 'https://rubygems.org'
+
+def location_for(place_or_version, fake_version = nil)
+ git_url_regex = %r{\A(?<url>(https?|git)[:@][^#]*)(#(?<branch>.*))?}
+ file_url_regex = %r{\Afile:\/\/(?<path>.*)}
+
+ if place_or_version && (git_url = place_or_version.match(git_url_regex))
+ [fake_version, { git: git_url[:url], branch: git_url[:branch], require: false }].compact
+ elsif place_or_version && (file_url = place_or_version.match(file_url_regex))
+ ['>= 0', { path: File.expand_path(file_url[:path]), require: false }]
+ else
+ [place_or_version, { require: false }]
+ end
end
-group :system_tests do
- gem 'beaker', :require => false
- gem 'beaker-rspec', :require => false
- gem 'beaker_spec_helper', :require => false
- gem 'serverspec', :require => false
+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 "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]
end
-if facterversion = ENV['FACTER_GEM_VERSION']
- gem 'facter', facterversion, :require => false
-else
- gem 'facter', :require => false
+puppet_version = ENV['PUPPET_GEM_VERSION']
+facter_version = ENV['FACTER_GEM_VERSION']
+hiera_version = ENV['HIERA_GEM_VERSION']
+
+gems = {}
+
+gems['puppet'] = location_for(puppet_version)
+
+# If facter or hiera versions have been specified via the environment
+# variables
+
+gems['facter'] = location_for(facter_version) if facter_version
+gems['hiera'] = location_for(hiera_version) if hiera_version
+
+if Gem.win_platform? && puppet_version =~ %r{^(file:///|git://)}
+ # If we're using a Puppet gem on Windows which handles its own win32-xxx gem
+ # dependencies (>= 3.5.0), set the maximum versions (see PUP-6445).
+ gems['win32-dir'] = ['<= 0.4.9', require: false]
+ gems['win32-eventlog'] = ['<= 0.6.5', require: false]
+ gems['win32-process'] = ['<= 0.7.5', require: false]
+ gems['win32-security'] = ['<= 0.2.5', require: false]
+ gems['win32-service'] = ['0.8.8', require: false]
end
-if puppetversion = ENV['PUPPET_GEM_VERSION']
- gem 'puppet', puppetversion, :require => false
-else
- gem 'puppet', :require => false
+gems.each do |gem_name, gem_params|
+ gem gem_name, *gem_params
end
-# vim:ft=ruby
+# Evaluate Gemfile.local and ~/.gemfile if they exist
+extra_gemfiles = [
+ "#{__FILE__}.local",
+ File.join(Dir.home, '.gemfile'),
+]
+
+extra_gemfiles.each do |gemfile|
+ if File.file?(gemfile) && File.readable?(gemfile)
+ eval(File.read(gemfile), binding)
+ end
+end
+# vim: syntax=ruby
diff --git a/README.md b/README.md
index 5b378db..6dee26a 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,6 @@
[![Puppet Forge Downloads](http://img.shields.io/puppetforge/dt/camptocamp/kmod.svg)](https://forge.puppetlabs.com/camptocamp/kmod)
[![Build Status](https://img.shields.io/travis/camptocamp/puppet-kmod/master.svg)](https://travis-ci.org/camptocamp/puppet-kmod)
[![Puppet Forge Endorsement](https://img.shields.io/puppetforge/e/camptocamp/kmod.svg)](https://forge.puppetlabs.com/camptocamp/kmod)
-[![Gemnasium](https://img.shields.io/gemnasium/camptocamp/puppet-kmod.svg)](https://gemnasium.com/camptocamp/puppet-kmod)
[![By Camptocamp](https://img.shields.io/badge/by-camptocamp-fb7047.svg)](http://www.camptocamp.com)
## Description
@@ -42,7 +41,7 @@ Adds an alias to modprobe.conf, by default `/etc/modprobe.d/<name>.conf` is assu
```puppet
kmod::alias { 'bond0':
- modulename => 'bonding',
+ aliasname => 'bonding',
}
```
@@ -76,7 +75,7 @@ Params:
### kmod::blacklist
-Manages modprobe blacklist entries. Blacklist entries prevents module aliases from being used,
+Manages modprobe blacklist entries. Blacklist entries prevents module aliases from being used,
but would not prevent the module from being loaded.
To prevent a module from being loaded use `kmod::install`
@@ -104,7 +103,46 @@ Params:
* `file`: File to write to (defaults to `/etc/modprobe.d/<module name>.conf`)
* `command`: (optional) command associated with the install, defaults to `/bin/true`
+## Using the module with hiera
+The module makes available lists for every defined type that will create those
+defined types if defined as class parameters. The parameters are:
+* kmod::list_of_blacklists:
+* kmod::list_of_aliases:
+* kmod::list_of_installs:
+* kmod::list_of_loads:
+* kmod::list_of_options:
+Example usage:
+```
+---
+kmod::list_of_blacklists:
+ 'foo01': {}
+ 'foo02': {}
+ 'foo03': {}
+kmod::list_of_aliases:
+ 'foo01':
+ source: 'squashfs'
+ aliasname: 'squash01'
+ 'foo02':
+ source: 'squashfs'
+ aliasname: 'squash02'
+kmod::list_of_installs:
+ 'dccp':
+ command: '/bin/false'
+ 'blah':
+ command: '/bin/true'
+kmod::list_of_loads:
+ 'cramfs': {}
+ 'vfat': {}
+kmod::list_of_options:
+ 'bond0 mode':
+ module: 'bond0'
+ option: 'mode'
+ value: '1'
+ 'bond0':
+ option: 'mode'
+ value: '1'
+```
## Contributing
diff --git a/Rakefile b/Rakefile
index adcac18..395df54 100644
--- a/Rakefile
+++ b/Rakefile
@@ -1,23 +1,86 @@
+require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
require 'puppetlabs_spec_helper/rake_tasks'
-require 'puppet-lint/tasks/puppet-lint'
+require 'puppet-syntax/tasks/puppet-syntax'
+require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
+require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
+require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
-Rake::Task[:lint].clear
-PuppetLint::RakeTask.new :lint do |config|
- config.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp", "vendor/**/*.pp"]
- config.disable_checks = ['80chars']
- config.fail_on_warnings = true
+def changelog_user
+ return unless Rake.application.top_level_tasks.include? "changelog"
+ returnVal = nil || JSON.load(File.read('metadata.json'))['author']
+ raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
+ puts "GitHubChangelogGenerator user:#{returnVal}"
+ returnVal
end
-PuppetSyntax.exclude_paths = ["spec/fixtures/**/*.pp", "vendor/**/*"]
+def changelog_project
+ return unless Rake.application.top_level_tasks.include? "changelog"
-# Publishing tasks
-unless RUBY_VERSION =~ /^1\.8/
- require 'puppet_blacksmith'
- require 'puppet_blacksmith/rake_tasks'
- require 'github_changelog_generator/task'
+ 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 = "v%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
+end
+
+PuppetLint.configuration.send('disable_relative')
+
+if Bundler.rubygems.find_name('github_changelog_generator').any?
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
- m = Blacksmith::Modulefile.new
- config.future_release = m.version
- config.release_url = "https://forge.puppetlabs.com/#{m.author}/#{m.name}/%s"
+ raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
+ config.user = "#{changelog_user}"
+ config.project = "#{changelog_project}"
+ config.future_release = "#{changelog_future_release}"
+ config.exclude_labels = ['maintenance']
+ config.header = "# Change log\n\nAll 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)."
+ config.add_pr_wo_labels = true
+ config.issues = false
+ config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM"
+ config.configure_sections = {
+ "Changed" => {
+ "prefix" => "### Changed",
+ "labels" => ["backwards-incompatible"],
+ },
+ "Added" => {
+ "prefix" => "### Added",
+ "labels" => ["feature", "enhancement"],
+ },
+ "Fixed" => {
+ "prefix" => "### Fixed",
+ "labels" => ["bugfix"],
+ },
+ }
+ end
+else
+ desc 'Generate a Changelog from GitHub'
+ task :changelog do
+ raise <<EOM
+The changelog tasks depends on unreleased features of the github_changelog_generator gem.
+Please manually add it to your .sync.yml for now, and run `pdk update`:
+---
+Gemfile:
+ optional:
+ ':development':
+ - gem: 'github_changelog_generator'
+ git: 'https://github.com/skywinder/github-changelog-generator'
+ ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
+ condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
+EOM
end
end
+
diff --git a/appveyor.yml b/appveyor.yml
new file mode 100644
index 0000000..ec38949
--- /dev/null
+++ b/appveyor.yml
@@ -0,0 +1,56 @@
+---
+version: 1.1.x.{build}
+branches:
+ only:
+ - master
+ - release
+skip_commits:
+ message: /^\(?doc\)?.*/
+clone_depth: 10
+init:
+ - SET
+ - 'mkdir C:\ProgramData\PuppetLabs\code && exit 0'
+ - 'mkdir C:\ProgramData\PuppetLabs\facter && exit 0'
+ - 'mkdir C:\ProgramData\PuppetLabs\hiera && exit 0'
+ - 'mkdir C:\ProgramData\PuppetLabs\puppet\var && exit 0'
+environment:
+ matrix:
+ -
+ RUBY_VERSION: 24-x64
+ CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
+ -
+ PUPPET_GEM_VERSION: ~> 5.0
+ RUBY_VERSION: 24
+ CHECK: parallel_spec
+ -
+ PUPPET_GEM_VERSION: ~> 5.0
+ RUBY_VERSION: 24-x64
+ CHECK: parallel_spec
+ -
+ PUPPET_GEM_VERSION: ~> 6.0
+ RUBY_VERSION: 25
+ CHECK: parallel_spec
+ -
+ PUPPET_GEM_VERSION: ~> 6.0
+ RUBY_VERSION: 25-x64
+ CHECK: parallel_spec
+matrix:
+ fast_finish: true
+install:
+ - set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
+ - bundle install --jobs 4 --retry 2 --without system_tests
+ - type Gemfile.lock
+build: off
+test_script:
+ - bundle exec puppet -V
+ - ruby -v
+ - gem -v
+ - bundle -v
+ - bundle exec rake %CHECK%
+notifications:
+ - provider: Email
+ to:
+ - nobody@nowhere.com
+ on_build_success: false
+ on_build_failure: false
+ on_build_status_changed: false
diff --git a/debian/changelog b/debian/changelog
index 95c9094..482b037 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+puppet-module-camptocamp-kmod (2.5.0-1) UNRELEASED; urgency=low
+
+ * New upstream release.
+
+ -- Debian Janitor <janitor@jelmer.uk> Mon, 10 Apr 2023 09:12:25 -0000
+
puppet-module-camptocamp-kmod (2.1.1-3) unstable; urgency=medium
* Clean-up update-alternatives handling.
diff --git a/hiera.yaml b/hiera.yaml
new file mode 100644
index 0000000..2251c23
--- /dev/null
+++ b/hiera.yaml
@@ -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'
diff --git a/manifests/alias.pp b/manifests/alias.pp
index dcdb974..19c5d66 100644
--- a/manifests/alias.pp
+++ b/manifests/alias.pp
@@ -16,6 +16,7 @@ define kmod::alias(
include ::kmod
kmod::setting { "kmod::alias ${title}":
+ ensure => $ensure,
module => $aliasname,
file => $file,
category => 'alias',
diff --git a/manifests/init.pp b/manifests/init.pp
index 14da62b..f91e323 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -5,11 +5,13 @@
# content.
#
#
-class kmod {
-
- if versioncmp($::augeasversion, '0.9.0') < 0 {
- fail('Augeas 0.10.0 or higher required')
- }
+class kmod (
+ Optional[Hash] $list_of_aliases = {},
+ Optional[Hash] $list_of_blacklists = {},
+ Optional[Hash] $list_of_installs = {},
+ Optional[Hash] $list_of_loads = {},
+ Optional[Hash] $list_of_options = {},
+){
file { '/etc/modprobe.d': ensure => directory }
file { [
@@ -18,4 +20,30 @@ class kmod {
'/etc/modprobe.d/blacklist.conf',
]: ensure => file,
}
+
+ $list_of_aliases.each | $name, $data | {
+ kmod::alias { $name:
+ * => $data,
+ }
+ }
+ $list_of_blacklists.each | $name, $data | {
+ kmod::blacklist { $name:
+ * => $data,
+ }
+ }
+ $list_of_installs.each | $name, $data | {
+ kmod::install { $name:
+ * => $data,
+ }
+ }
+ $list_of_loads.each | $name, $data | {
+ kmod::load { $name:
+ * => $data,
+ }
+ }
+ $list_of_options.each | $name, $data | {
+ kmod::option { $name:
+ * => $data,
+ }
+ }
}
diff --git a/manifests/load.pp b/manifests/load.pp
index 0752568..0a58df6 100644
--- a/manifests/load.pp
+++ b/manifests/load.pp
@@ -5,7 +5,8 @@
#
# Parameters:
# - *ensure*: present/absent;
-# - *file*: optionally, set the file where the stanza is written.
+# - *file*: optionally, set the file where the stanza is written. Not
+# used for systems running systemd.
#
# Example usage:
#
@@ -54,34 +55,42 @@ define kmod::load(
default: { fail "${module_name}: unknown ensure value ${ensure}" }
}
- case $::osfamily {
- 'Debian': {
- augeas {"Manage ${name} in ${file}":
- incl => $file,
- lens => 'Modules.lns',
- changes => $changes,
- }
+ if $facts['service_provider'] == 'systemd' {
+ file { "/etc/modules-load.d/${name}.conf":
+ ensure => $ensure,
+ mode => '0644',
+ content => "# This file is managed by the puppet kmod module.\n${name}\n",
}
- 'RedHat': {
- file { "/etc/sysconfig/modules/${name}.modules":
- ensure => $ensure,
- mode => '0755',
- content => template('kmod/redhat.modprobe.erb'),
+ } else {
+ case $::osfamily {
+ 'Debian': {
+ augeas {"Manage ${name} in ${file}":
+ incl => $file,
+ lens => 'Modules.lns',
+ changes => $changes,
+ }
}
- }
- 'Suse': {
- $kernelfile = $file ? {
- '/etc/modules' => '/etc/sysconfig/kernel',
- default => $file,
+ 'RedHat': {
+ file { "/etc/sysconfig/modules/${name}.modules":
+ ensure => $ensure,
+ mode => '0755',
+ content => template('kmod/redhat.modprobe.erb'),
+ }
}
- augeas { "sysconfig_kernel_MODULES_LOADED_ON_BOOT_${name}":
- lens => 'Shellvars_list.lns',
- incl => $kernelfile,
- changes => $changes,
+ 'Suse': {
+ $kernelfile = $file ? {
+ '/etc/modules' => '/etc/sysconfig/kernel',
+ default => $file,
+ }
+ augeas { "sysconfig_kernel_MODULES_LOADED_ON_BOOT_${name}":
+ lens => 'Shellvars_list.lns',
+ incl => $kernelfile,
+ changes => $changes,
+ }
+ }
+ default: {
+ fail "${module_name}: Unknown OS family ${::osfamily}"
}
- }
- default: {
- fail "${module_name}: Unknown OS family ${::osfamily}"
}
}
}
diff --git a/metadata.json b/metadata.json
index 25cb4b1..320957a 100644
--- a/metadata.json
+++ b/metadata.json
@@ -1,22 +1,26 @@
{
"name": "camptocamp-kmod",
- "version": "2.1.0",
+ "version": "2.5.0",
"author": "camptocamp",
"summary": "Manage Linux kernel modules with Puppet",
"license": "Apache-2.0",
"source": "https://github.com/camptocamp/puppet-kmod",
"project_page": "https://github.com/camptocamp/puppet-kmod",
"issues_url": "https://github.com/camptocamp/puppet-kmod/issues",
- "description": "Manage Linux kernel modules with Puppet",
"dependencies": [
-
+ {
+ "name": "puppetlabs/stdlib",
+ "version_requirement": ">=4.13.1 < 7.0.0"
+ }
],
"operatingsystem_support": [
{
"operatingsystem": "Debian",
"operatingsystemrelease": [
"6",
- "7"
+ "7",
+ "8",
+ "9"
]
},
{
@@ -37,8 +41,39 @@
"operatingsystemrelease": [
"5",
"6",
- "7"
+ "7",
+ "8"
]
+ },
+ {
+ "operatingsystem": "CentOS",
+ "operatingsystemrelease": [
+ "5",
+ "6",
+ "7",
+ "8"
+ ]
+ },
+ {
+ "operatingsystem": "OracleLinux",
+ "operatingsystemrelease": [
+ "6",
+ "7",
+ "8"
+ ]
+ },
+ {
+ "operatingsystem": "Archlinux"
}
- ]
+ ],
+ "requirements": [
+ {
+ "name": "puppet",
+ "version_requirement": ">= 4.10.0 < 7.0.0"
+ }
+ ],
+ "description": "Manage Linux kernel modules with Puppet",
+ "pdk-version": "1.14.1",
+ "template-url": "pdk-default#1.14.1",
+ "template-ref": "1.14.1-0-g0b5b39b"
}
diff --git a/spec/acceptance/nodesets/centos-5.yml b/spec/acceptance/nodesets/centos-5.yml
new file mode 100644
index 0000000..ad2b01c
--- /dev/null
+++ b/spec/acceptance/nodesets/centos-5.yml
@@ -0,0 +1,16 @@
+HOSTS:
+ centos-5-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: el-5-x86_64
+ hypervisor : docker
+ image: camptocamp/centos:5
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'yum install -y crontabs tar wget which'
+ - 'sed -i -e "/mingetty/d" /etc/inittab'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/centos-6.yml b/spec/acceptance/nodesets/centos-6.yml
new file mode 100644
index 0000000..71e23cd
--- /dev/null
+++ b/spec/acceptance/nodesets/centos-6.yml
@@ -0,0 +1,17 @@
+HOSTS:
+ centos-6-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: el-6-x86_64
+ hypervisor : docker
+ image: centos:6
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'rm -rf /var/run/network/*'
+ - 'yum install -y crontabs tar wget'
+ - 'rm /etc/init/tty.conf'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/centos-7.yml b/spec/acceptance/nodesets/centos-7.yml
new file mode 100644
index 0000000..a8fa468
--- /dev/null
+++ b/spec/acceptance/nodesets/centos-7.yml
@@ -0,0 +1,15 @@
+HOSTS:
+ centos-7-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: el-7-x86_64
+ hypervisor : docker
+ image: centos:7
+ docker_preserve_image: true
+ docker_cmd: '["/usr/sbin/init"]'
+ docker_image_commands:
+ - 'yum install -y crontabs tar wget iproute'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/debian-6.yml b/spec/acceptance/nodesets/debian-6.yml
new file mode 100644
index 0000000..d7b0275
--- /dev/null
+++ b/spec/acceptance/nodesets/debian-6.yml
@@ -0,0 +1,15 @@
+HOSTS:
+ debian-6-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: debian-6-amd64
+ hypervisor : docker
+ image: debian/eol:squeeze
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y cron locales-all net-tools wget'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/debian-7.yml b/spec/acceptance/nodesets/debian-7.yml
new file mode 100644
index 0000000..9591ea7
--- /dev/null
+++ b/spec/acceptance/nodesets/debian-7.yml
@@ -0,0 +1,15 @@
+HOSTS:
+ debian-7-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: debian-7-amd64
+ hypervisor : docker
+ image: debian:7
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y cron locales-all net-tools wget'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/debian-8.yml b/spec/acceptance/nodesets/debian-8.yml
new file mode 100644
index 0000000..5fb24c6
--- /dev/null
+++ b/spec/acceptance/nodesets/debian-8.yml
@@ -0,0 +1,16 @@
+HOSTS:
+ debian-8-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: debian-8-amd64
+ hypervisor : docker
+ image: debian:8
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y cron locales-all net-tools wget'
+ - 'rm -f /usr/sbin/policy-rc.d'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/debian-9.yml b/spec/acceptance/nodesets/debian-9.yml
new file mode 100644
index 0000000..f1c6571
--- /dev/null
+++ b/spec/acceptance/nodesets/debian-9.yml
@@ -0,0 +1,15 @@
+HOSTS:
+ debian-9-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: debian-9-amd64
+ hypervisor : docker
+ image: debian:9
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y cron locales-all net-tools systemd-sysv wget'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/ubuntu-12.04.yml b/spec/acceptance/nodesets/ubuntu-12.04.yml
new file mode 100644
index 0000000..594e177
--- /dev/null
+++ b/spec/acceptance/nodesets/ubuntu-12.04.yml
@@ -0,0 +1,16 @@
+HOSTS:
+ ubuntu-1204-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: ubuntu-12.04-amd64
+ hypervisor : docker
+ image: ubuntu:12.04
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y net-tools wget'
+ - 'locale-gen en_US.UTF-8'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/ubuntu-14.04.yml b/spec/acceptance/nodesets/ubuntu-14.04.yml
new file mode 100644
index 0000000..2b293c9
--- /dev/null
+++ b/spec/acceptance/nodesets/ubuntu-14.04.yml
@@ -0,0 +1,18 @@
+HOSTS:
+ ubuntu-1404-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: ubuntu-14.04-amd64
+ hypervisor : docker
+ image: ubuntu:14.04
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'rm /usr/sbin/policy-rc.d'
+ - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl'
+ - 'apt-get install -y net-tools wget'
+ - 'locale-gen en_US.UTF-8'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/ubuntu-14.10.yml b/spec/acceptance/nodesets/ubuntu-14.10.yml
new file mode 100644
index 0000000..7ce09b2
--- /dev/null
+++ b/spec/acceptance/nodesets/ubuntu-14.10.yml
@@ -0,0 +1,18 @@
+HOSTS:
+ ubuntu-1410-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: ubuntu-14.10-amd64
+ hypervisor : docker
+ image: ubuntu:14.10
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'rm /usr/sbin/policy-rc.d'
+ - 'rm /sbin/initctl; dpkg-divert --rename --remove /sbin/initctl'
+ - 'apt-get install -y net-tools wget'
+ - 'locale-gen en_US.UTF-8'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/ubuntu-15.04.yml b/spec/acceptance/nodesets/ubuntu-15.04.yml
new file mode 100644
index 0000000..329f331
--- /dev/null
+++ b/spec/acceptance/nodesets/ubuntu-15.04.yml
@@ -0,0 +1,16 @@
+HOSTS:
+ ubuntu-1504-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: ubuntu-15.04-amd64
+ hypervisor : docker
+ image: ubuntu:15.04
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y net-tools wget'
+ - 'locale-gen en_US.UTF-8'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/ubuntu-15.10.yml b/spec/acceptance/nodesets/ubuntu-15.10.yml
new file mode 100644
index 0000000..487795a
--- /dev/null
+++ b/spec/acceptance/nodesets/ubuntu-15.10.yml
@@ -0,0 +1,16 @@
+HOSTS:
+ ubuntu-1510-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: ubuntu-15.10-amd64
+ hypervisor : docker
+ image: ubuntu:15.10
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y net-tools wget'
+ - 'locale-gen en_US.UTF-8'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/acceptance/nodesets/ubuntu-16.04.yml b/spec/acceptance/nodesets/ubuntu-16.04.yml
new file mode 100644
index 0000000..561ebd7
--- /dev/null
+++ b/spec/acceptance/nodesets/ubuntu-16.04.yml
@@ -0,0 +1,16 @@
+HOSTS:
+ ubuntu-1604-x64:
+ default_apply_opts:
+ order: random
+ strict_variables:
+ platform: ubuntu-16.04-amd64
+ hypervisor : docker
+ image: ubuntu:16.04
+ docker_preserve_image: true
+ docker_cmd: '["/sbin/init"]'
+ docker_image_commands:
+ - 'apt-get install -y net-tools wget locales'
+ - 'locale-gen en_US.UTF-8'
+CONFIG:
+ type: aio
+ log_level: debug
diff --git a/spec/classes/kmod_spec.rb b/spec/classes/kmod_spec.rb
index f37f8c0..0a39caa 100644
--- a/spec/classes/kmod_spec.rb
+++ b/spec/classes/kmod_spec.rb
@@ -1,25 +1,16 @@
require 'spec_helper'
-describe 'kmod', :type => :class do
-
+describe 'kmod', type: :class do
on_supported_os.each do |os, facts|
- context "on #{os} with augeas 0.8.9" do
- let(:facts) do facts.merge({:augeasversion => '0.8.9'}) end
- it do
- expect {
- should compile
- }.to raise_error(/Augeas 0.10.0 or higher required/)
- end
- end
context "on #{os}" do
let(:facts) do
- facts.merge( { :augeasversion => '1.2.0' } )
+ facts.merge(augeasversion: '1.2.0')
end
- it { should contain_class('kmod') }
- it { should contain_file('/etc/modprobe.d').with({ 'ensure' => 'directory' }) }
- ['modprobe.conf','aliases.conf','blacklist.conf'].each do |file|
- it { should contain_file("/etc/modprobe.d/#{file}").with({ 'ensure' => 'file' }) }
+ it { is_expected.to contain_class('kmod') }
+ it { is_expected.to contain_file('/etc/modprobe.d').with('ensure' => 'directory') }
+ ['modprobe.conf', 'aliases.conf', 'blacklist.conf'].each do |file|
+ it { is_expected.to contain_file("/etc/modprobe.d/#{file}").with('ensure' => 'file') }
end
end
end
diff --git a/spec/default_facts.yml b/spec/default_facts.yml
new file mode 100644
index 0000000..f777abf
--- /dev/null
+++ b/spec/default_facts.yml
@@ -0,0 +1,8 @@
+# Use default_module_facts.yml for module specific facts.
+#
+# Facts specified here will override the values provided by rspec-puppet-facts.
+---
+ipaddress: "172.16.254.254"
+ipaddress6: "FE80:0000:0000:0000:AAAA:AAAA:AAAA"
+is_pe: false
+macaddress: "AA:AA:AA:AA:AA:AA"
diff --git a/spec/defines/kmod_alias_spec.rb b/spec/defines/kmod_alias_spec.rb
index 298009e..3099d4d 100644
--- a/spec/defines/kmod_alias_spec.rb
+++ b/spec/defines/kmod_alias_spec.rb
@@ -1,42 +1,55 @@
require 'spec_helper'
-describe 'kmod::alias', :type => :define do
+describe 'kmod::alias', type: :define do
let(:title) { 'foo' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
- facts.merge( {:augeasversion => '1.2.0'} )
+ facts.merge(augeasversion: '1.2.0')
end
- let(:default_params) do { :source =>'bar', :file => '/baz' } end
+ let(:default_params) { { source: 'bar', file: '/baz' } }
context 'when a file is specified' do
- let(:params) do default_params end
- it { should contain_kmod__alias('foo') }
- it { should contain_kmod__setting('kmod::alias foo') .with({
- 'ensure' => 'present',
- 'module' => 'foo',
- 'file' => '/baz',
- 'category' => 'alias',
- 'option' => 'modulename',
- 'value' => 'bar'
- }) }
+ let(:params) { default_params }
+
+ it { is_expected.to contain_kmod__alias('foo') }
+ it {
+ is_expected.to contain_kmod__setting('kmod::alias foo')
+ .with('ensure' => 'present',
+ 'module' => 'foo',
+ 'file' => '/baz',
+ 'category' => 'alias',
+ 'option' => 'modulename',
+ 'value' => 'bar')
+ }
end
context 'when a file is specified and an aliasname' do
- let(:params) do default_params.merge!({ :aliasname => 'tango' }) end
- it { should contain_kmod__alias('foo') }
- it { should contain_kmod__setting('kmod::alias foo') .with({
- 'ensure' => 'present',
- 'module' => 'tango',
- 'file' => '/baz',
- 'category' => 'alias',
- 'option' => 'modulename',
- 'value' => 'bar'
- }) }
+ let(:params) { default_params.merge!(aliasname: 'tango') }
+
+ it { is_expected.to contain_kmod__alias('foo') }
+ it {
+ is_expected.to contain_kmod__setting('kmod::alias foo')
+ .with('ensure' => 'present',
+ 'module' => 'tango',
+ 'file' => '/baz',
+ 'category' => 'alias',
+ 'option' => 'modulename',
+ 'value' => 'bar')
+ }
end
+ context 'when ensure absent is specified' do
+ let(:params) { default_params.merge!(ensure: 'absent') }
+
+ it { is_expected.to contain_kmod__alias('foo') }
+ it {
+ is_expected.to contain_kmod__setting('kmod::alias foo')
+ .with('ensure' => 'absent')
+ }
+ end
end
end
end
diff --git a/spec/defines/kmod_blacklist_spec.rb b/spec/defines/kmod_blacklist_spec.rb
index 908eebd..70a8bfc 100644
--- a/spec/defines/kmod_blacklist_spec.rb
+++ b/spec/defines/kmod_blacklist_spec.rb
@@ -1,48 +1,51 @@
require 'spec_helper'
-describe 'kmod::blacklist', :type => :define do
+describe 'kmod::blacklist', type: :define do
let(:title) { 'foo' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
- facts.merge({
- :augeasversion => '1.2.0',
- })
+ facts.merge(augeasversion: '1.2.0')
end
context 'when ensure is set to present' do
- let(:params) do { :ensure => 'present', :file => '/bar/baz' } end
- it { should contain_kmod__blacklist('foo') }
- it { should contain_kmod__setting('kmod::blacklist foo').with({
- 'ensure' => 'present',
- 'category' => 'blacklist',
- 'module' => 'foo',
- 'file' => '/bar/baz'
- }) }
- end
+ let(:params) { { ensure: 'present', file: '/bar/baz' } }
+ it { is_expected.to contain_kmod__blacklist('foo') }
+ it {
+ is_expected.to contain_kmod__setting('kmod::blacklist foo')
+ .with('ensure' => 'present',
+ 'category' => 'blacklist',
+ 'module' => 'foo',
+ 'file' => '/bar/baz')
+ }
+ end
context 'when file is not specified' do
- let(:params) do { :ensure => 'present' } end
- it { should contain_kmod__blacklist('foo') }
- it { should contain_kmod__setting('kmod::blacklist foo').with({
- 'ensure' => 'present',
- 'category' => 'blacklist',
- 'module' => 'foo',
- 'file' => '/etc/modprobe.d/blacklist.conf'
- }) }
+ let(:params) { { ensure: 'present' } }
+
+ it { is_expected.to contain_kmod__blacklist('foo') }
+ it {
+ is_expected.to contain_kmod__setting('kmod::blacklist foo')
+ .with('ensure' => 'present',
+ 'category' => 'blacklist',
+ 'module' => 'foo',
+ 'file' => '/etc/modprobe.d/blacklist.conf')
+ }
end
context 'when ensure is set to absent' do
- let(:params) do { :ensure => 'absent', :file => '/bar/baz' } end
- it { should contain_kmod__blacklist('foo') }
- it { should contain_kmod__setting('kmod::blacklist foo').with({
- 'ensure' => 'absent',
- 'category' => 'blacklist',
- 'module' => 'foo',
- 'file' => '/bar/baz'
- }) }
+ let(:params) { { ensure: 'absent', file: '/bar/baz' } }
+
+ it { is_expected.to contain_kmod__blacklist('foo') }
+ it {
+ is_expected.to contain_kmod__setting('kmod::blacklist foo')
+ .with('ensure' => 'absent',
+ 'category' => 'blacklist',
+ 'module' => 'foo',
+ 'file' => '/bar/baz')
+ }
end
end
end
diff --git a/spec/defines/kmod_install_spec.rb b/spec/defines/kmod_install_spec.rb
index a8937cc..2a59c56 100644
--- a/spec/defines/kmod_install_spec.rb
+++ b/spec/defines/kmod_install_spec.rb
@@ -1,26 +1,26 @@
require 'spec_helper'
-describe 'kmod::install', :type => :define do
+describe 'kmod::install', type: :define do
let(:title) { 'foo' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
- facts.merge({
- :augeasversion => '1.2.0',
- })
+ facts.merge(augeasversion: '1.2.0')
end
- let(:params) do { :ensure => 'present', :command => '/bin/true', :file => '/etc/modprobe.d/modprobe.conf' } end
- it { should contain_kmod__install('foo') }
- it { should contain_kmod__setting('kmod::install foo').with({
- 'ensure' => 'present',
- 'category' => 'install',
- 'module' => 'foo',
- 'option' => 'command',
- 'value' => '/bin/true',
- 'file' => '/etc/modprobe.d/modprobe.conf'
- }) }
+ let(:params) { { ensure: 'present', command: '/bin/true', file: '/etc/modprobe.d/modprobe.conf' } }
+
+ it { is_expected.to contain_kmod__install('foo') }
+ it {
+ is_expected.to contain_kmod__setting('kmod::install foo')
+ .with('ensure' => 'present',
+ 'category' => 'install',
+ 'module' => 'foo',
+ 'option' => 'command',
+ 'value' => '/bin/true',
+ 'file' => '/etc/modprobe.d/modprobe.conf')
+ }
end
end
end
diff --git a/spec/defines/kmod_load_spec.rb b/spec/defines/kmod_load_spec.rb
index 0e124b2..402171f 100644
--- a/spec/defines/kmod_load_spec.rb
+++ b/spec/defines/kmod_load_spec.rb
@@ -1,65 +1,114 @@
require 'spec_helper'
-describe 'kmod::load', :type => :define do
+describe 'kmod::load', type: :define do
let(:title) { 'foo' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
- facts.merge( { :augeasversion => '1.2.0' } )
+ data = if facts[:os]['name'] == 'Archlinux'
+ { augeasversion: '1.2.0', service_provider: 'systemd' }
+ else
+ { augeasversion: '1.2.0' }
+ end
+ facts.merge(data)
end
context 'with ensure set to present' do
- let(:params) do { :ensure => 'present', :file => '/foo/bar' } end
- it { should contain_kmod__load('foo') }
- it { should contain_exec('modprobe foo').with({'unless' => "egrep -q '^foo ' /proc/modules"}) }
+ let(:params) { { ensure: 'present', file: '/foo/bar' } }
- case facts[:osfamily]
- when 'Debian'
- it { should contain_augeas('Manage foo in /foo/bar').with({
- 'incl' => '/foo/bar',
- 'lens' => 'Modules.lns',
- 'changes' => "clear 'foo'"
- }) }
- when 'Suse'
- it { should contain_augeas('sysconfig_kernel_MODULES_LOADED_ON_BOOT_foo').with({
- 'incl' => '/foo/bar',
- 'lens' => 'Shellvars_list.lns',
- 'changes' => "set MODULES_LOADED_ON_BOOT/value[.='foo'] 'foo'"
- }) }
- when 'RedHat'
- it { should contain_file('/etc/sysconfig/modules/foo.modules').with({
- 'ensure' => 'present',
- 'mode' => '0755',
- 'content' => /exec \/sbin\/modprobe foo > \/dev\/null 2>&1/
- })}
+ it { is_expected.to contain_kmod__load('foo') }
+ it {
+ is_expected.to contain_exec('modprobe foo')
+ .with('unless' => "egrep -q '^foo ' /proc/modules")
+ }
+
+ context 'when on systemd' do
+ let(:facts) do
+ facts.merge(service_provider: 'systemd')
+ end
+
+ it {
+ is_expected.to contain_file('/etc/modules-load.d/foo.conf')
+ .with('ensure' => 'present',
+ 'mode' => '0644',
+ 'content' => "# This file is managed by the puppet kmod module.\nfoo\n")
+ }
+ end
+
+ context 'when not on systemd' do
+ case facts[:osfamily]
+ when 'Debian'
+ it {
+ is_expected.to contain_augeas('Manage foo in /foo/bar')
+ .with('incl' => '/foo/bar',
+ 'lens' => 'Modules.lns',
+ 'changes' => "clear 'foo'")
+ }
+ when 'Suse'
+ it {
+ is_expected.to contain_augeas('sysconfig_kernel_MODULES_LOADED_ON_BOOT_foo')
+ .with('incl' => '/foo/bar',
+ 'lens' => 'Shellvars_list.lns',
+ 'changes' => "set MODULES_LOADED_ON_BOOT/value[.='foo'] 'foo'")
+ }
+ when 'RedHat'
+ it {
+ is_expected.to contain_file('/etc/sysconfig/modules/foo.modules')
+ .with('ensure' => 'present',
+ 'mode' => '0755',
+ 'content' => %r{exec /sbin/modprobe foo > /dev/null 2>&1})
+ }
+ end
end
end
context 'with ensure set to absent' do
- let(:params) do { :ensure => 'absent', :file => '/foo/bar' } end
- it { should contain_kmod__load('foo') }
- it { should contain_exec('modprobe -r foo').with({ 'onlyif' => "egrep -q '^foo ' /proc/modules" }) }
+ let(:params) { { ensure: 'absent', file: '/foo/bar' } }
+
+ it { is_expected.to contain_kmod__load('foo') }
+ it {
+ is_expected.to contain_exec('modprobe -r foo')
+ .with('onlyif' => "egrep -q '^foo ' /proc/modules")
+ }
+
+ context 'when on systemd' do
+ let(:facts) do
+ facts.merge(service_provider: 'systemd')
+ end
+
+ it {
+ is_expected.to contain_file('/etc/modules-load.d/foo.conf')
+ .with('ensure' => 'absent',
+ 'mode' => '0644',
+ 'content' => "# This file is managed by the puppet kmod module.\nfoo\n")
+ }
+ end
- case facts[:osfamily]
- when 'Debian'
- it { should contain_augeas('Manage foo in /foo/bar').with({
- 'incl' => '/foo/bar',
- 'lens' => 'Modules.lns',
- 'changes' => "rm 'foo'"
- })}
- when 'Suse'
- it { should contain_augeas('sysconfig_kernel_MODULES_LOADED_ON_BOOT_foo').with({
- 'incl' => '/foo/bar',
- 'lens' => 'Shellvars_list.lns',
- 'changes' => "rm MODULES_LOADED_ON_BOOT/value[.='foo']"
- }) }
- when 'RedHat'
- it { should contain_file('/etc/sysconfig/modules/foo.modules').with({
- 'ensure' => 'absent',
- 'mode' => '0755',
- 'content' => /exec \/sbin\/modprobe foo > \/dev\/null 2>&1/
- })}
+ context 'when not on systemd' do
+ case facts[:osfamily]
+ when 'Debian'
+ it {
+ is_expected.to contain_augeas('Manage foo in /foo/bar')
+ .with('incl' => '/foo/bar',
+ 'lens' => 'Modules.lns',
+ 'changes' => "rm 'foo'")
+ }
+ when 'Suse'
+ it {
+ is_expected.to contain_augeas('sysconfig_kernel_MODULES_LOADED_ON_BOOT_foo')
+ .with('incl' => '/foo/bar',
+ 'lens' => 'Shellvars_list.lns',
+ 'changes' => "rm MODULES_LOADED_ON_BOOT/value[.='foo']")
+ }
+ when 'RedHat'
+ it {
+ is_expected.to contain_file('/etc/sysconfig/modules/foo.modules')
+ .with('ensure' => 'absent',
+ 'mode' => '0755',
+ 'content' => %r{exec /sbin/modprobe foo > /dev/null 2>&1})
+ }
+ end
end
end
end
diff --git a/spec/defines/kmod_setting_spec.rb b/spec/defines/kmod_setting_spec.rb
index 5f36734..fd72d61 100644
--- a/spec/defines/kmod_setting_spec.rb
+++ b/spec/defines/kmod_setting_spec.rb
@@ -1,40 +1,41 @@
require 'spec_helper'
-describe 'kmod::setting', :type => :define do
+describe 'kmod::setting', type: :define do
let(:title) { 'foo' }
on_supported_os.each do |os, facts|
context "on #{os}" do
let(:facts) do
- facts.merge({
- :augeasversion => '1.2.0',
- })
+ facts.merge(augeasversion: '1.2.0')
end
- let(:default_params) do { :file => 'modprobe.conf' } end
- let(:params) do default_params end
+ let(:default_params) { { file: 'modprobe.conf' } }
+ let(:params) { default_params }
context 'add an alias' do
- let(:params) do default_params.merge({ :category => 'alias', :option => 'modulename', :value => 'tango' }) end
- it { should contain_kmod__setting('foo')}
- it { should contain_augeas('kmod::setting foo foo').with({
- 'incl' => 'modprobe.conf',
- 'lens' => 'Modprobe.lns',
- 'changes' => [ "set alias[. = 'foo'] foo", "set alias[. = 'foo']/modulename tango" ],
- 'require' => 'File[modprobe.conf]'
- })}
+ let(:params) { default_params.merge(category: 'alias', option: 'modulename', value: 'tango') }
+
+ it { is_expected.to contain_kmod__setting('foo') }
+ it {
+ is_expected.to contain_augeas('kmod::setting foo foo')
+ .with('incl' => 'modprobe.conf',
+ 'lens' => 'Modprobe.lns',
+ 'changes' => ["set alias[. = 'foo'] foo", "set alias[. = 'foo']/modulename tango"],
+ 'require' => 'File[modprobe.conf]')
+ }
end
context 'add a blacklist' do
- let(:params) do { :file => '/etc/modprobe.d/blacklist.conf', :category => 'blacklist' } end
- it { should contain_kmod__setting('foo')}
- it { should contain_augeas('kmod::setting foo foo').with({
- 'incl' => '/etc/modprobe.d/blacklist.conf',
- 'lens' => 'Modprobe.lns',
- 'changes' => [ "set blacklist[. = 'foo'] foo" ],
- 'require' => 'File[/etc/modprobe.d/blacklist.conf]'
- })}
- end
+ let(:params) { { file: '/etc/modprobe.d/blacklist.conf', category: 'blacklist' } }
+ it { is_expected.to contain_kmod__setting('foo') }
+ it {
+ is_expected.to contain_augeas('kmod::setting foo foo')
+ .with('incl' => '/etc/modprobe.d/blacklist.conf',
+ 'lens' => 'Modprobe.lns',
+ 'changes' => ["set blacklist[. = 'foo'] foo"],
+ 'require' => 'File[/etc/modprobe.d/blacklist.conf]')
+ }
+ end
end
end
end
diff --git a/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/broken b/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/broken
new file mode 100644
index 0000000..d6c864a
--- /dev/null
+++ b/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/broken
@@ -0,0 +1,43 @@
+# autoloader aliases
+install sound-slot-0 /sbin/modprobe snd-card-0
+install sound-slot-1 /sbin/modprobe snd-card-1
+ins tall sound-slot-2 /sbin/modprobe snd-card-2
+install sound-slot-3 /sbin/modprobe snd-card-3
+install sound-slot-4 /sbin/modprobe snd-card-4
+install sound-slot-5 /sbin/modprobe snd-card-5
+install sound-slot-6 /sbin/modprobe snd-card-6
+install sound-slot-7 /sbin/modprobe snd-card-7
+
+# Cause optional modules to be loaded above generic modules
+install snd /sbin/modprobe --ignore-install snd $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-ioctl32 ; /sbin/modprobe --quiet --use-blacklist snd-seq ; }
+#
+# Workaround at bug #499695 (reverted in Ubuntu see LP #319505)
+install snd-pcm /sbin/modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-pcm-oss ; : ; }
+install snd-mixer /sbin/modprobe --ignore-install snd-mixer $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-mixer-oss ; : ; }
+install snd-seq /sbin/modprobe --ignore-install snd-seq $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; /sbin/modprobe --quiet --use-blacklist snd-seq-oss ; : ; }
+#
+install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; : ; }
+# Cause optional modules to be loaded above sound card driver modules
+install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-emu10k1-synth ; }
+install snd-via82xx /sbin/modprobe --ignore-install snd-via82xx $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq ; }
+
+# Load saa7134-alsa instead of saa7134 (which gets dragged in by it anyway)
+install saa7134 /sbin/modprobe --ignore-install saa7134 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist saa7134-alsa ; : ; }
+# Prevent abnormal drivers from grabbing index 0
+options bt87x index=-2
+options cx88_alsa index=-2
+options saa7134-alsa index=-2
+options snd-atiixp-modem index=-2
+options snd-intel8x0m index=-2
+options snd-via82xx-modem index=-2
+options snd-usb-audio index=-2
+options snd-usb-caiaq index=-2
+options snd-usb-ua101 index=-2
+options snd-usb-us122l index=-2
+options snd-usb-usx2y index=-2
+# Ubuntu #62691, enable MPU for snd-cmipci
+options snd-cmipci mpu_port=0x330 fm_port=0x388
+# Keep snd-pcsp from being loaded as first soundcard
+options snd-pcsp index=-2
+# Keep snd-usb-audio from beeing loaded as first soundcard
+options snd-usb-audio index=-2
diff --git a/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/empty b/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/empty
new file mode 100644
index 0000000..e69de29
diff --git a/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/full b/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/full
new file mode 100644
index 0000000..0e298f1
--- /dev/null
+++ b/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/full
@@ -0,0 +1,43 @@
+# autoloader aliases
+install sound-slot-0 /sbin/modprobe snd-card-0
+install sound-slot-1 /sbin/modprobe snd-card-1
+install sound-slot-2 /sbin/modprobe snd-card-2
+install sound-slot-3 /sbin/modprobe snd-card-3
+install sound-slot-4 /sbin/modprobe snd-card-4
+install sound-slot-5 /sbin/modprobe snd-card-5
+install sound-slot-6 /sbin/modprobe snd-card-6
+install sound-slot-7 /sbin/modprobe snd-card-7
+
+# Cause optional modules to be loaded above generic modules
+install snd /sbin/modprobe --ignore-install snd $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-ioctl32 ; /sbin/modprobe --quiet --use-blacklist snd-seq ; }
+#
+# Workaround at bug #499695 (reverted in Ubuntu see LP #319505)
+install snd-pcm /sbin/modprobe --ignore-install snd-pcm $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-pcm-oss ; : ; }
+install snd-mixer /sbin/modprobe --ignore-install snd-mixer $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-mixer-oss ; : ; }
+install snd-seq /sbin/modprobe --ignore-install snd-seq $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; /sbin/modprobe --quiet --use-blacklist snd-seq-oss ; : ; }
+#
+install snd-rawmidi /sbin/modprobe --ignore-install snd-rawmidi $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq-midi ; : ; }
+# Cause optional modules to be loaded above sound card driver modules
+install snd-emu10k1 /sbin/modprobe --ignore-install snd-emu10k1 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-emu10k1-synth ; }
+install snd-via82xx /sbin/modprobe --ignore-install snd-via82xx $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist snd-seq ; }
+
+# Load saa7134-alsa instead of saa7134 (which gets dragged in by it anyway)
+install saa7134 /sbin/modprobe --ignore-install saa7134 $CMDLINE_OPTS && { /sbin/modprobe --quiet --use-blacklist saa7134-alsa ; : ; }
+# Prevent abnormal drivers from grabbing index 0
+options bt87x index=-2
+options cx88_alsa index=-2
+options saa7134-alsa index=-2
+options snd-atiixp-modem index=-2
+options snd-intel8x0m index=-2
+options snd-via82xx-modem index=-2
+options snd-usb-audio index=-2
+options snd-usb-caiaq index=-2
+options snd-usb-ua101 index=-2
+options snd-usb-us122l index=-2
+options snd-usb-usx2y index=-2
+# Ubuntu #62691, enable MPU for snd-cmipci
+options snd-cmipci mpu_port=0x330 fm_port=0x388
+# Keep snd-pcsp from being loaded as first soundcard
+options snd-pcsp index=-2
+# Keep snd-usb-audio from beeing loaded as first soundcard
+options snd-usb-audio index=-2
diff --git a/spec/spec.opts b/spec/spec.opts
deleted file mode 100644
index 91cd642..0000000
--- a/spec/spec.opts
+++ /dev/null
@@ -1,6 +0,0 @@
---format
-s
---colour
---loadby
-mtime
---backtrace
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 94d30d5..feb5720 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -1,42 +1,54 @@
require 'puppetlabs_spec_helper/module_spec_helper'
require 'rspec-puppet-facts'
+
+require 'spec_helper_local' if File.file?(File.join(File.dirname(__FILE__), 'spec_helper_local.rb'))
+
include RspecPuppetFacts
+default_facts = {
+ puppetversion: Puppet.version,
+ facterversion: Facter.version,
+}
-RSpec.configure do |c|
- c.include PuppetlabsSpec::Files
+default_fact_files = [
+ File.expand_path(File.join(File.dirname(__FILE__), 'default_facts.yml')),
+ File.expand_path(File.join(File.dirname(__FILE__), 'default_module_facts.yml')),
+]
- c.before :each do
- # Store any environment variables away to be restored later
- @old_env = {}
- ENV.each_key {|k| @old_env[k] = ENV[k]}
+default_fact_files.each do |f|
+ next unless File.exist?(f) && File.readable?(f) && File.size?(f)
- c.strict_variables = Gem::Version.new(Puppet.version) >= Gem::Version.new('3.5')
- Puppet.features.stubs(:root?).returns(true)
+ begin
+ default_facts.merge!(YAML.safe_load(File.read(f), [], [], true))
+ rescue => e
+ RSpec.configuration.reporter.message "WARNING: Unable to load #{f}: #{e}"
end
+end
+
+# read default_facts and merge them over what is provided by facterdb
+default_facts.each do |fact, value|
+ add_custom_fact fact, value
+end
- c.after :each do
- PuppetlabsSpec::Files.cleanup
+RSpec.configure do |c|
+ c.default_facts = default_facts
+ c.before :each do
+ # set to strictest setting for testing
+ # by default Puppet runs at warning level
+ Puppet.settings[:strict] = :warning
+ end
+ c.filter_run_excluding(bolt: true) unless ENV['GEM_BOLT']
+ c.after(:suite) do
end
end
-require 'pathname'
-dir = Pathname.new(__FILE__).parent
-Puppet[:modulepath] = File.join(dir, 'fixtures', 'modules')
-
-# There's no real need to make this version dependent, but it helps find
-# regressions in Puppet
-#
-# 1. Workaround for issue #16277 where default settings aren't initialised from
-# a spec and so the libdir is never initialised (3.0.x)
-# 2. Workaround for 2.7.20 that now only loads types for the current node
-# environment (#13858) so Puppet[:modulepath] seems to get ignored
-# 3. Workaround for 3.5 where context hasn't been configured yet,
-# ticket https://tickets.puppetlabs.com/browse/MODULES-823
-#
-ver = Gem::Version.new(Puppet.version.split('-').first)
-if Gem::Requirement.new("~> 2.7.20") =~ ver || Gem::Requirement.new("~> 3.0.0") =~ ver || Gem::Requirement.new("~> 3.5") =~ ver || Gem::Requirement.new("~> 4.0")
- puts "augeasproviders: setting Puppet[:libdir] to work around broken type autoloading"
- # libdir is only a single dir, so it can only workaround loading of one external module
- Puppet[:libdir] = "#{Puppet[:modulepath]}/augeasproviders_core/lib"
+# Ensures that a module is defined
+# @param module_name Name of the module
+def ensure_module_defined(module_name)
+ module_name.split('::').reduce(Object) do |last_module, next_module|
+ last_module.const_set(next_module, Module.new) unless last_module.const_defined?(next_module, false)
+ last_module.const_get(next_module, false)
+ end
end
+
+# 'spec_overrides' from sync.yml will appear below this line
diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb
new file mode 100644
index 0000000..6642c1a
--- /dev/null
+++ b/spec/spec_helper_acceptance.rb
@@ -0,0 +1,19 @@
+require 'beaker-pe'
+require 'beaker-puppet'
+require 'puppet'
+require 'beaker-rspec/spec_helper'
+require 'beaker-rspec/helpers/serverspec'
+require 'beaker/puppet_install_helper'
+require 'beaker/module_install_helper'
+require 'beaker-task_helper'
+
+run_puppet_install_helper
+configure_type_defaults_on(hosts)
+install_ca_certs unless pe_install?
+# install_bolt_on(hosts) unless pe_install?
+install_module_on(hosts)
+install_module_dependencies_on(hosts)
+
+RSpec.configure do |c|
+ c.formatter = :documentation
+end
Debdiff
[The following lists of changes regard files as different if they have different names, permissions or owners.]
Files in second set of .debs but not in first
-rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/centos-5.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/centos-6.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/centos-7.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/debian-6.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/debian-7.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/debian-8.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/debian-9.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/ubuntu-12.04.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/ubuntu-14.04.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/ubuntu-14.10.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/ubuntu-15.04.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/ubuntu-15.10.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/acceptance/nodesets/ubuntu-16.04.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/default_facts.yml -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/broken -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/empty -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/fixtures/unit/puppet/provider/kmod_setting/augeas/full -rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/spec_helper_acceptance.rb
Files in first set of .debs but not in second
-rw-r--r-- root/root /usr/share/puppet/modules.available/camptocamp-kmod/spec/spec.opts
No differences were encountered in the control files