Skip to content

Commit

Permalink
Merge pull request #299 from ghoneycutt/strict_vars
Browse files Browse the repository at this point in the history
Strict vars
  • Loading branch information
stankevich authored Aug 24, 2016
2 parents d3e091b + 803642d commit fde674b
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ fixtures:
ref: '4.6.0'
'epel':
repo: 'git://github.com/stahnma/puppet-module-epel.git'
ref: '1.0.2'
ref: '1.2.2'
symlinks:
python: "#{source_dir}"
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ env:
- PUPPET_GEM_VERSION="~> 4.3.0"
- PUPPET_GEM_VERSION="~> 4.4.0"
- PUPPET_GEM_VERSION="~> 4.5.0"
- PUPPET_GEM_VERSION="~> 4"
- PUPPET_GEM_VERSION="~> 4" STRICT_VARIABLES="yes"

sudo: false

Expand Down Expand Up @@ -59,7 +59,7 @@ matrix:
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4.5.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4"
env: PUPPET_GEM_VERSION="~> 4" STRICT_VARIABLES="yes"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 2.3.1
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org"
group :development, :test do
gem 'metadata-json-lint', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', '>= 1.1.1'
gem 'puppetlabs_spec_helper', '1.1.1'
gem 'puppet-lint', :require => false
gem 'pry', :require => false
gem 'simplecov', :require => false
Expand Down
7 changes: 4 additions & 3 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@

$virtualenv_package = "${python}-virtualenv"
} else {
$virtualenv_package = $::lsbdistcodename ? {
'jessie' => 'virtualenv',
default => 'python-virtualenv',
if $::lsbdistcodename == 'jessie' {
$virtualenv_package = 'virtualenv'
} else {
$virtualenv_package = 'python-virtualenv'
}
}

Expand Down
2 changes: 2 additions & 0 deletions manifests/pyvenv.pp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@
$environment = [],
) {

include ::python

if $ensure == 'present' {

$virtualenv_cmd = $version ? {
Expand Down
7 changes: 4 additions & 3 deletions manifests/requirements.pp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@
$timeout = 1800,
) {

include ::python

if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') {
fail('python::pip: root user must be used when virtualenv is system')
}
Expand All @@ -98,8 +100,8 @@
}

$pip_env = $virtualenv ? {
'system' => "${python::exec_prefix} pip",
default => "${python::exec_prefix} ${virtualenv}/bin/pip",
'system' => "${::python::exec_prefix} pip",
default => "${::python::exec_prefix} ${virtualenv}/bin/pip",
}

$proxy_flag = $proxy ? {
Expand Down Expand Up @@ -136,5 +138,4 @@
subscribe => File[$requirements],
environment => $environment,
}

}
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@
],
"dependencies": [
{"name":"puppetlabs/stdlib","version_requirement":">= 4.6.0 < 6.0.0"},
{"name":"stahnma/epel","version_requirement":">= 1.0.1 < 2.0.0"}
{"name":"stahnma/epel","version_requirement":">= 1.2.2 < 2.0.0"}
]
}
1 change: 1 addition & 0 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@
{
:id => 'root',
:kernel => 'Linux',
:lsbdistcodename => nil,
:osfamily => 'Suse',
:operatingsystem => 'SLES',
:operatingsystemrelease => '11.3',
Expand Down
6 changes: 6 additions & 0 deletions spec/defines/pyvenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

describe 'python::pyvenv', :type => :define do
let (:title) { '/opt/env' }
let (:facts) do
{
:lsbdistcodename => 'jessie',
:osfamily => 'Debian',
}
end

it {
is_expected.to contain_file( '/opt/env')
Expand Down

0 comments on commit fde674b

Please sign in to comment.