From 4659a8a175fca89edc72da8dabf7476c3b70c733 Mon Sep 17 00:00:00 2001 From: Joseph Yaworski Date: Fri, 26 Feb 2016 23:34:18 -0500 Subject: [PATCH] Update from voxpupuli modulesync_config --- .gitignore | 45 +++-------- .rspec | 2 +- .rubocop.yml | 14 ++++ .sync.yml | 4 + .travis.yml | 38 ++++----- CONTRIBUTING.md | 19 ++++- Gemfile | 79 +++++++++++++------ Rakefile | 33 ++------ manifests/install.pp | 4 +- spec/acceptance/nodesets/centos-511-x64.yml | 9 +++ spec/acceptance/nodesets/centos-66-x64-pe.yml | 11 +++ spec/acceptance/nodesets/centos-66-x64.yml | 9 +++ spec/acceptance/nodesets/centos-72-x64.yml | 9 +++ spec/acceptance/nodesets/debian-78-x64.yml | 9 +++ spec/acceptance/nodesets/debian-82-x64.yml | 9 +++ .../nodesets/ubuntu-server-1204-x64.yml | 9 +++ .../nodesets/ubuntu-server-1404-x64.yml | 8 +- spec/classes/coverage_spec.rb | 2 + 18 files changed, 197 insertions(+), 116 deletions(-) create mode 100644 spec/acceptance/nodesets/centos-511-x64.yml create mode 100644 spec/acceptance/nodesets/centos-66-x64-pe.yml create mode 100644 spec/acceptance/nodesets/centos-66-x64.yml create mode 100644 spec/acceptance/nodesets/centos-72-x64.yml create mode 100644 spec/acceptance/nodesets/debian-78-x64.yml create mode 100644 spec/acceptance/nodesets/debian-82-x64.yml create mode 100644 spec/acceptance/nodesets/ubuntu-server-1204-x64.yml diff --git a/.gitignore b/.gitignore index 3dd998fca..889465765 100644 --- a/.gitignore +++ b/.gitignore @@ -1,36 +1,11 @@ -*.gem -*.rbc -/.config -/coverage/ -/InstalledFiles -/pkg/ -/spec/reports/ -/test/tmp/ -/test/version_tmp/ -/tmp/ -modules/ - -## Specific to RubyMotion: -.dat* -.repl_history -build/ - -## Documentation cache and generated files: -/.yardoc/ -/_yardoc/ -/doc/ -/rdoc/ - -## Environment normalisation: -/.bundle/ -/vendor/bundle -/lib/bundler/man/ - -# for a library or gem, you might want to ignore these files since the code is -# intended to run in multiple environments; otherwise, check them in: +pkg/ Gemfile.lock -# .ruby-version -# .ruby-gemset - -# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: -.rvmrc +vendor/ +spec/fixtures/ +.vagrant/ +.bundle/ +coverage/ +log/ +.idea/ +*.iml +.*.sw diff --git a/.rspec b/.rspec index 210a1d6b1..8c18f1abd 100644 --- a/.rspec +++ b/.rspec @@ -1,2 +1,2 @@ --format documentation ---color \ No newline at end of file +--color diff --git a/.rubocop.yml b/.rubocop.yml index 31c92ca6f..4a7506075 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,8 +1,11 @@ AllCops: + Include: + - ./**/*.rb Exclude: - vendor/**/* - pkg/**/* - spec/fixtures/**/* + - files/**/* # Configuration parameters: AllowURI, URISchemes. Metrics/LineLength: @@ -49,3 +52,14 @@ Style/WordArray: # providers Style/ClassAndModuleChildren: Enabled: false + +Style/Documentation: + Description: 'Document classes and non-namespace modules.' + Enabled: false + +# More comfortable block layouts +Style/BlockDelimiters: + Enabled: False + +Style/MultilineBlockLayout: + Enabled: False diff --git a/.sync.yml b/.sync.yml index 255544f1e..bc8fe3a6f 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,6 +1,10 @@ --- .travis.yml: secure: "ExSbFQsxOlpFTc/4TTGJElIx0/sYNZ1I2Nbd9EfGPNeECXBgmqTdJmPqdV6cl3mKDFh+tSSxnIDZe5BILhmxIR7aF2lbf8jwcbo2nxe9qAZ42GDKNV2klNXUjR7kA7tz220RNO9rM3HDKAwrKtCPtwQ0Q5u90YGGJDj2nr7NUaM=" + addons: + apt: + packages: + - libaugeas-dev .rubocop.yml: AllCops: Exclude: diff --git a/.travis.yml b/.travis.yml index 8c0987f34..6cdfd8ba8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,4 @@ --- -notifications: - email: false sudo: false language: ruby cache: bundler @@ -15,25 +13,27 @@ script: matrix: fast_finish: true include: - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test - - rvm: 2.1.8 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test - - rvm: 1.9.3 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test FUTURE_PARSER=yes - - rvm: 2.1.8 - env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test FUTURE_PARSER=yes - - rvm: 2.1.8 - env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test - - rvm: 2.2.4 - env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test - - rvm: 2.2.4 - env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=rubocop + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 2.1.8 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 1.9.3 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test FUTURE_PARSER=yes + - rvm: 2.1.8 + env: PUPPET_VERSION="~> 3.0" STRICT_VARIABLES="yes" CHECK=test FUTURE_PARSER=yes + - rvm: 2.1.8 + env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 2.2.4 + env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test + - rvm: 2.2.4 + env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=rubocop + - rvm: 2.3.0 + env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test + allow_failures: - rvm: 2.3.0 env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test - allow_failures: - - rvm: 2.3.0 - env: PUPPET_VERSION="~> 4.0" STRICT_VARIABLES="yes" CHECK=test +notifications: + email: false deploy: provider: puppetforge user: puppet diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 34ebfff09..9bbffeab8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,6 +5,8 @@ will likely make it into a release a little quicker. ## Contributing +Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms. [Contributor Code of Conduct](https://voxpupuli.org/coc/). + 1. Fork the repo. 1. Create a separate branch for your change. @@ -47,18 +49,29 @@ The test suite will run [Puppet Lint](http://puppet-lint.com/) and [Puppet Syntax](https://github.com/gds-operations/puppet-syntax) to check various syntax and style things. You can run these locally with: - bundle exec rake test + bundle exec rake lint + bundle exec rake validate ## Running the unit tests The unit test suite covers most of the code, as mentioned above please add tests if you're adding new functionality. If you've not used [rspec-puppet](http://rspec-puppet.com/) before then feel free to ask -about how best to test your new feature. To run your specific spec test -you can pass it to `SPEC`: +about how best to test your new feature. + +To run your all the unit tests + + bundle exec rake spec SPEC_OPTS='--format documentation' + +To run a specific spec test set the `SPEC` variable: bundle exec rake spec SPEC=spec/foo_spec.rb +To run the linter, the syntax checker and the unit tests: + + bundle exec rake test + + ## Integration tests The unit tests just check the code runs, not that it does exactly what diff --git a/Gemfile b/Gemfile index 725a4c526..c4e0df029 100644 --- a/Gemfile +++ b/Gemfile @@ -1,33 +1,64 @@ -source 'https://rubygems.org' +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +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 group :test do - gem 'rake' - gem 'puppet', ENV['PUPPET_VERSION'] || '~> 3.8.0' - gem 'rspec-puppet', git: 'https://github.com/rodjek/rspec-puppet.git' - gem 'rspec-puppet-augeas' - gem 'ruby-augeas' - gem 'puppetlabs_spec_helper' - gem 'metadata-json-lint' - gem 'rspec-puppet-facts' - gem 'rspec' - gem 'puppet-blacksmith' - gem 'rubocop', '0.37.2' - gem 'puppet-lint-absolute_classname-check' - gem 'puppet-lint-leading_zero-check' - gem 'puppet-lint-trailing_comma-check' - gem 'puppet-lint-version_comparison-check' - gem 'puppet-lint-classes_and_types_beginning_with_digits-check' - gem 'puppet-lint-unquoted_string-check' - gem 'puppet-lint-variable_contains_upcase' + gem 'rake', :require => false + gem 'rspec-puppet', :require => false, :git => 'https://github.com/rodjek/rspec-puppet.git' + gem 'puppet-lint', :require => false, :git => 'https://github.com/rodjek/puppet-lint.git' + gem 'metadata-json-lint', :require => false + gem 'rspec-puppet-facts', :require => false + gem 'rspec', :require => false + gem 'puppet-blacksmith', :require => false, :git => 'https://github.com/voxpupuli/puppet-blacksmith.git' + gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem.git' + gem 'rubocop', '0.37.2', :require => false + gem 'rspec-puppet-utils', :require => false + gem 'puppetlabs_spec_helper', :require => false + gem 'puppet-lint-absolute_classname-check', :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 end group :development do - gem 'travis' - gem 'travis-lint' - gem 'guard-rake' + gem 'travis', :require => false + gem 'travis-lint', :require => false + gem 'guard-rake', :require => false end group :system_tests do - gem 'beaker' - gem 'beaker-rspec' + gem 'beaker', :require => false + if beaker_version = ENV['BEAKER_VERSION'] + gem 'beaker', *location_for(beaker_version) + 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 'beaker-puppet_install_helper', :require => false +end + + + +if facterversion = ENV['FACTER_GEM_VERSION'] +gem 'facter', facterversion.to_s, :require => false, :groups => [:test] +else +gem 'facter', :require => false, :groups => [:test] end + +ENV['PUPPET_VERSION'].nil? ? puppetversion = '3.8.4' : puppetversion = ENV['PUPPET_VERSION'].to_s +gem 'puppet', puppetversion, :require => false, :groups => [:test] + +# vim:ft=ruby diff --git a/Rakefile b/Rakefile index c5d4b1974..9e39d334b 100644 --- a/Rakefile +++ b/Rakefile @@ -3,20 +3,18 @@ require 'puppet-lint/tasks/puppet-lint' require 'puppet-syntax/tasks/puppet-syntax' require 'metadata-json-lint/rake_task' require 'puppet_blacksmith/rake_tasks' +require 'voxpupuli/release/rake_tasks' require 'rubocop/rake_task' RuboCop::RakeTask.new -PuppetLint.configuration.relative = true -PuppetLint.configuration.send('disable_80chars') PuppetLint.configuration.log_format = '%{path}:%{linenumber}:%{check}:%{KIND}:%{message}' PuppetLint.configuration.fail_on_warnings = true - -# Forsake support for Puppet 2.6.2 for the benefit of cleaner code. -# http://puppet-lint.com/checks/class_parameter_defaults/ -PuppetLint.configuration.send('disable_class_parameter_defaults') -# http://puppet-lint.com/checks/class_inherits_from_params_class/ +PuppetLint.configuration.send('relative') +PuppetLint.configuration.send('disable_80chars') 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/**/* @@ -36,24 +34,5 @@ task test: [ :metadata_lint, :lint, :syntax, - :spec + :spec, ] - -Blacksmith::RakeTask.new do |t| - t.build = false # do not build the module nor push it to the Forge - # just do the tagging [:clean, :tag, :bump_commit] -end - -desc 'Offload release process to Travis.' -task travis_release: [ - :check_changelog, # check that the changelog contains an entry for the current release - :"module:release", # do everything except build / push to forge, travis will do that for us -] - -desc 'Check Changelog.' -task :check_changelog do - v = Blacksmith::Modulefile.new.version - if File.readlines('CHANGELOG.md').grep(/Releasing #{v}/).empty? - raise "Unable to find a CHANGELOG.md entry for the #{v} release." - end -end diff --git a/manifests/install.pp b/manifests/install.pp index cb3d0dc54..7f7b90dc0 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -72,7 +72,7 @@ ensure_resource('group', 'rundeck', { 'ensure' => 'present' } ) } else { ensure_resource('group', $group, { 'ensure' => 'present' } ) - + group { 'rundeck': ensure => absent, } @@ -82,7 +82,7 @@ ensure_resource('user', $user, { 'ensure' => 'present', 'groups' => [$group] } ) } else { ensure_resource('user', $user, { 'ensure' => 'present', 'groups' => [$group] } ) - + user { 'rundeck': ensure => absent, } diff --git a/spec/acceptance/nodesets/centos-511-x64.yml b/spec/acceptance/nodesets/centos-511-x64.yml new file mode 100644 index 000000000..ca14463e5 --- /dev/null +++ b/spec/acceptance/nodesets/centos-511-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + centos-511-x64: + roles: + - master + platform: el-5-x86_64 + box: puppetlabs/centos-5.11-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/centos-66-x64-pe.yml b/spec/acceptance/nodesets/centos-66-x64-pe.yml new file mode 100644 index 000000000..9a9303706 --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64-pe.yml @@ -0,0 +1,11 @@ +HOSTS: + centos-66-x64: + roles: + - master + - database + - dashboard + platform: el-6-x86_64 + box: puppetlabs/centos-6.6-64-puppet-enterprise + hypervisor: vagrant +CONFIG: + type: pe diff --git a/spec/acceptance/nodesets/centos-66-x64.yml b/spec/acceptance/nodesets/centos-66-x64.yml new file mode 100644 index 000000000..214318a1f --- /dev/null +++ b/spec/acceptance/nodesets/centos-66-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + centos-66-x64: + roles: + - master + platform: el-6-x86_64 + box: puppetlabs/centos-6.6-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/centos-72-x64.yml b/spec/acceptance/nodesets/centos-72-x64.yml new file mode 100644 index 000000000..2c628fc6b --- /dev/null +++ b/spec/acceptance/nodesets/centos-72-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + centos-72-x64: + roles: + - master + platform: el-7-x86_64 + box: puppetlabs/centos-7.2-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/debian-78-x64.yml b/spec/acceptance/nodesets/debian-78-x64.yml new file mode 100644 index 000000000..2baa693e2 --- /dev/null +++ b/spec/acceptance/nodesets/debian-78-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + debian-78-x64: + roles: + - master + platform: debian-7-amd64 + box: puppetlabs/debian-7.8-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/debian-82-x64.yml b/spec/acceptance/nodesets/debian-82-x64.yml new file mode 100644 index 000000000..f496f1218 --- /dev/null +++ b/spec/acceptance/nodesets/debian-82-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + debian-82-x64: + roles: + - master + platform: debian-8-amd64 + box: puppetlabs/debian-8.2-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml new file mode 100644 index 000000000..fa94e2c0e --- /dev/null +++ b/spec/acceptance/nodesets/ubuntu-server-1204-x64.yml @@ -0,0 +1,9 @@ +HOSTS: + ubuntu-server-1204-x64: + roles: + - master + platform: ubuntu-12.04-amd64 + box: puppetlabs/ubuntu-12.04-64-nocm + hypervisor: vagrant +CONFIG: + type: foss diff --git a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml index cba1cd04c..72ba9c2dc 100644 --- a/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml +++ b/spec/acceptance/nodesets/ubuntu-server-1404-x64.yml @@ -3,9 +3,7 @@ HOSTS: roles: - master platform: ubuntu-14.04-amd64 - box : puppetlabs/ubuntu-14.04-64-nocm - box_url : https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm - hypervisor : vagrant + box: puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant CONFIG: - log_level : debug - type: git + type: foss diff --git a/spec/classes/coverage_spec.rb b/spec/classes/coverage_spec.rb index 12513b83c..c083569a7 100644 --- a/spec/classes/coverage_spec.rb +++ b/spec/classes/coverage_spec.rb @@ -1 +1,3 @@ +require 'rspec-puppet' + at_exit { RSpec::Puppet::Coverage.report! }