11 changes: 7 additions & 4 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,18 +232,21 @@ simple tests against it after applying the module. You can run this
with:

```sh
BEAKER_setfile=debian11-64 bundle exec rake beaker
BEAKER_PUPPET_COLLECTION=puppet7 BEAKER_setfile=debian11-64 bundle exec rake beaker
```

You can replace the string `debian10` with any common operating system.
You can replace the string `debian11` with any common operating system.
The following strings are known to work:

* ubuntu1804
* ubuntu2004
* debian10
* ubuntu2204
* debian11
* centos7
* centos8
* centos9
* almalinux8
* almalinux9
* fedora36

For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests).

Expand Down
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
# Managed by modulesync - DO NOT EDIT
# https://voxpupuli.org/docs/updating-files-managed-with-modulesync/

modulesync_config_version: '6.0.0'
modulesync_config_version: '7.0.0'
21 changes: 19 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,24 @@ 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.

## [v7.0.0](https://github.com/voxpupuli/puppet-python/tree/v7.0.0) (2023-07-12)
## [v7.1.0](https://github.com/voxpupuli/puppet-python/tree/v7.1.0) (2023-11-29)

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

**Implemented enhancements:**

- Add Ubuntu 22.04 support [\#679](https://github.com/voxpupuli/puppet-python/pull/679) ([bastelfreak](https://github.com/bastelfreak))
- Add Debian 12 support [\#678](https://github.com/voxpupuli/puppet-python/pull/678) ([bastelfreak](https://github.com/bastelfreak))
- Add OracleLinux/AlmaLinux/Rocky support [\#677](https://github.com/voxpupuli/puppet-python/pull/677) ([JakeTRogers](https://github.com/JakeTRogers))
- Bump puppet-epel to allow 5.x [\#674](https://github.com/voxpupuli/puppet-python/pull/674) ([dandunckelman](https://github.com/dandunckelman))
- Allow to skip management of python dev package [\#669](https://github.com/voxpupuli/puppet-python/pull/669) ([smortex](https://github.com/smortex))

**Fixed bugs:**

- Use the wheel group by default on FreeBSD [\#672](https://github.com/voxpupuli/puppet-python/pull/672) ([smortex](https://github.com/smortex))
- If user declares their requirements.txt in Puppet, don't skip pip installation in python::requirements [\#619](https://github.com/voxpupuli/puppet-python/pull/619) ([acullenn](https://github.com/acullenn))

## [v7.0.0](https://github.com/voxpupuli/puppet-python/tree/v7.0.0) (2023-07-27)

[Full Changelog](https://github.com/voxpupuli/puppet-python/compare/v6.4.0...v7.0.0)

Expand Down Expand Up @@ -796,7 +813,7 @@ Due to a bug in the release pipeline, release v6.0.1 didn't make it to the forge
**Closed issues:**

- 'system' or any other version of python doesn't work, doesn't get validated [\#129](https://github.com/voxpupuli/puppet-python/issues/129)
- Could not look up qualified variable '::python::install::valid\_versions' [\#126](https://github.com/voxpupuli/puppet-python/issues/126)
- Could not look up qualified variable `python::install::valid_versions` [\#126](https://github.com/voxpupuli/puppet-python/issues/126)

## [1.7.11](https://github.com/voxpupuli/puppet-python/tree/1.7.11) (2014-10-11)

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
source ENV['GEM_SOURCE'] || 'https://rubygems.org'

group :test do
gem 'voxpupuli-test', '~> 6.0', :require => false
gem 'voxpupuli-test', '~> 7.0', :require => false
gem 'coveralls', :require => false
gem 'simplecov-console', :require => false
gem 'puppet_metadata', '~> 3.0', :require => false
Expand Down
11 changes: 10 additions & 1 deletion REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ The following parameters are available in the `python` class:
* [`umask`](#-python--umask)
* [`manage_gunicorn`](#-python--manage_gunicorn)
* [`manage_python_package`](#-python--manage_python_package)
* [`manage_dev_package`](#-python--manage_dev_package)
* [`manage_venv_package`](#-python--manage_venv_package)
* [`manage_pip_package`](#-python--manage_pip_package)
* [`venv`](#-python--venv)
Expand Down Expand Up @@ -192,6 +193,14 @@ manage the state for package python

Default value: `true`

##### <a name="-python--manage_dev_package"></a>`manage_dev_package`

Data type: `Boolean`

manage the state of the python development package

Default value: `true`

##### <a name="-python--manage_venv_package"></a>`manage_venv_package`

Data type: `Boolean`
Expand Down Expand Up @@ -1163,7 +1172,7 @@ Alias of `Enum['debug', 'info', 'warning', 'error', 'critical']`

Match all valid package ensures for python

Alias of `Enum['absent', 'present', 'latest']`
Alias of `Enum['absent', 'present', 'installed', 'latest']`

### <a name="Python--Provider"></a>`Python::Provider`

Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
# @param umask The default umask for invoked exec calls.
# @param manage_gunicorn manage the state for package gunicorn
# @param manage_python_package manage the state for package python
# @param manage_dev_package manage the state of the python development package
# @param manage_venv_package manage the state for package venv
# @param manage_pip_package manage the state for package pip
#
Expand All @@ -45,6 +46,7 @@
Python::Package::Ensure $gunicorn = 'absent',
Boolean $manage_gunicorn = true,
Boolean $manage_python_package = true,
Boolean $manage_dev_package = true,
Boolean $manage_venv_package = $python::params::manage_venv_package,
Boolean $manage_pip_package = $python::params::manage_pip_package,
String[1] $gunicorn_package_name = $python::params::gunicorn_package_name,
Expand Down
8 changes: 4 additions & 4 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
##
## CentOS has no extra package for venv
##
unless $facts['os']['name'] == 'CentOS' {
unless $facts['os']['family'] == 'RedHat' {
package { 'python-venv':
ensure => $python::venv,
name => "${python}-venv",
Expand All @@ -53,7 +53,7 @@
}
}

if $pythondev {
if $python::manage_dev_package and $pythondev {
package { 'python-dev':
ensure => $python::dev,
name => $pythondev,
Expand Down Expand Up @@ -179,7 +179,7 @@
}
}

if $pythondev {
if $python::manage_dev_package and $pythondev {
package { 'python-dev':
ensure => $python::dev,
name => $pythondev,
Expand All @@ -196,7 +196,7 @@
}
}

if $pythondev {
if $python::manage_dev_package and $pythondev {
package { 'python-dev':
ensure => $python::dev,
name => $pythondev,
Expand Down
5 changes: 3 additions & 2 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
}

$group = $facts['os']['family'] ? {
'AIX' => 'system',
default => 'root'
'AIX' => 'system',
'FreeBSD' => 'wheel',
default => 'root'
}

$pip_lookup_path = $facts['os']['family'] ? {
Expand Down
2 changes: 2 additions & 0 deletions manifests/requirements.pp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@
content => '# Puppet will install and/or update pip packages listed here',
}

$local_subscribe = File[$requirements]
} elsif File[$requirements] and $manage_requirements == true {
$local_subscribe = File[$requirements]
} else {
$local_subscribe = undef
Expand Down
38 changes: 34 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-python",
"version": "7.0.0",
"version": "7.1.0",
"author": "Vox Pupuli",
"summary": "Puppet module for Python",
"license": "Apache-2.0",
Expand All @@ -20,6 +20,13 @@
"7100-05-03-1837"
]
},
{
"operatingsystem": "AlmaLinux",
"operatingsystemrelease": [
"8",
"9"
]
},
{
"operatingsystem": "CentOS",
"operatingsystemrelease": [
Expand All @@ -31,7 +38,8 @@
"operatingsystem": "Debian",
"operatingsystemrelease": [
"10",
"11"
"11",
"12"
]
},
{
Expand All @@ -49,7 +57,29 @@
"operatingsystem": "Ubuntu",
"operatingsystemrelease": [
"18.04",
"20.04"
"20.04",
"22.04"
]
},
{
"operatingsystem": "OracleLinux",
"operatingsystemrelease": [
"8",
"9"
]
},
{
"operatingsystem": "RedHat",
"operatingsystemrelease": [
"8",
"9"
]
},
{
"operatingsystem": "Rocky",
"operatingsystemrelease": [
"8",
"9"
]
},
{
Expand All @@ -75,7 +105,7 @@
},
{
"name": "puppet/epel",
"version_requirement": ">= 3.0.0 < 5.0.0"
"version_requirement": ">= 3.0.0 < 6.0.0"
}
]
}
26 changes: 26 additions & 0 deletions spec/acceptance/declared_requirements_install_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# frozen_string_literal: true

require 'spec_helper_acceptance'

describe 'requirements' do
it 'checks declared requirements file is installed to venv' do
pp = <<-EOS
file { '/tmp/requirements.txt':
ensure => 'present',
content => 'requests',
}
python::pyvenv { '/tmp/pyvenv':
ensure => 'present',
}
python::requirements { '/tmp/requirements.txt':
virtualenv => '/tmp/pyvenv'
}
EOS

apply_manifest(pp, catch_failures: true)

expect(shell('/tmp/pyvenv/bin/pip3 list --no-index | grep requests').stdout).to match(%r{requests +\d+.\d+.\d+})
end
end
6 changes: 4 additions & 2 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
it { is_expected.to contain_package('pip') }
end

if %w[Archlinux CentOS].include?(facts[:os]['name'])
if %w[Archlinux RedHat].include?(facts[:os]['family'])
it { is_expected.not_to contain_package('python-venv') }
else
it { is_expected.to contain_package('python-venv') }
Expand All @@ -34,13 +34,15 @@
let :params do
{
manage_python_package: false,
manage_dev_package: false,
manage_pip_package: false,
manage_venv_package: false
}
end

it { is_expected.to compile.with_all_deps }
it { is_expected.not_to contain_package('python') }
it { is_expected.not_to contain_package('python-dev') }
it { is_expected.not_to contain_package('pip') }
it { is_expected.not_to contain_package('python-venv') }
end
Expand All @@ -58,7 +60,7 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_package('pip').with(ensure: 'present') }

it { is_expected.to contain_package('python-venv').with(ensure: 'present') } unless facts[:os]['name'] == 'CentOS'
it { is_expected.to contain_package('python-venv').with(ensure: 'present') } unless facts[:os]['family'] == 'RedHat'
end

case facts[:os]['family']
Expand Down
1 change: 1 addition & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
add_custom_fact name.to_sym, value
end
end
Dir['./spec/support/spec/**/*.rb'].sort.each { |f| require f }
2 changes: 1 addition & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

require 'voxpupuli/acceptance/spec_helper_acceptance'

configure_beaker
configure_beaker(modules: :metadata)

Dir['./spec/support/acceptance/**/*.rb'].sort.each { |f| require f }
8 changes: 5 additions & 3 deletions spec/unit/facter/pip_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
Facter.clear
end

# rubocop:disable RSpec/IndexedLet
let(:pip_version_output) do
<<~EOS
pip 6.0.6 from /opt/boxen/homebrew/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg (python 2.7)
Expand All @@ -24,6 +25,7 @@
pip 18.1 from /usr/lib/python3/dist-packages/pip (python 3.7)
EOS
end
# rubocop:enable RSpec/IndexedLet

describe 'pip_version' do
context 'returns pip version when pip present' do
Expand All @@ -37,7 +39,7 @@
context 'returns nil when pip not present' do
it do
allow(Facter::Util::Resolution).to receive(:which).with('pip').and_return(false)
expect(Facter.value(:pip_version)).to eq(nil)
expect(Facter.value(:pip_version)).to be_nil
end
end
end
Expand All @@ -54,7 +56,7 @@
context 'returns nil when pip2 not present' do
it do
allow(Facter::Util::Resolution).to receive(:which).with('pip2').and_return(false)
expect(Facter.value(:pip2_version)).to eq(nil)
expect(Facter.value(:pip2_version)).to be_nil
end
end
end
Expand All @@ -71,7 +73,7 @@
context 'returns nil when pip3 not present' do
it do
allow(Facter::Util::Resolution).to receive(:which).with('pip3').and_return(false)
expect(Facter.value(:pip3_version)).to eq(nil)
expect(Facter.value(:pip3_version)).to be_nil
end
end
end
Expand Down
Loading