Skip to content

Commit

Permalink
Drop python::virtualenv defined resource
Browse files Browse the repository at this point in the history
The whole virtualenv setup is deprecated upstream. pyvenv / the built-in
python module venv should be used. Since we already have a few backwards
incompatible changes on master, it makes sense to drop this now.
  • Loading branch information
bastelfreak committed Dec 15, 2020
1 parent d9c51a8 commit db2ea21
Show file tree
Hide file tree
Showing 12 changed files with 14 additions and 830 deletions.
206 changes: 2 additions & 204 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#### Public Classes

* [`python`](#python): Installs and manages python, python-dev, python-virtualenv and gunicorn.
* [`python`](#python): Installs and manages python, python-dev and gunicorn.
* [`python::pip::bootstrap`](#pythonpipbootstrap): allow to bootstrap pip when python is managed from other module

#### Private Classes
Expand All @@ -24,7 +24,6 @@
* [`python::pip`](#pythonpip): Installs and manages packages from pip.
* [`python::pyvenv`](#pythonpyvenv): Create a Python3 virtualenv using pyvenv.
* [`python::requirements`](#pythonrequirements): Installs and manages Python packages from requirements file.
* [`python::virtualenv`](#pythonvirtualenv): Creates Python virtualenv.

### Data types

Expand All @@ -38,7 +37,7 @@

### `python`

Installs and manages python, python-dev, python-virtualenv and gunicorn.
Installs and manages python, python-dev and gunicorn.

#### Examples

Expand All @@ -49,7 +48,6 @@ class { 'python':
version => 'system',
pip => 'present',
dev => 'present',
virtualenv => 'present',
gunicorn => 'present',
}
```
Expand All @@ -61,7 +59,6 @@ class { 'python' :
ensure => 'present',
version => 'rh-python36-python',
dev => 'present',
virtualenv => 'present',
}
```

Expand Down Expand Up @@ -108,14 +105,6 @@ Desired installation state for the python-dev package.

Default value: `$python::params::dev`

##### `virtualenv`

Data type: `Python::Package::Ensure`

Desired installation state for the virtualenv package

Default value: `$python::params::virtualenv`

##### `gunicorn`

Data type: `Python::Package::Ensure`
Expand Down Expand Up @@ -172,14 +161,6 @@ Data type: `Boolean`

Default value: `$python::params::manage_python_package`

##### `manage_virtualenv_package`

Data type: `Boolean`



Default value: `$python::params::manage_virtualenv_package`

##### `manage_pip_package`

Data type: `Boolean`
Expand All @@ -202,14 +183,6 @@ Data type: `Hash`



Default value: `{}`

##### `python_virtualenvs`

Data type: `Hash`



Default value: `{}`

##### `python_pyvenvs`
Expand Down Expand Up @@ -1023,181 +996,6 @@ The maximum time in seconds the "pip install" command should take.

Default value: `1800`

### `python::virtualenv`

Creates Python virtualenv.

#### Examples

##### install a virtual env at /var/www/project1

```puppet
python::virtualenv { '/var/www/project1':
ensure => present,
version => 'system',
requirements => '/var/www/project1/requirements.txt',
proxy => 'http://proxy.domain.com:3128',
systempkgs => true,
index => 'http://www.example.com/simple/',
}
```

#### Parameters

The following parameters are available in the `python::virtualenv` defined type.

##### `ensure`

Data type: `Python::Package::Ensure`



Default value: `'present'`

##### `version`

Data type: `Python::Version`

Python version to use.

Default value: `'system'`

##### `requirements`

Data type: `Variant[Boolean,Stdlib::Absolutepath]`

Path to pip requirements.txt file

Default value: ``false``

##### `systempkgs`

Data type: `Boolean`

Copy system site-packages into virtualenv.

Default value: ``false``

##### `venv_dir`

Data type: `Stdlib::Absolutepath`

Directory to install virtualenv to

Default value: `$name`

##### `ensure_venv_dir`

Data type: `Boolean`

Create $venv_dir

Default value: ``true``

##### `distribute`

Data type: `Boolean`

Include distribute in the virtualenv

Default value: ``true``

##### `index`

Data type: `Variant[Boolean,Stdlib::HTTPUrl]`

Base URL of Python package index

Default value: ``false``

##### `owner`

Data type: `String[1]`

The owner of the virtualenv being manipulated

Default value: `'root'`

##### `group`

Data type: `String[1]`

The group relating to the virtualenv being manipulated

Default value: `'root'`

##### `mode`

Data type: `Stdlib::Filemode`

Optionally specify directory mode

Default value: `'0755'`

##### `proxy`

Data type: `Optional[Stdlib::HTTPUrl]`

Proxy server to use for outbound connections

Default value: ``undef``

##### `environment`

Data type: `Array`

Additional environment variables required to install the packages

Default value: `[]`

##### `path`

Data type: `Array[Stdlib::Absolutepath]`

Specifies the PATH variable

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

##### `cwd`

Data type: `Optional[Stdlib::Absolutepath]`

The directory from which to run the "pip install" command

Default value: ``undef``

##### `timeout`

Data type: `Integer`

The maximum time in seconds the "pip install" command should take

Default value: `1800`

##### `pip_args`

Data type: `String`

Arguments to pass to pip during initialization

Default value: `''`

##### `extra_pip_args`

Data type: `String`

Extra arguments to pass to pip after requirements file

Default value: `''`

##### `virtualenv`

Data type: `Optional[Stdlib::Absolutepath]`



Default value: ``undef``

## Data types

### `Python::Loglevel`
Expand Down
3 changes: 0 additions & 3 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
class python::config {
Class['python::install'] -> Python::Pip <| |>
Class['python::install'] -> Python::Requirements <| |>
Class['python::install'] -> Python::Virtualenv <| |>

Python::Virtualenv <| |> -> Python::Pip <| |>

if $python::manage_gunicorn {
unless $python::gunicorn == 'absent' {
Expand Down
9 changes: 1 addition & 8 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @summary Installs and manages python, python-dev, python-virtualenv and gunicorn.
# @summary Installs and manages python, python-dev and gunicorn.
#
# @param ensure Desired installation state for the Python package.
# @param version Python version to install. Beware that valid values for this differ a) by the provider you choose and b) by the osfamily/operatingsystem you are using.
Expand All @@ -11,7 +11,6 @@
# package, if available on your osfamily.
# @param pip Desired installation state for the python-pip package.
# @param dev Desired installation state for the python-dev package.
# @param virtualenv Desired installation state for the virtualenv package
# @param gunicorn Desired installation state for Gunicorn.
# @param manage_gunicorn Allow Installation / Removal of Gunicorn.
# @param provider What provider to use for installation of the packages, except gunicorn and Python itself.
Expand All @@ -24,32 +23,27 @@
# version => 'system',
# pip => 'present',
# dev => 'present',
# virtualenv => 'present',
# gunicorn => 'present',
# }
# @example install python3 from scl repo
# class { 'python' :
# ensure => 'present',
# version => 'rh-python36-python',
# dev => 'present',
# virtualenv => 'present',
# }
#
class python (
Python::Package::Ensure $ensure = $python::params::ensure,
Python::Version $version = $python::params::version,
Python::Package::Ensure $pip = $python::params::pip,
Python::Package::Ensure $dev = $python::params::dev,
Python::Package::Ensure $virtualenv = $python::params::virtualenv,
Python::Package::Ensure $gunicorn = $python::params::gunicorn,
Boolean $manage_gunicorn = $python::params::manage_gunicorn,
Boolean $manage_python_package = $python::params::manage_python_package,
Boolean $manage_virtualenv_package = $python::params::manage_virtualenv_package,
Boolean $manage_pip_package = $python::params::manage_pip_package,
String[1] $gunicorn_package_name = $python::params::gunicorn_package_name,
Optional[Python::Provider] $provider = $python::params::provider,
Hash $python_pips = {},
Hash $python_virtualenvs = {},
Hash $python_pyvenvs = {},
Hash $python_requirements = {},
Hash $python_dotfiles = {},
Expand Down Expand Up @@ -80,7 +74,6 @@
# Allow hiera configuration of python resources
create_resources('python::pip', $python_pips)
create_resources('python::pyvenv', $python_pyvenvs)
create_resources('python::virtualenv', $python_virtualenvs)
create_resources('python::requirements', $python_requirements)
create_resources('python::dotfile', $python_dotfiles)
}
Loading

0 comments on commit db2ea21

Please sign in to comment.