Showing with 112 additions and 44 deletions.
  1. +4 −4 .fixtures.yml
  2. +20 −5 .travis.yml
  3. +17 −31 Gemfile
  4. +1 −1 README.md
  5. +10 −1 manifests/params.pp
  6. +1 −1 manifests/pip.pp
  7. +1 −1 metadata.json
  8. +41 −0 spec/classes/python_spec.rb
  9. +17 −0 spec/spec_helper.rb
8 changes: 4 additions & 4 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
fixtures:
repositories:
'stdlib':
repo: 'git://github.com/puppetlabs/puppetlabs-stdlib.git'
stdlib:
repo: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
ref: '4.6.0'
'epel':
repo: 'git://github.com/stahnma/puppet-module-epel.git'
epel:
repo: 'https://github.com/stahnma/puppet-module-epel.git'
ref: '1.2.2'
symlinks:
python: "#{source_dir}"
25 changes: 20 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ language: ruby

bundler_args: --without system_tests

before_install:
- bundle -v
- rm Gemfile.lock || true
- gem update --system
- gem update bundler
- gem --version
- bundle -v

rvm:
- 1.8.7
- 1.9.3
Expand All @@ -27,16 +35,17 @@ env:
- PUPPET_GEM_VERSION="~> 4.3.0"
- PUPPET_GEM_VERSION="~> 4.4.0"
- PUPPET_GEM_VERSION="~> 4.5.0"
- PUPPET_GEM_VERSION="~> 4" STRICT_VARIABLES="yes"
- PUPPET_GEM_VERSION="~> 4.6.0"
- PUPPET_GEM_VERSION="~> 4.7.0"
- PUPPET_GEM_VERSION="~> 4.8.0"
- PUPPET_GEM_VERSION="~> 4"

sudo: false

script: 'bundle exec rake validate && bundle exec rake lint && SPEC_OPTS="--format documentation" bundle exec rake spec'
script: 'SPEC_OPTS="--format documentation" bundle exec rake validate lint spec'

matrix:
fast_finish: true
allow_failures:
- rvm: 2.3.1
exclude:
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.1.0"
Expand All @@ -61,7 +70,13 @@ matrix:
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4.5.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4" STRICT_VARIABLES="yes"
env: PUPPET_GEM_VERSION="~> 4.6.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4.7.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4.8.0"
- rvm: 1.8.7
env: PUPPET_GEM_VERSION="~> 4"
- rvm: 2.3.1
env: PUPPET_GEM_VERSION="~> 3.1.0"
- rvm: 2.3.1
Expand Down
48 changes: 17 additions & 31 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,15 @@
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 'puppet-lint', :require => false
gem 'pry', :require => false
gem 'simplecov', :require => false
end

# pin old versions for ruby 1.8.7
if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '1.9'
gem 'rspec', '~> 2.0'
gem 'rake', '~> 10.0'
else
gem 'rake', :require => false
group :system_tests do
gem 'serverspec', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
end

if RUBY_VERSION >= '1.8.7' and RUBY_VERSION < '2.0'
# json 2.x requires ruby 2.0. Lock to 1.8
gem 'json', '~> 1.8'
# json_pure 2.0.2 requires ruby 2.0. Lock to 2.0.1
gem 'json_pure', '= 2.0.1'
if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'json'
gem 'puppet', :require => false
end

if facterversion = ENV['FACTER_GEM_VERSION']
Expand All @@ -32,16 +18,16 @@ else
gem 'facter', :require => false
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
end
gem 'puppetlabs_spec_helper', '>= 1.2.0', :require => false
gem 'rspec-puppet', :require => false
gem 'puppet-lint', '~> 2.0', :require => false
gem 'simplecov', :require => false

group :system_tests do
gem 'serverspec', :require => false
gem 'beaker', :require => false
gem 'beaker-rspec', :require => false
end
gem 'rspec', '~> 2.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
gem 'rake', '~> 10.0', :require => false if RUBY_VERSION >= '1.8.7' && RUBY_VERSION < '1.9'
gem 'json', '<= 1.8', :require => false if RUBY_VERSION < '2.0.0'
gem 'json_pure', '<= 2.0.1', :require => false if RUBY_VERSION < '2.0.0'
gem 'metadata-json-lint', '0.0.11', :require => false if RUBY_VERSION < '1.9'
gem 'metadata-json-lint', :require => false if RUBY_VERSION >= '1.9'

# vim:ft=ruby
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ Installs and manages python, python-pip, python-dev, python-virtualenv and Gunic

**manage_gunicorn** - Allow Installation / Removal of Gunicorn. Default: true

**use_epel** - Boolean to determine if the epel class is used. Default: true
**use_epel** - Boolean to determine if the epel class is used. Default: true on RHEL like systems, false otherwise

```puppet
class { 'python' :
Expand Down
11 changes: 10 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,16 @@
'Suse' => [],
'Gentoo' => ['2.7', '3.3', '3.4', '3.5']
}
$use_epel = true

if $::osfamily == 'RedHat' {
if $::operatingsystem != 'Fedora' {
$use_epel = true
} else {
$use_epel = false
}
} else {
$use_epel = false
}

$gunicorn_package_name = $::osfamily ? {
'RedHat' => 'python-gunicorn',
Expand Down
2 changes: 1 addition & 1 deletion manifests/pip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@
default: {
# Anti-action, uninstall.
exec { "pip_uninstall_${name}":
command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag}",
command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}",
onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}",
user => $owner,
group => $group,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stankevich-python",
"version": "1.18.0",
"version": "1.18.1",
"author": "stankevich",
"summary": "Python Module",
"license": "Apache-2.0",
Expand Down
41 changes: 41 additions & 0 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,37 @@
it { is_expected.to contain_package("python-dev").with_ensure('absent') }
end
end

describe "EPEL does not exist for Debian" do
context "default/empty" do
it { should_not contain_class('epel') }
end
end

end

context "on a Fedora 22 OS" do
let :facts do
{
:id => 'root',
:kernel => 'Linux',
:osfamily => 'RedHat',
:operatingsystem => 'Fedora',
:operatingsystemrelease => '22',
:concat_basedir => '/dne',
:path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
}
end

describe "EPEL does not exist for Fedora" do
context "default/empty" do
it { should_not contain_class('epel') }
end
end

end


context "on a Redhat 5 OS" do
let :facts do
{
Expand All @@ -112,6 +141,12 @@
# Basic python packages (from pip)
it { is_expected.to contain_package("virtualenv")}

describe "EPEL may be needed on EL" do
context "default/empty" do
it { should contain_class('epel') }
end
end

describe "with python::dev" do
context "true" do
let (:params) {{ :dev => 'present' }}
Expand Down Expand Up @@ -271,6 +306,12 @@
it { is_expected.to contain_package("python-dev").with_ensure('absent') }
end
end

describe "EPEL does not exist on Suse" do
context "default/empty" do
it { should_not contain_class('epel') }
end
end
end

context "on a Gentoo OS" do
Expand Down
17 changes: 17 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
require 'puppetlabs_spec_helper/module_spec_helper'

RSpec.configure do |config|
config.hiera_config = 'spec/fixtures/hiera/hiera.yaml'
config.before :each do
# Ensure that we don't accidentally cache facts and environment between
# test cases. This requires each example group to explicitly load the
# facts being exercised with something like
# Facter.collection.loader.load(:ipaddress)
Facter.clear
Facter.clear_messages
end
config.default_facts = {
:environment => 'rp_env',
:operatingsystemmajrelease => '6',
:osfamily => 'RedHat',
}
end