Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

* `python::config`: Optionally installs the gunicorn service
* `python::install`: Installs core python packages
* `python::params`: The python Module default configuration settings.

### Defined types

Expand Down Expand Up @@ -83,6 +82,8 @@ The following parameters are available in the `python` class:
* [`manage_dev_package`](#-python--manage_dev_package)
* [`manage_venv_package`](#-python--manage_venv_package)
* [`manage_pip_package`](#-python--manage_pip_package)
* [`group`](#-python--group)
* [`pip_lookup_path`](#-python--pip_lookup_path)
* [`venv`](#-python--venv)
* [`gunicorn_package_name`](#-python--gunicorn_package_name)
* [`python_pips`](#-python--python_pips)
Expand Down Expand Up @@ -170,7 +171,7 @@ Data type: `Boolean`

to determine if the epel class is used.

Default value: `$python::params::use_epel`
Default value: `false`

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

Expand Down Expand Up @@ -212,15 +213,31 @@ Data type: `Boolean`

manage the state for package venv

Default value: `$python::params::manage_venv_package`
Default value: `true`

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

Data type: `Boolean`

manage the state for package pip

Default value: `$python::params::manage_pip_package`
Default value: `true`

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

Data type: `String[1]`

The group owner of the virtulenv and dotfile

Default value: `'root'`

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

Data type: `Array`

The paths used when bootstrapping pip

Default value: `['/bin', '/usr/bin', '/usr/local/bin']`

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

Expand All @@ -236,7 +253,7 @@ Data type: `String[1]`



Default value: `$python::params::gunicorn_package_name`
Default value: `'gunicorn'`

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

Expand Down Expand Up @@ -422,7 +439,7 @@ Data type: `String[1]`

group owner of dotfile

Default value: `getvar('python::params::group')`
Default value: `$python::group`

##### <a name="-python--dotfile--config"></a>`config`

Expand Down Expand Up @@ -771,7 +788,7 @@ Data type: `Optional[String[1]]`

The group of the virtualenv being manipulated.

Default value: `getvar('python::params::group')`
Default value: `$python::group`

##### <a name="-python--pip--index"></a>`index`

Expand Down
6 changes: 6 additions & 0 deletions data/os/AIX.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
python::group: system
python::pip_lookup_path:
- /bin
- /usr/bin
- /usr/local/bin
- /opt/freeware/bin/
2 changes: 2 additions & 0 deletions data/os/Archlinux.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
python::default_system_version: "3.13"
python::manage_pip_package: false
python::manage_venv_package: false
1 change: 1 addition & 0 deletions data/os/Fedora.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python::use_epel: false
1 change: 1 addition & 0 deletions data/os/FreeBSD.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
python::group: wheel
python::default_system_version: "3.11"
2 changes: 2 additions & 0 deletions data/os/RedHat.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python::gunicorn_package_name: python3-gunicorn
python::use_epel: true
2 changes: 1 addition & 1 deletion manifests/dotfile.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
Enum['absent', 'present'] $ensure = 'present',
Stdlib::Absolutepath $filename = $title,
String[1] $owner = 'root',
String[1] $group = getvar('python::params::group'),
String[1] $group = $python::group,
Stdlib::Filemode $mode = '0644',
Hash $config = {},
) {
Expand Down
14 changes: 9 additions & 5 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
# @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
# @param group The group owner of the virtulenv and dotfile
# @param pip_lookup_path The paths used when bootstrapping pip
#
# @example install python from system python
# class { 'python':
Expand All @@ -49,20 +51,22 @@
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,
Boolean $manage_venv_package = true,
Boolean $manage_pip_package = true,
String[1] $gunicorn_package_name = 'gunicorn',
Optional[Python::Provider] $provider = undef,
Hash $python_pips = {},
Hash $python_pyvenvs = {},
Hash $python_requirements = {},
Hash $python_dotfiles = {},
Boolean $use_epel = $python::params::use_epel,
Boolean $use_epel = false,
Boolean $rhscl_use_public_repository = true,
Stdlib::Httpurl $anaconda_installer_url = 'https://repo.anaconda.com/archive/Anaconda3-5.2.0-Linux-x86_64.sh',
Stdlib::Absolutepath $anaconda_install_path = '/opt/python',
Boolean $manage_scl = true,
) inherits python::params {
String[1] $group = 'root',
Array $pip_lookup_path = ['/bin', '/usr/bin', '/usr/local/bin'],
) {
$exec_prefix = $provider ? {
'scl' => "/usr/bin/scl enable ${version} -- ",
'rhscl' => "/usr/bin/scl enable ${version} -- ",
Expand Down
45 changes: 0 additions & 45 deletions manifests/params.pp

This file was deleted.

2 changes: 1 addition & 1 deletion manifests/pip.pp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
String[1] $pip_provider = 'pip',
Variant[Boolean, String] $url = false,
String[1] $owner = 'root',
Optional[String[1]] $group = getvar('python::params::group'),
Optional[String[1]] $group = $python::group,
Optional[Python::Umask] $umask = undef,
Variant[Boolean,String[1]] $index = false,
Variant[Boolean,String[1]] $extra_index = false,
Expand Down
6 changes: 3 additions & 3 deletions manifests/pip/bootstrap.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Variant[Boolean, String] $manage_python = false,
Optional[Stdlib::HTTPUrl] $http_proxy = undef,
String[1] $exec_provider = 'shell',
) inherits python::params {
) {
if $manage_python {
include python
} else {
Expand All @@ -36,7 +36,7 @@
command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python3',
environment => $environ,
unless => 'which pip3',
path => $python::params::pip_lookup_path,
path => $python::pip_lookup_path,
require => Package['python3'],
provider => $exec_provider,
}
Expand All @@ -53,7 +53,7 @@
command => '/usr/bin/curl https://bootstrap.pypa.io/get-pip.py | python',
environment => $environ,
unless => 'which pip',
path => $python::params::pip_lookup_path,
path => $python::pip_lookup_path,
require => Package['python'],
provider => $exec_provider,
}
Expand Down
1 change: 0 additions & 1 deletion spec/classes/python_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
context 'with defaults' do
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('python::install') }
it { is_expected.to contain_class('python::params') }
it { is_expected.to contain_class('python::config') }
it { is_expected.to contain_package('python') }

Expand Down
2 changes: 2 additions & 0 deletions spec/defines/pip_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# rubocop:disable RSpec/RepeatedExampleGroupDescription
describe 'python::pip', type: :define do
let(:title) { 'rpyc' }
let(:pre_condition) { 'include python' }

context 'on Debian OS' do
let :facts do
Expand Down Expand Up @@ -213,6 +214,7 @@
describe 'python::pip', type: :define do
# rubocop:enable RSpec/RepeatedExampleGroupDescription
let(:title) { 'requests' }
let(:pre_condition) { 'include python' }

context 'on Debian OS' do
let :facts do
Expand Down
1 change: 0 additions & 1 deletion spec/defines/requirements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_class('python::config') }
it { is_expected.to contain_class('python::install') }
it { is_expected.to contain_class('python::params') }
it { is_expected.to contain_class('python') }
it { is_expected.to contain_exec('python_requirements/requirements.txt') }

Expand Down
Loading