Showing with 65 additions and 52 deletions.
  1. +1 −1 Modulefile
  2. +57 −45 README.md
  3. +5 −4 manifests/init.pp
  4. +2 −2 manifests/install.pp
2 changes: 1 addition & 1 deletion Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'stankevich-python'
version '1.7.5'
version '1.7.6'

author 'Sergey Stankevich'
license 'Apache License, Version 2.0'
Expand Down
102 changes: 57 additions & 45 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn

Version 1.1.x makes several fundamental changes to the core of this module, adding some additional features, improving performance and making operations more robust in general.

Please note that everal changes have been made in v1.1.x which make manifests incompatible with the previous version. However, modifying your manifests to suit is trivial. Please see the notes below.
Please note that several changes have been made in v1.1.x which make manifests incompatible with the previous version. However, modifying your manifests to suit is trivial. Please see the notes below.

Currently, the changes you need to make are as follows:

Expand All @@ -16,7 +16,7 @@ Currently, the changes you need to make are as follows:

## Installation

``` bash
``` shell
cd /etc/puppet/modules
git clone git://github.com/stankevich/puppet-python.git python
```
Expand All @@ -39,12 +39,14 @@ Installs and manages python, python-dev, python-virtualenv and Gunicorn.

**manage_gunicorn** - Allow Installation / Removal of Gunicorn. Default: true

class { 'python':
version => 'system',
dev => true,
virtualenv => true,
gunicorn => true,
}
```puppet
class { 'python':
version => 'system',
dev => true,
virtualenv => true,
gunicorn => true,
} }
```

### python::pip

Expand All @@ -71,16 +73,17 @@ Installs and manages packages from pip.
**uninstall_args** - Array of additional flags to pass to pip during uninstall. Default: none

**timeout** - Timeout for the pip install command. Defaults to 1800.

python::pip { 'cx_Oracle':
pkgname => 'cx_Oracle',
virtualenv => '/var/www/project1',
owner => 'appuser',
proxy => 'http://proxy.domain.com:3128',
environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64',
install_args => ['-e'],
timeout => 1800,
}
```puppet
python::pip { 'cx_Oracle':
pkgname => 'cx_Oracle',
virtualenv => '/var/www/project1',
owner => 'appuser',
proxy => 'http://proxy.domain.com:3128',
environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64',
install_args => ['-e'],
timeout => 1800,
}
```

### python::requirements

Expand All @@ -96,12 +99,14 @@ Installs and manages Python packages from requirements file.

**group** - The group that was used to create the virtualenv. This is used to create the requirements file with correct permissions if it's not present already.

python::requirements { '/var/www/project1/requirements.txt':
virtualenv => '/var/www/project1',
proxy => 'http://proxy.domain.com:3128',
owner => 'appuser',
group => 'apps',
}
```puppet
python::requirements { '/var/www/project1/requirements.txt':
virtualenv => '/var/www/project1',
proxy => 'http://proxy.domain.com:3128',
owner => 'appuser',
group => 'apps',
}
```

### python::virtualenv

Expand All @@ -119,6 +124,8 @@ Creates Python virtualenv.

**distribute** - Include distribute in the virtualenv. Default: true

**venv_dir** - The location of the virtualenv if resource path not specified. Must be absolute path. Default: resource name

**owner** - Specify the owner of this virtualenv

**group** - Specify the group for this virtualenv
Expand All @@ -129,18 +136,21 @@ Creates Python virtualenv.

**timeout** - The maximum time in seconds the "pip install" command should take. Default: 1800

python::virtualenv { '/var/www/project1':
ensure => present,
version => 'system',
requirements => '/var/www/project1/requirements.txt',
proxy => 'http://proxy.domain.com:3128',
systempkgs => true,
distribute => false,
owner => 'appuser',
group => 'apps',
cwd => '/var/www/project1',
timeout => 0,
}
```puppet
python::virtualenv { '/var/www/project1':
ensure => present,
version => 'system',
requirements => '/var/www/project1/requirements.txt',
proxy => 'http://proxy.domain.com:3128',
systempkgs => true,
distribute => false,
venv_dir => '/home/appuser/virtualenvs',
owner => 'appuser',
group => 'apps',
cwd => '/var/www/project1',
timeout => 0,
}
```

### python::gunicorn

Expand All @@ -160,15 +170,17 @@ Manages Gunicorn virtual hosts.

**template** - Which ERB template to use. Default: python/gunicorn.erb

python::gunicorn { 'vhost':
ensure => present,
virtualenv => '/var/www/project1',
mode => 'wsgi',
dir => '/var/www/project1/current',
bind => 'unix:/tmp/gunicorn.socket',
environment => 'prod',
template => 'python/gunicorn.erb',
}
```puppet
python::gunicorn { 'vhost':
ensure => present,
virtualenv => '/var/www/project1',
mode => 'wsgi',
dir => '/var/www/project1/current',
bind => 'unix:/tmp/gunicorn.socket',
environment => 'prod',
template => 'python/gunicorn.erb',
}
```

## Authors

Expand Down
9 changes: 5 additions & 4 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,10 @@
fail("Module is not compatible with ${::operatingsystem}")
}

Class['python::install'] -> Class['python::config']

include python::install
include python::config
# Anchor pattern to contain dependencies
anchor { 'python::begin': } ->
class { 'python::install': } ->
class { 'python::config': } ->
anchor { 'python::end': }

}
4 changes: 2 additions & 2 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
}

$pythondev = $::osfamily ? {
RedHat => "${python}-devel",
Debian => "${python}-dev"
'RedHat' => "${python}-devel",
'Debian' => "${python}-dev"
}

$dev_ensure = $python::dev ? {
Expand Down