Showing with 90 additions and 90 deletions.
  1. +2 −32 .github/CONTRIBUTING.md
  2. +5 −5 .github/workflows/ci.yml
  3. +1 −1 .msync.yml
  4. +16 −1 CHANGELOG.md
  5. +1 −1 Dockerfile
  6. +4 −4 Gemfile
  7. +10 −5 manifests/install.pp
  8. +1 −1 manifests/params.pp
  9. +9 −1 metadata.json
  10. +0 −1 spec/acceptance/pip_spec.rb
  11. +36 −34 spec/classes/python_spec.rb
  12. +4 −3 spec/defines/pip_spec.rb
  13. +1 −1 spec/defines/requirements_spec.rb
34 changes: 2 additions & 32 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,33 +232,7 @@ simple tests against it after applying the module. You can run this
with:

```sh
bundle exec rake beaker
```

This will run the tests on the module's default nodeset. You can override the
nodeset used, e.g.,

```sh
BEAKER_set=centos-7-x64 bundle exec rake beaker
```

There are default rake tasks for the various acceptance test modules, e.g.,

```sh
bundle exec rake beaker:centos-7-x64
bundle exec rake beaker:ssh:centos-7-x64
```

If you don't want to have to recreate the virtual machine every time you can
use `BEAKER_destroy=no` and `BEAKER_provision=no`. On the first run you will at
least need `BEAKER_provision` set to yes (the default). The Vagrantfile for the
created virtual machines will be in `.vagrant/beaker_vagrant_files`.

