diff --git a/.overcommit.yml b/.overcommit.yml index 31699e74..1b03fad7 100644 --- a/.overcommit.yml +++ b/.overcommit.yml @@ -58,6 +58,7 @@ PrePush: enabled: true description: 'Run rake targets' targets: + - 'validate' - 'test' - 'rubocop' command: [ 'bundle', 'exec', 'rake' ] diff --git a/.sync.yml b/.sync.yml index cdec6c97..169bbe60 100644 --- a/.sync.yml +++ b/.sync.yml @@ -1,3 +1,9 @@ --- .travis.yml: - secret: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA=" + secret: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" + docker_sets: + - set: ubuntu1404-64 + - set: ubuntu1604-64 + - set: debian8-64 + - set: debian9-64 + - set: centos7-64 diff --git a/.travis.yml b/.travis.yml index b7b75a7c..1f25e080 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,6 +25,36 @@ matrix: - rvm: 2.5.1 bundler_args: --without system_tests development release env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1404-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=ubuntu1604-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian8-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required + - rvm: 2.5.1 + bundler_args: --without development release + dist: trusty + env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker + services: docker + sudo: required branches: only: - master @@ -40,7 +70,7 @@ deploy: provider: puppetforge user: puppet password: - secure: "" + secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo=" on: tags: true # all_branches is required to use tags diff --git a/README.md b/README.md index 55a1a1ee..3f2aec4c 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This module has been tested to work on the following systems. * Debian 9 * EL 6 * EL 7 +* CentOS 7 * Gentoo (and Sabayon) * Suse 11 * Ubuntu 14.04 diff --git a/manifests/install.pp b/manifests/install.pp index 0a91976f..bddfd0ec 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -28,12 +28,6 @@ 'Gentoo' => undef, } - $dev_ensure = $python::dev ? { - true => 'present', - false => 'absent', - default => $python::dev, - } - $pip_ensure = $python::pip ? { true => 'present', false => 'absent', @@ -46,6 +40,21 @@ default => $python::virtualenv, } + if $venv_ensure == 'present' { + $dev_ensure = 'present' + unless $python::dev { + # Error: python2-devel is needed by (installed) python-virtualenv-15.1.0-2.el7.noarch + # Python dev is required for virtual environment, but python environment is not required for python dev. + notify { 'Python virtual environment is dependent on python dev': } + } + } else { + $dev_ensure = $python::dev ? { + true => 'present', + false => 'absent', + default => $python::dev, + } + } + package { 'python': ensure => $python::ensure, name => $python, @@ -96,6 +105,7 @@ Package <| title == 'virtualenv' |> { name => 'virtualenv', provider => 'pip', + require => Package['python-dev'] } } 'scl': { diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index a82c3d71..d5ee2771 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -31,6 +31,17 @@ end end + describe 'with python::virtualenv, without python::dev' do + context 'true' do + let(:params) { { dev: 'absent', virtualenv: 'present' } } + + it { is_expected.to contain_package('python-dev').with_ensure('present') } + end + context 'empty/default' do + it { is_expected.to contain_package('python-dev').with_ensure('absent') } + end + end + describe 'with manage_gunicorn' do context 'true' do let(:params) { { manage_gunicorn: true } } diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index bede2bcb..c978c402 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1,33 +1,19 @@ require 'beaker-rspec' +require 'beaker-puppet' +require 'beaker/puppet_install_helper' +require 'beaker/module_install_helper' -UNSUPPORTED_PLATFORMS = ['windows'].freeze - -unless ENV['RS_PROVISION'] == 'no' || ENV['BEAKER_provision'] == 'no' - hosts.each do |host| - if host.is_pe? - install_pe - else - install_puppet - end - end -end +run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no' +install_ca_certs unless ENV['PUPPET_INSTALL_TYPE'] =~ %r{pe}i +install_module_on(hosts) +install_module_dependencies_on(hosts) RSpec.configure do |c| - # Project root - proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) - # Readable test descriptions c.formatter = :documentation - - # Configure all nodes in nodeset - c.before :suite do - # Install module and dependencies - hosts.each do |host| - shell('rm -rf /etc/puppet/modules/python/') - copy_module_to(host, source: proj_root, module_name: 'python') - shell("/bin/touch #{default['puppetpath']}/hiera.yaml") - on host, puppet('module install puppetlabs-stdlib'), acceptable_exit_codes: [0, 1] - on host, puppet('module install stahnma-epel'), acceptable_exit_codes: [0, 1] + hosts.each do |host| + if host[:platform] =~ %r{el-7-x86_64} && host[:hypervisor] =~ %r{docker} + on(host, "sed -i '/nodocs/d' /etc/yum.conf") end end end