Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added CentOS rake, Add conditional that if virtualenv, then install dev
  • Loading branch information
danquack committed Aug 14, 2018
commit d4e264b89290cb45cf8f9bc7c9fdb91756c71757
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ matrix:
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
Expand Down
22 changes: 16 additions & 6 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -46,6 +40,21 @@
default => $python::virtualenv,
}

if ($venv_ensure == 'present') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to leave out braces unless they are really needed

$dev_ensure = 'present'
if ! $python::dev {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ! can also be written as unless

# 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,
Expand Down Expand Up @@ -96,6 +105,7 @@
Package <| title == 'virtualenv' |> {
name => 'virtualenv',
provider => 'pip',
require => Package['python-dev']
}
}
'scl': {
Expand Down
10 changes: 10 additions & 0 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@
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 } }
Expand Down