Showing with 138 additions and 58 deletions.
  1. +1 −1 .msync.yml
  2. +1 −0 .overcommit.yml
  3. +0 −3 .sync.yaml
  4. +8 −0 .sync.yml
  5. +32 −5 .travis.yml
  6. +20 −1 CHANGELOG.md
  7. +7 −2 Gemfile
  8. +31 −15 README.md
  9. +16 −6 manifests/install.pp
  10. +1 −1 metadata.json
  11. +11 −0 spec/classes/python_spec.rb
  12. +10 −24 spec/spec_helper_acceptance.rb
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
modulesync_config_version: '1.9.2'
modulesync_config_version: '1.9.6'
1 change: 1 addition & 0 deletions .overcommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ PrePush:
enabled: true
description: 'Run rake targets'
targets:
- 'validate'
- 'test'
- 'rubocop'
command: [ 'bundle', 'exec', 'rake' ]
3 changes: 0 additions & 3 deletions .sync.yaml

This file was deleted.

8 changes: 8 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
---
.travis.yml:
secret: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo="
docker_sets:
- set: ubuntu1404-64
- set: ubuntu1604-64
- set: debian8-64
- set: debian9-64
- set: centos7-64
37 changes: 32 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ sudo: false
dist: trusty
language: ruby
cache: bundler
# related to https://github.com/rubygems/rubygems/issues/2123
before_install:
- 'rm -f Gemfile.lock'
- 'gem update --system'
- 'gem install bundler'
- rm -f Gemfile.lock
script:
- 'bundle exec rake $CHECK'
matrix:
Expand All @@ -28,6 +25,36 @@ matrix:
- rvm: 2.5.1
bundler_args: --without system_tests development release
env: PUPPET_VERSION="~> 5.0" CHECK=build DEPLOY_TO_FORGE=yes
- 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=ubuntu1404-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=ubuntu1604-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=debian8-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=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 All @@ -43,7 +70,7 @@ deploy:
provider: puppetforge
user: puppet
password:
secure: "D0l5n9nSaR4BTQ/fB95EWk0CuiSjLCaYDo6W5hesyaehBACbQqexEGBW2XLRlAIGz4QHgA6z87gu1Y7FMuot7xJXqgur4NU4pbrdzjz/gLuVPRxxWEmAp68yBwkwO2QoC3ISfzgRJjOMlTfAjM7dROpAoRPuNDMFGdAoC259ggA="
secure: "bBDDSSz8OQwK0zxJ4EjM01bE4uoNMzTXyxp2lllXdv6PYAJCI4bCCcdRF7OKLAWaRtm6c0HJGnfMXzmwqHF/pJSUZzfTGe4uwZrrmaGvdalP4fXtLWpviAoez8La0Nx7JYqwPPprP7nySBD8M3rUuOZJetXQM6yGgj4YSs2lKMo="
on:
tags: true
# all_branches is required to use tags
Expand Down
21 changes: 20 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,25 @@ All notable changes to this project will be documented in this file.
Each new release typically also includes the latest modulesync defaults.
These should not affect the functionality of the module.

## [v2.1.1](https://github.com/voxpupuli/puppet-python/tree/v2.1.1) (2018-08-19)

[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.1.0...v2.1.1)

**Fixed bugs:**

