Skip to content
Open
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
13 changes: 6 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 @@ -170,7 +169,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 +211,15 @@ 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--venv"></a>`venv`

Expand All @@ -236,7 +235,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 +421,7 @@ Data type: `String[1]`

group owner of dotfile

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

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

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

The group of the virtualenv being manipulated.

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

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

Expand Down
5 changes: 5 additions & 0 deletions data/common.yaml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Data in common should instead be class parameter defaults in init.pp, and then you can replace the lookup() calls with the variable, e.g., $python::pip_lookup_path.

Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
python::group: root
python::pip_lookup_path:
- /bin
- /usr/bin
- /usr/local/bin
python::default_system_version: "3.11"
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
1 change: 1 addition & 0 deletions data/os/RedHat/7.yaml

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EL7 is unsupported, you can delete this.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python::gunicorn_package_name: python-gunicorn
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 = lookup('python::group'), # lint:ignore:lookup_in_parameter
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 @@ -49,20 +49,24 @@
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 {
) {
unless $facts['os']['family'] in ['AIX', 'Debian', 'FreeBSD', 'Gentoo', 'RedHat', 'Suse', 'Archlinux'] {
fail("Module is not compatible with ${facts['os']['name']}")
}

Comment on lines +66 to +69

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for this check. It just makes the module difficult to use on platforms that aren't officially supported.

$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 = lookup('python::group'), # lint:ignore:lookup_in_parameter
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 => lookup('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 => lookup('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
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