Beaker also supports docker containers. We also use that in our automated CI
pipeline at [travis-ci](http://travis-ci.org). To use that instead of Vagrant:

```sh
PUPPET_INSTALL_TYPE=agent BEAKER_IS_PE=no BEAKER_PUPPET_COLLECTION=puppet6 BEAKER_debug=true BEAKER_setfile=debian10-64{hypervisor=docker} BEAKER_destroy=yes bundle exec rake beaker
BEAKER_setfile=debian10-x64 bundle exec rake beaker
```

You can replace the string `debian10` with any common operating system.
Expand All @@ -272,11 +246,7 @@ The following strings are known to work:
* centos7
* centos8

The easiest way to debug in a docker container is to open a shell:

```sh
docker exec -it -u root ${container_id_or_name} bash
```
For more information and tips & tricks, see [voxpupuli-acceptance's documentation](https://github.com/voxpupuli/voxpupuli-acceptance#running-tests).

The source of this file is in our [modulesync_config](https://github.com/voxpupuli/modulesync_config/blob/master/moduleroot/.github/CONTRIBUTING.md.erb)
repository.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ jobs:
setup_matrix:
name: 'Setup Test Matrix'
runs-on: ubuntu-latest
timeout-minutes: 40
outputs:
beaker_setfiles: ${{ steps.get-outputs.outputs.beaker_setfiles }}
puppet_major_versions: ${{ steps.get-outputs.outputs.puppet_major_versions }}
puppet_unit_test_matrix: ${{ steps.get-outputs.outputs.puppet_unit_test_matrix }}
env:
BUNDLE_WITHOUT: development:test:release
BUNDLE_WITHOUT: development:release
steps:
- uses: actions/checkout@v2
- name: Setup ruby
Expand All @@ -21,13 +22,16 @@ jobs:
bundler-cache: true
- name: Run rake validate
run: bundle exec rake validate
- name: Run rake rubocop
run: bundle exec rake rubocop
- name: Setup Test Matrix
id: get-outputs
run: bundle exec metadata2gha --use-fqdn --pidfile-workaround false

unit:
needs: setup_matrix
runs-on: ubuntu-latest
timeout-minutes: 40
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -58,10 +62,6 @@ jobs:
puppet: ${{fromJson(needs.setup_matrix.outputs.puppet_major_versions)}}
name: ${{ matrix.puppet.name }} - ${{ matrix.setfile.name }}
steps:
- name: Enable IPv6 on docker
run: |
echo '{"ipv6":true,"fixed-cidr-v6":"2001:db8:1::/64"}' | sudo tee /etc/docker/daemon.json
sudo service docker restart
- uses: actions/checkout@v2
- name: Setup ruby
uses: ruby/setup-ruby@v1
Expand Down
2 changes: 1 addition & 1 deletion .msync.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
modulesync_config_version: '4.0.0'
modulesync_config_version: '4.1.0'
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,22 @@ 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.

## [v6.0.1](https://github.com/voxpupuli/puppet-python/tree/v6.0.1) (2021-04-28)
## [v6.1.0](https://github.com/voxpupuli/puppet-python/tree/v6.1.0) (2021-06-05)

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

Due to a bug in the release pipeline, release v6.0.1 didn't make it to the forge. v6.0.2 just contains [modulesync 4.1.0](https://github.com/voxpupuli/modulesync_config/blob/master/CHANGELOG.md#410-2021-04-03) patch.

**Implemented enhancements:**

- Add support for FreeBSD [\#612](https://github.com/voxpupuli/puppet-python/pull/612) ([smortex](https://github.com/smortex))

**Closed issues:**

- Can't uninstall pip package because of duplicate variable name [\#532](https://github.com/voxpupuli/puppet-python/issues/532)
- audit metaparameter is deprecated [\#375](https://github.com/voxpupuli/puppet-python/issues/375)

## [v6.0.1](https://github.com/voxpupuli/puppet-python/tree/v6.0.1) (2021-04-29)

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

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ruby:2.5.3
FROM ruby:2.7

WORKDIR /opt/puppet

Expand Down
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ group :system_tests do
end

group :release do
gem 'github_changelog_generator', :require => false, :git => 'https://github.com/voxpupuli/github-changelog-generator', :branch => 'voxpupuli_essential_fixes'
gem 'puppet-blacksmith', :require => false
gem 'voxpupuli-release', :require => false
gem 'puppet-strings', '>= 2.2', :require => false
gem 'github_changelog_generator', '>= 1.16.1', :require => false
gem 'puppet-blacksmith', :require => false
gem 'voxpupuli-release', :require => false
gem 'puppet-strings', '>= 2.2', :require => false
end

gem 'puppetlabs_spec_helper', '~> 2.0', :require => false
Expand Down
15 changes: 10 additions & 5 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@
}

$pythondev = $facts['os']['family'] ? {
'AIX' => "${python}-devel",
'RedHat' => "${python}-devel",
'Debian' => "${python}-dev",
'Suse' => "${python}-devel",
'Gentoo' => undef,
'AIX' => "${python}-devel",
'Debian' => "${python}-dev",
'FreeBSD' => undef,
'Gentoo' => undef,
'RedHat' => "${python}-devel",
'Suse' => "${python}-devel",
}

$pip_ensure = $python::pip ? {
Expand Down Expand Up @@ -225,6 +226,10 @@
$pip_category = undef
$pip_package = 'python2-pip'
$pip_provider = pip2
} elsif $facts['os']['family'] == 'FreeBSD' {
$pip_category = undef
$pip_package = "py${python::version}-pip"
$pip_provider = 'pip'
} elsif $facts['os']['family'] == 'Gentoo' {
$pip_category = 'dev-python'
$pip_package = 'pip'
Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#
class python::params {
# Module compatibility check
unless $facts['os']['family'] in ['Debian', 'RedHat', 'Suse', 'Gentoo', 'AIX',] {
unless $facts['os']['family'] in ['AIX', 'Debian', 'FreeBSD', 'Gentoo', 'RedHat', 'Suse'] {
fail("Module is not compatible with ${facts['os']['name']}")
}

Expand Down
10 changes: 9 additions & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "puppet-python",
"version": "6.0.1",
"version": "6.1.0",
"author": "Vox Pupuli",
"summary": "Python Module",
"license": "Apache-2.0",
Expand Down Expand Up @@ -36,6 +36,14 @@
"10"
]
},
{
"operatingsystem": "FreeBSD",
"operatingsystemrelease": [
"11",
"12",
"13"
]
},
{
"operatingsystem": "Gentoo"
},
Expand Down
1 change: 0 additions & 1 deletion spec/acceptance/pip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,3 @@ class { 'python':
its(:stdout) { is_expected.not_to match %r{agent.* 0\.1\.2} }
end
end

70 changes: 36 additions & 34 deletions spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -118,41 +118,43 @@

it { is_expected.to contain_python__pyvenv('/opt/env1').with_ensure('present') }
it { is_expected.to contain_python__pyvenv('/opt/env2').with_ensure('present') }
it { is_expected.to contain_exec('python_virtualenv_/opt/env1')
.with(
command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools',
user: 'root',
creates: '/opt/env1/bin/activate',
path: [
'/bin',
'/usr/bin',
'/usr/sbin',
'/usr/local/bin'
],
cwd: '/tmp',
environment: [],
timeout: 600,
unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env1\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$}
)
.that_requires('File[/opt/env1]')
it {
is_expected.to contain_exec('python_virtualenv_/opt/env1').
with(
command: 'python3.8 -m venv --clear /opt/env1 && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade pip && /opt/env1/bin/pip --log /opt/env1/pip.log install --upgrade setuptools',
user: 'root',
creates: '/opt/env1/bin/activate',
path: [
'/bin',
'/usr/bin',
'/usr/sbin',
'/usr/local/bin'
],
cwd: '/tmp',
environment: [],
timeout: 600,
unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env1\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env1/bin/activate$}
).
that_requires('File[/opt/env1]')
}
it { is_expected.to contain_exec('python_virtualenv_/opt/env2')
.with(
command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools',
user: 'root',
creates: '/opt/env2/bin/activate',
path: [
'/bin',
'/usr/bin',
'/usr/sbin',
'/usr/local/bin'
],
cwd: '/tmp',
environment: [],
timeout: 600,
unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env2\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$}
)
.that_requires('File[/opt/env2]')
it {
is_expected.to contain_exec('python_virtualenv_/opt/env2').
with(
command: 'python3.8 -m venv --clear /opt/env2 && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade \'pip <= 20.3.4\' && /opt/env2/bin/pip --log /opt/env2/pip.log install --upgrade setuptools',
user: 'root',
creates: '/opt/env2/bin/activate',
path: [
'/bin',
'/usr/bin',
'/usr/sbin',
'/usr/local/bin'
],
cwd: '/tmp',
environment: [],
timeout: 600,
unless: %r{^grep '\^\[\\t \]\*VIRTUAL_ENV=\[\\\\'\\\"\]\*/opt/env2\[\\\"\\\\'\]\[\\t \]\*\$' /opt/env2/bin/activate$}
).
that_requires('File[/opt/env2]')
}
it { is_expected.to contain_file('/opt/env1') }
it { is_expected.to contain_file('/opt/env2') }
Expand Down
7 changes: 4 additions & 3 deletions spec/defines/pip_spec.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require 'spec_helper'

describe 'python::pip', type: :define do # rubocop:disable RSpec/MultipleDescribes
# rubocop:disable RSpec/MultipleDescribes
describe 'python::pip', type: :define do
let(:title) { 'rpyc' }

context 'on Debian OS' do
Expand Down Expand Up @@ -118,7 +118,7 @@
end

context 'passes correct package name' do
let(:params) { { ensure: 'absent', 'pkgname': 'r-pyc' } }
let(:params) { { ensure: 'absent', pkgname: 'r-pyc' } }

it { is_expected.not_to contain_exec('pip_install_rpyc') }

Expand Down Expand Up @@ -162,3 +162,4 @@
end
end
end
# rubocop:enable RSpec/MultipleDescribes
2 changes: 1 addition & 1 deletion spec/defines/requirements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
it { is_expected.to contain_package('gunicorn') }
it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') }

if facts[:os]['name'] == 'Gentoo'
if %w[FreeBSD Gentoo].include?(facts[:os]['name'])
it { is_expected.not_to contain_package('python-dev') }
else
it { is_expected.to contain_package('python-dev') }
Expand Down