diff --git a/.fixtures.yml b/.fixtures.yml index 5db2d52c..0b9dc229 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -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}" diff --git a/.travis.yml b/.travis.yml index aa3d480b..183997b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 @@ -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 diff --git a/Gemfile b/Gemfile index 7dc524db..2918dfec 100644 --- a/Gemfile +++ b/Gemfile @@ -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 diff --git a/manifests/install.pp b/manifests/install.pp index 95e7009e..1c70640e 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -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' } } diff --git a/manifests/pyvenv.pp b/manifests/pyvenv.pp index 216d66d5..5f8fecea 100644 --- a/manifests/pyvenv.pp +++ b/manifests/pyvenv.pp @@ -59,6 +59,8 @@ $environment = [], ) { + include ::python + if $ensure == 'present' { $virtualenv_cmd = $version ? { diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 9f773f3c..75d2b698 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -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') } @@ -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 ? { @@ -136,5 +138,4 @@ subscribe => File[$requirements], environment => $environment, } - } diff --git a/metadata.json b/metadata.json index c5cbbc21..a1922ad5 100644 --- a/metadata.json +++ b/metadata.json @@ -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"} ] } diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index bcdbb003..f494c33e 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -187,6 +187,7 @@ { :id => 'root', :kernel => 'Linux', + :lsbdistcodename => nil, :osfamily => 'Suse', :operatingsystem => 'SLES', :operatingsystemrelease => '11.3', diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index b19a0317..f801a103 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -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')