diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0a37077 --- /dev/null +++ b/.gitignore @@ -0,0 +1,21 @@ +pkg/ +Gemfile.lock +Gemfile.local +vendor/ +.vendor/ +spec/fixtures/manifests/ +spec/fixtures/modules/ +.vagrant/ +.bundle/ +.ruby-version +coverage/ +log/ +.idea/ +.dependencies/ +.librarian/ +Puppetfile.lock +*.iml +.*.sw? +.yardoc/ +Guardfile + diff --git a/.travis.yml b/.travis.yml index c863649..8192a37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,31 +1,17 @@ ---- +sudo: false +dist: trusty language: ruby -bundler_args: --without development -script: "bundle exec rake validate && bundle exec rake spec SPEC_OPTS='--format documentation'" +cache: bundler +before_install: +- bundle -v +- rm Gemfile.lock || true +- gem update --system +- gem update bundler +- gem --version +- bundle -v +script: +- bundle exec rake $CHECK matrix: - fast_finish: true - include: - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.4.0" - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 4.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.0.0 - env: PUPPET_GEM_VERSION="~> 4.0" - - rvm: 2.1.5 - env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 2.1.5 - env: PUPPET_GEM_VERSION="~> 3.0" FUTURE_PARSER="yes" - - rvm: 2.1.5 - env: PUPPET_GEM_VERSION="~> 4.0" -notifications: - email: false +- rvm: 2.4.2 + bundler_args: --without system_tests development release + env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes diff --git a/CHANGELOG b/CHANGELOG index 5e09669..072d5b9 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ +2018-06-04 Andrea Manzi + * more fixes for C7 2018-01-18 Andrea Manzi * rename exec systemctl-daemon-reload to avoid clashes +2018-06-04 Andrea Manzi + * more fixes for C7 2017-08-17 Andrea Manzi * fix dependency cycle on C7 2016-08-23 Andrea Manzi diff --git a/Gemfile b/Gemfile index bbec3fe..666c75d 100644 --- a/Gemfile +++ b/Gemfile @@ -1,25 +1,77 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" -# https://github.com/rspec/rspec-core/issues/1864 -gem 'rspec', '~> 3.1.0' -gem 'puppetlabs_spec_helper', '>= 0.1.0' -gem 'puppet-lint', '>= 0.3.2' - -if RUBY_VERSION != '1.8.7' - gem 'beaker-rspec', :require => false - gem 'pry', :require => false +def location_for(place, fake_version = nil) + if place =~ /^(git[:@][^#]*)#(.*)/ + [fake_version, { :git => $1, :branch => $2, :require => false }].compact + elsif place =~ /^file:\/\/(.*)/ + ['>= 0', { :path => File.expand_path($1), :require => false }] + else + [place, { :require => false }] + end end -if facterversion = ENV['FACTER_GEM_VERSION'] - gem 'facter', facterversion, :require => false -else - gem 'facter', :require => false +group :test do + gem 'puppetlabs_spec_helper', '~> 2.5.0', :require => false + gem 'rspec-puppet', '~> 2.5', :require => false + gem 'rspec-puppet-facts', :require => false + gem 'rspec-puppet-utils', :require => false + gem 'puppet-lint-leading_zero-check', :require => false + gem 'puppet-lint-trailing_comma-check', :require => false + gem 'puppet-lint-version_comparison-check', :require => false + gem 'puppet-lint-classes_and_types_beginning_with_digits-check', :require => false + gem 'puppet-lint-unquoted_string-check', :require => false + gem 'puppet-lint-variable_contains_upcase', :require => false + gem 'metadata-json-lint', :require => false + gem 'redcarpet', :require => false + gem 'rubocop', '~> 0.49.1', :require => false if RUBY_VERSION >= '2.3.0' + gem 'rubocop-rspec', '~> 1.15.0', :require => false if RUBY_VERSION >= '2.3.0' + gem 'mocha', '>= 1.2.1', :require => false + gem 'coveralls', :require => false + gem 'simplecov-console', :require => false + gem 'rack', '~> 1.0', :require => false if RUBY_VERSION < '2.2.2' + gem 'parallel_tests', :require => false +end + +group :development do + gem 'travis', :require => false + gem 'travis-lint', :require => false + gem 'guard-rake', :require => false + gem 'overcommit', '>= 0.39.1', :require => false +end + +group :system_tests do + gem 'winrm', :require => false + if beaker_version = ENV['BEAKER_VERSION'] + gem 'beaker', *location_for(beaker_version) + else + gem 'beaker', '>= 3.9.0', :require => false + end + if beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION'] + gem 'beaker-rspec', *location_for(beaker_rspec_version) + else + gem 'beaker-rspec', :require => false + end + gem 'serverspec', :require => false + gem 'beaker-puppet_install_helper', :require => false + gem 'beaker-module_install_helper', :require => false end -if puppetversion = ENV['PUPPET_GEM_VERSION'] - gem 'puppet', puppetversion, :require => false +group :release do + gem 'github_changelog_generator', :require => false if RUBY_VERSION >= '2.2.2' + gem 'puppet-blacksmith', :require => false + gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem' + gem 'puppet-strings', '~> 1.0', :require => false +end + + + +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion.to_s, :require => false, :groups => [:test] else - gem 'puppet', :require => false + gem 'facter', :require => false, :groups => [:test] end -# vim:ft=ruby +ENV['PUPPET_VERSION'].nil? ? puppetversion = '~> 5.0' : puppetversion = ENV['PUPPET_VERSION'].to_s +gem 'puppet', puppetversion, :require => false, :groups => [:test] + +# vim: syntax=ruby diff --git a/Rakefile b/Rakefile index d1e11f7..041d233 100644 --- a/Rakefile +++ b/Rakefile @@ -1,18 +1,66 @@ -require 'rubygems' require 'puppetlabs_spec_helper/rake_tasks' -require 'puppet-lint/tasks/puppet-lint' -PuppetLint.configuration.send('disable_80chars') -PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] - -desc "Validate manifests, templates, and ruby files" -task :validate do - Dir['manifests/**/*.pp'].each do |manifest| - sh "puppet parser validate --noop #{manifest}" - end - Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file| - sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/ + +# load optional tasks for releases +# only available if gem group releases is installed +begin + require 'puppet_blacksmith/rake_tasks' + require 'voxpupuli/release/rake_tasks' + require 'puppet-strings/tasks' +rescue LoadError +end + +PuppetLint.configuration.log_format = '%{path}:%{line}:%{check}:%{KIND}:%{message}' +PuppetLint.configuration.fail_on_warnings = true +PuppetLint.configuration.send('relative') +PuppetLint.configuration.send('disable_140chars') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_single_quote_string_with_variables') + +exclude_paths = %w( + pkg/**/* + vendor/**/* + .vendor/**/* + spec/**/* +) +PuppetLint.configuration.ignore_paths = exclude_paths +PuppetSyntax.exclude_paths = exclude_paths + +desc 'Run acceptance tests' +RSpec::Core::RakeTask.new(:acceptance) do |t| + t.pattern = 'spec/acceptance' +end + +desc 'Run tests metadata_lint, release_checks' +task test: [ + :metadata_lint, + :release_checks, +] + +desc "Run main 'test' task and report merged results to coveralls" +task test_with_coveralls: [:test] do + if Dir.exist?(File.expand_path('../lib', __FILE__)) + require 'coveralls/rake/task' + Coveralls::RakeTask.new + Rake::Task['coveralls:push'].invoke + else + puts 'Skipping reporting to coveralls. Module has no lib dir' end - Dir['templates/**/*.erb'].each do |template| - sh "erb -P -x -T '-' #{template} | ruby -c" +end + +begin + require 'github_changelog_generator/task' + GitHubChangelogGenerator::RakeTask.new :changelog do |config| + version = (Blacksmith::Modulefile.new).version + config.future_release = "v#{version}" if version =~ /^\d+\.\d+.\d+$/ + config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file.\nEach new release typically also includes the latest modulesync defaults.\nThese should not affect the functionality of the module." + config.exclude_labels = %w{duplicate question invalid wontfix wont-fix modulesync skip-changelog} + config.user = 'voxpupuli' + metadata_json = File.join(File.dirname(__FILE__), 'metadata.json') + metadata = JSON.load(File.read(metadata_json)) + config.project = metadata['name'] end +rescue LoadError end +# vim: syntax=ruby + diff --git a/manifests/config.pp b/manifests/config.pp index 20c080a..d1697f2 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -7,6 +7,8 @@ $logdir = $xrootd::params::logdir, $spooldir = $xrootd::params::spooldir, $all_pidpath = $xrootd::params::all_pidpath, + $runtime_dir = $xrootd::params::runtime_dir, + $after_conf = $xrootd::params::after_conf ) inherits xrootd::params { diff --git a/manifests/create_systemd.pp b/manifests/create_systemd.pp index ce1afc6..5ad9ba8 100644 --- a/manifests/create_systemd.pp +++ b/manifests/create_systemd.pp @@ -3,7 +3,9 @@ $xrootd_user = $xrootd::config::xrootd_user, $xrootd_group = $xrootd::config::xrootd_group, $exports = $xrootd::config::exports, - $daemon_corefile_limit = $xrootd::config::daemon_corefile_limit + $daemon_corefile_limit = $xrootd::config::daemon_corefile_limit, + $runtime_dir = $xrootd::config::runtime_dir, + $after_conf = $xrootd::config::after_conf ) { include xrootd::config diff --git a/manifests/params.pp b/manifests/params.pp index 861ae8e..c355d56 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -74,4 +74,6 @@ $oss_localroot = undef $certificate = '/etc/grid-security/hostcert.pem' $key = '/etc/grid-security/hostkey.pem' + $runtime_dir = 'xrootd' + $after_conf = 'network-online.target' } diff --git a/metadata.json b/metadata.json index b7cc5c7..5e94a0e 100644 --- a/metadata.json +++ b/metadata.json @@ -19,5 +19,5 @@ "source": "https://github.com/cern-it-sdc-id/puppet-xrootd", "summary": "This module installs and configure a xrootd server", "tags": [], - "version": "0.2.5" + "version": "0.2.6" } diff --git a/templates/override.erb b/templates/override.erb index 17fc585..c42923f 100644 --- a/templates/override.erb +++ b/templates/override.erb @@ -1,6 +1,10 @@ +[Unit] +After=<%= @after_conf %> + [Service] -User= <%= @xrootd_user %> -Group= <%= @xrootd_group %> +User=<%= @xrootd_user %> +Group=<%= @xrootd_group %> +RuntimeDirectory=<%= @runtime_dir %> <% if @exports -%> <% @exports.sort.map do |key,val| -%>