- CentOS Acceptance testing, and more.... [\#424](https://github.com/voxpupuli/puppet-python/pull/424) ([danquack](https://github.com/danquack))

**Closed issues:**

- enable acceptance tests for centos [\#423](https://github.com/voxpupuli/puppet-python/issues/423)
- Run acceptance tests on travis [\#402](https://github.com/voxpupuli/puppet-python/issues/402)
- \[CentOS7 + Python 2.7\]: python::virtualenv fails [\#365](https://github.com/voxpupuli/puppet-python/issues/365)

**Merged pull requests:**

- Updated README for python::virtualenv [\#421](https://github.com/voxpupuli/puppet-python/pull/421) ([tprestegard](https://github.com/tprestegard))
- enable acceptance tests [\#419](https://github.com/voxpupuli/puppet-python/pull/419) ([bastelfreak](https://github.com/bastelfreak))

## [v2.1.0](https://github.com/voxpupuli/puppet-python/tree/v2.1.0) (2018-07-09)

[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v2.0.0...v2.1.0)
Expand Down Expand Up @@ -625,4 +644,4 @@ These should not affect the functionality of the module.



\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
9 changes: 7 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def location_for(place, fake_version = nil)
end

group :test do
gem 'puppetlabs_spec_helper', '~> 2.6.0', :require => false
gem 'puppetlabs_spec_helper', '~> 2.6', :require => false
gem 'rspec-puppet', '~> 2.5', :require => false
gem 'rspec-puppet-facts', :require => false
gem 'rspec-puppet-utils', :require => false
Expand Down Expand Up @@ -53,15 +53,20 @@ group :system_tests do
end
gem 'serverspec', :require => false
gem 'beaker-hostgenerator', '>= 1.1.10', :require => false
gem 'beaker-docker', :require => false
gem 'beaker-puppet', :require => false
gem 'beaker-puppet_install_helper', :require => false
gem 'beaker-module_install_helper', :require => false
gem 'rbnacl', '>= 4', :require => false if RUBY_VERSION >= '2.2.6'
gem 'rbnacl-libsodium', :require => false if RUBY_VERSION >= '2.2.6'
gem 'bcrypt_pbkdf', :require => false
end

group :release do
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/skywinder/github-changelog-generator' if RUBY_VERSION >= '2.2.2'
gem 'puppet-blacksmith', :require => false
gem 'voxpupuli-release', :require => false, :git => 'https://github.com/voxpupuli/voxpupuli-release-gem'
gem 'puppet-strings', '~> 1.0', :require => false
gem 'puppet-strings', '>= 1.0', :require => false
end


Expand Down
46 changes: 31 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This module has been tested to work on the following systems.
* Debian 9
* EL 6
* EL 7
* CentOS 7
* Gentoo (and Sabayon)
* Suse 11
* Ubuntu 14.04
Expand Down Expand Up @@ -167,37 +168,52 @@ Creates Python virtualenv.

**requirements** - Path to pip requirements.txt file. Default: none

**proxy** - Proxy server to use for outbound connections. Default: none

**systempkgs** - Copy system site-packages into virtualenv. Default: don't

**venv_dir** - The location of the virtualenv if resource path not specified. Must be absolute path. Default: resource name

**ensure_venv_dir** - Create virtualenv directory. Default: true

**distribute** - Include distribute in the virtualenv. Default: true

**venv_dir** - The location of the virtualenv if resource path not specified. Must be absolute path. Default: resource name
**index** - Base URL of Python package index. Default: none

**owner** - Specify the owner of this virtualenv

**group** - Specify the group for this virtualenv

**index** - Base URL of Python package index. Default: none
**mode** - Specify the directory mode. Default: 0755

**proxy** - Proxy server to use for outbound connections. Default: none

**environment** - Additional environment variables required to install the packages. Default: none

**path** - Set the $PATH environment variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ]

**cwd** - The directory from which to run the "pip install" command. Default: undef

**timeout** - The maximum time in seconds the "pip install" command should take. Default: 1800

**pip_args** - Arguments to pass to pip during installation. Default: blank

**extra_pip_args** - Arguments to pass to pip for package install. These are included in the pip command *after* the requirements file. Default: blank

```puppet
python::virtualenv { '/var/www/project1' :
ensure => present,
version => 'system',
requirements => '/var/www/project1/requirements.txt',
proxy => 'http://proxy.domain.com:3128',
systempkgs => true,
distribute => false,
venv_dir => '/home/appuser/virtualenvs',
owner => 'appuser',
group => 'apps',
cwd => '/var/www/project1',
timeout => 0,
ensure => present,
version => 'system',
requirements => '/var/www/project1/requirements.txt',
systempkgs => true,
venv_dir => '/home/appuser/virtualenvs',
ensure_venv_dir => false,
distribute => false,
index => 'appuser',
owner => 'appuser',
group => 'apps',
proxy => 'http://proxy.domain.com:3128',
cwd => '/var/www/project1',
timeout => 0,
extra_pip_args => '--no-binary :none:',
}
```

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' {
$dev_ensure = 'present'
unless $python::dev {
# 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
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-python",
"version": "2.1.0",
"version": "2.1.1",
"author": "Vox Pupuli",
"summary": "Python Module",
"license": "Apache-2.0",
Expand Down
11 changes: 11 additions & 0 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,17 @@
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
34 changes: 10 additions & 24 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,33 +1,19 @@
require 'beaker-rspec'
require 'beaker-puppet'
require 'beaker/puppet_install_helper'
require 'beaker/module_install_helper'

UNSUPPORTED_PLATFORMS = ['windows'].freeze

unless ENV['RS_PROVISION'] == 'no' || ENV['BEAKER_provision'] == 'no'
hosts.each do |host|
if host.is_pe?
install_pe
else
install_puppet
end
end
end
run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no'
install_ca_certs unless ENV['PUPPET_INSTALL_TYPE'] =~ %r{pe}i
install_module_on(hosts)
install_module_dependencies_on(hosts)

RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

# Readable test descriptions
c.formatter = :documentation

# Configure all nodes in nodeset
c.before :suite do
# Install module and dependencies
hosts.each do |host|
shell('rm -rf /etc/puppet/modules/python/')
copy_module_to(host, source: proj_root, module_name: 'python')
shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
on host, puppet('module install puppetlabs-stdlib'), acceptable_exit_codes: [0, 1]
on host, puppet('module install stahnma-epel'), acceptable_exit_codes: [0, 1]
hosts.each do |host|
if host[:platform] =~ %r{el-7-x86_64} && host[:hypervisor] =~ %r{docker}
on(host, "sed -i '/nodocs/d' /etc/yum.conf")
end
end
end