Skip to content

Commit d4e264b

Browse files
committed
Added CentOS rake, Add conditional that if virtualenv, then install dev
1 parent f95edde commit d4e264b

3 files changed

Lines changed: 32 additions & 6 deletions

File tree

.travis.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,12 @@ matrix:
4949
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=debian9-64{hypervisor=docker} CHECK=beaker
5050
services: docker
5151
sudo: required
52+
- rvm: 2.5.1
53+
bundler_args: --without development release
54+
dist: trusty
55+
env: PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet5 BEAKER_debug=true BEAKER_setfile=centos7-64{hypervisor=docker} CHECK=beaker
56+
services: docker
57+
sudo: required
5258
branches:
5359
only:
5460
- master

manifests/install.pp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@
2828
'Gentoo' => undef,
2929
}
3030

31-
$dev_ensure = $python::dev ? {
32-
true => 'present',
33-
false => 'absent',
34-
default => $python::dev,
35-
}
36-
3731
$pip_ensure = $python::pip ? {
3832
true => 'present',
3933
false => 'absent',
@@ -46,6 +40,21 @@
4640
default => $python::virtualenv,
4741
}
4842

43+
if ($venv_ensure == 'present') {
44+
$dev_ensure = 'present'
45+
if ! $python::dev {
46+
# Error: python2-devel is needed by (installed) python-virtualenv-15.1.0-2.el7.noarch
47+
# Python dev is required for virtual environment, but python environment is not required for python dev.
48+
notify { 'Python virtual environment is dependent on python dev': }
49+
}
50+
} else {
51+
$dev_ensure = $python::dev ? {
52+
true => 'present',
53+
false => 'absent',
54+
default => $python::dev,
55+
}
56+
}
57+
4958
package { 'python':
5059
ensure => $python::ensure,
5160
name => $python,
@@ -96,6 +105,7 @@
96105
Package <| title == 'virtualenv' |> {
97106
name => 'virtualenv',
98107
provider => 'pip',
108+
require => Package['python-dev']
99109
}
100110
}
101111
'scl': {

spec/classes/python_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,16 @@
3131
end
3232
end
3333

34+
describe 'with python::virtualenv, without python::dev' do
35+
context 'true' do
36+
let(:params) { { dev: 'absent', virtualenv: 'present' } }
37+
it { is_expected.to contain_package('python-dev').with_ensure('present') }
38+
end
39+
context 'empty/default' do
40+
it { is_expected.to contain_package('python-dev').with_ensure('absent') }
41+
end
42+
end
43+
3444
describe 'with manage_gunicorn' do
3545
context 'true' do
3646
let(:params) { { manage_gunicorn: true } }

0 commit comments

Comments
 (0)