From 63a46bbc068f0a691033a1051fb8c3565a12422b Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 5 Jul 2017 10:02:29 -0400 Subject: [PATCH 1/4] Support latest Puppet v3 and last five releases of Puppet v4 Use actual versions of ruby that are supported, so 2.1.9 instead of 2.1.0 and remove 2.3.1 as it never made it into Puppet v4. --- .travis.yml | 89 ++++++++++------------------------------------------- Gemfile | 12 +++++--- README.md | 13 ++++---- 3 files changed, 31 insertions(+), 83 deletions(-) diff --git a/.travis.yml b/.travis.yml index ef9dcf18..eab11e1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,90 +11,33 @@ before_install: - gem --version - bundle -v -rvm: - - 1.8.7 - - 1.9.3 - - 2.0.0 - - 2.1.0 - - 2.3.1 - -env: - matrix: - - PUPPET_GEM_VERSION="~> 3.1.0" - - PUPPET_GEM_VERSION="~> 3.2.0" - - PUPPET_GEM_VERSION="~> 3.3.0" - - PUPPET_GEM_VERSION="~> 3.4.0" - - PUPPET_GEM_VERSION="~> 3.5.0" - - PUPPET_GEM_VERSION="~> 3.6.0" - - PUPPET_GEM_VERSION="~> 3.7.0" - - PUPPET_GEM_VERSION="~> 3.8.0" - - PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" - - PUPPET_GEM_VERSION="~> 4.0.0" - - PUPPET_GEM_VERSION="~> 4.1.0" - - PUPPET_GEM_VERSION="~> 4.2.0" - - PUPPET_GEM_VERSION="~> 4.3.0" - - PUPPET_GEM_VERSION="~> 4.4.0" - - PUPPET_GEM_VERSION="~> 4.5.0" - - PUPPET_GEM_VERSION="~> 4.6.0" - - PUPPET_GEM_VERSION="~> 4.7.0" - - PUPPET_GEM_VERSION="~> 4.8.0" - - PUPPET_GEM_VERSION="~> 4" - sudo: false script: 'SPEC_OPTS="--format documentation" bundle exec rake validate lint spec' matrix: fast_finish: true - exclude: - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.1.0" - - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.1.0" - - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.2.0" - - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.3.0" - - rvm: 2.1.0 - env: PUPPET_GEM_VERSION="~> 3.4.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.0.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.1.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.2.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.3.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.4.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 4.5.0" + include: - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" + - rvm: 2.0.0 + env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" + - rvm: 2.1.9 + env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" + - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4.6.0" - - rvm: 1.8.7 + - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4.7.0" - - rvm: 1.8.7 + - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4.8.0" - - rvm: 1.8.7 + - rvm: 2.1.9 + env: PUPPET_GEM_VERSION="~> 4.9.0" + - rvm: 2.1.9 + env: PUPPET_GEM_VERSION="~> 4.10.0" + - rvm: 2.1.9 env: PUPPET_GEM_VERSION="~> 4" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.1.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.2.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.3.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.4.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.5.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.6.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.7.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3.8.0" - - rvm: 2.3.1 - env: PUPPET_GEM_VERSION="~> 3" FUTURE_PARSER="yes" notifications: email: false diff --git a/Gemfile b/Gemfile index 898be012..c417fd3d 100644 --- a/Gemfile +++ b/Gemfile @@ -18,8 +18,7 @@ else gem 'facter', :require => false end -gem 'puppetlabs_spec_helper', '>= 1.2.0', :require => false -gem 'rspec-puppet', :require => false +gem 'rspec-puppet', '~> 2.0', :require => false gem 'puppet-lint', '~> 2.0', :require => false gem 'simplecov', :require => false @@ -27,7 +26,12 @@ gem 'rspec', '~> 2.0', :require => false if RUBY_VERSION >= '1.8.7' gem 'rake', '~> 10.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' gem 'json', '<= 1.8', :require => false if RUBY_VERSION < '2.0.0' gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0' -gem 'metadata-json-lint', '0.0.11', :require => false if RUBY_VERSION < '1.9' -gem 'metadata-json-lint', :require => false if RUBY_VERSION >= '1.9' +gem 'metadata-json-lint', '0.0.11' if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' +gem 'metadata-json-lint', '1.0.0' if RUBY_VERSION >= '1.9' && RUBY_VERSION < '2.0' +gem 'metadata-json-lint' if RUBY_VERSION >= '2.0' + +gem 'puppetlabs_spec_helper', '2.0.2', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9' +gem 'puppetlabs_spec_helper', '>= 2.0.0', :require => false if RUBY_VERSION >= '1.9' +gem 'parallel_tests', '<= 2.9.0', :require => false if RUBY_VERSION < '2.0.0' # vim:ft=ruby diff --git a/README.md b/README.md index 36ecec4e..802e79f4 100644 --- a/README.md +++ b/README.md @@ -6,16 +6,17 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn # Compatibility # -* Puppet v3 (with and without the future parser) +See `.travis.yml` for compatibility matrix. + +* Puppet v3 (with the future parser) * Puppet v4 ## Ruby versions -* 1.8.7 -* 1.9.3 -* 2.0.0 -* 2.1.0 -* 2.3.1 +* 1.8.7 - Puppet 3 +* 1.9.3 - Puppet 3 +* 2.0.0 - Puppet 3 +* 2.1.9 - Puppet 3 & 4 ## OS Distributions ## From adf6b371bf9f1fd96329940ee1483f925353b884 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 5 Jul 2017 10:03:43 -0400 Subject: [PATCH 2/4] Comply with style --- manifests/init.pp | 8 ++++---- manifests/install.pp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 8b3caf30..a4e22236 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -133,10 +133,10 @@ } # Anchor pattern to contain dependencies - anchor { 'python::begin': } -> - class { 'python::install': } -> - class { 'python::config': } -> - anchor { 'python::end': } + anchor { 'python::begin': } + -> class { 'python::install': } + -> class { 'python::config': } + -> anchor { 'python::end': } # Allow hiera configuration of python resources create_resources('python::pip', $python_pips) diff --git a/manifests/install.pp b/manifests/install.pp index afe17dac..72da81de 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -164,12 +164,12 @@ } if $::python::rhscl_use_public_repository { - Package <| tag == 'python-scl-repo' |> -> - Package <| tag == 'python-scl-package' |> + Package <| tag == 'python-scl-repo' |> + -> Package <| tag == 'python-scl-package' |> } - Package <| tag == 'python-scl-package' |> -> - Package <| tag == 'python-pip-package' |> + Package <| tag == 'python-scl-package' |> + -> Package <| tag == 'python-pip-package' |> } default: { From 0c963e324784ebdb825ccecf5928ab60458287d2 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 5 Jul 2017 10:09:19 -0400 Subject: [PATCH 3/4] Fix failing spec tests --- spec/defines/pip_spec.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/defines/pip_spec.rb b/spec/defines/pip_spec.rb index e03fd7f1..56216c59 100644 --- a/spec/defines/pip_spec.rb +++ b/spec/defines/pip_spec.rb @@ -34,11 +34,11 @@ describe "proxy as" do context "defaults to empty" do let (:params) {{ }} - it { is_expected.to contain_exec("pip_install_rpyc").without_command(/--proxy/) } + it { should_not contain_exec("pip_install_rpyc").with_command(/--proxy/) } end context "does not add proxy to search command if set to latest and proxy is unset" do let (:params) {{ :ensure => 'latest' }} - it { is_expected.to contain_exec("pip_install_rpyc").without_command(/--proxy/) } + it { should_not contain_exec("pip_install_rpyc").with_command(/--proxy/) } it { is_expected.to contain_exec("pip_install_rpyc").without_unless(/--proxy/) } end context "adds proxy to install command if proxy set" do @@ -55,7 +55,7 @@ describe 'index as' do context 'defaults to empty' do let (:params) {{ }} - it { is_expected.to contain_exec('pip_install_rpyc').without_command(/--index-url/) } + it { should_not contain_exec('pip_install_rpyc').with_command(/--index-url/) } end context 'adds index to install command if index set' do let (:params) {{ :index => 'http://www.example.com/simple/' }} From 70dabffd128fffd44e83c42f45c0a10b7b8b26a9 Mon Sep 17 00:00:00 2001 From: Garrett Honeycutt Date: Wed, 5 Jul 2017 10:19:02 -0400 Subject: [PATCH 4/4] Validate ruby files under spec/ --- Rakefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 28d00a1e..abf2783b 100644 --- a/Rakefile +++ b/Rakefile @@ -17,7 +17,6 @@ PuppetLint.configuration.send('disable_class_inherits_from_params_class') PuppetLint.configuration.send('disable_class_parameter_defaults') PuppetLint.configuration.send('disable_documentation') PuppetLint.configuration.send('disable_single_quote_string_with_variables') -PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] exclude_paths = [ "pkg/**/*", @@ -27,6 +26,13 @@ exclude_paths = [ PuppetLint.configuration.ignore_paths = exclude_paths PuppetSyntax.exclude_paths = exclude_paths +desc 'Validate manifests, templates, ruby files and shell scripts' +task :validate do + Dir['spec/**/*.rb'].each do |ruby_file| + sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/ + end +end + desc "Run acceptance tests" RSpec::Core::RakeTask.new(:acceptance) do |t| t.pattern = 'spec/acceptance'