Showing with 19 additions and 4 deletions.
  1. +1 −1 Modulefile
  2. +5 −2 README.md
  3. +1 −1 lib/facter/virtualenv_version.rb
  4. +7 −0 manifests/gunicorn.pp
  5. +3 −0 templates/gunicorn.erb
  6. +2 −0 tests/gunicorn.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.12'
version '1.7.13'
source 'git://github.com/stankevich/puppet-python.git'
author 'stankevich'
license 'Apache License, Version 2.0'
Expand Down
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn

**Version 1.1.x Notes**

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.
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 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.
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 Down Expand Up @@ -174,6 +174,8 @@ Manages Gunicorn virtual hosts.

**appmodule** - Set the application module name for gunicorn to load when not using Django. Default: app:app

**osenv** - Allows setting environment variables for the gunicorn service. Accepts a hash of 'key': 'value' pairs. Default: false

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

```puppet
Expand All @@ -185,6 +187,7 @@ Manages Gunicorn virtual hosts.
bind => 'unix:/tmp/gunicorn.socket',
environment => 'prod',
appmodule => 'app:app',
osenv => { 'DBHOST' => 'dbserver.example.com' },
template => 'python/gunicorn.erb',
}
```
Expand Down
2 changes: 1 addition & 1 deletion lib/facter/virtualenv_version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
has_weight 100
setcode do
begin
Facter::Util::Resolution.exec('virtualenv --version')
Facter::Util::Resolution.exec('virtualenv --version') || "absent"
rescue
false
end
Expand Down
7 changes: 7 additions & 0 deletions manifests/gunicorn.pp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
# Set the application module name for gunicorn to load when not using Django.
# Default: app:app
#
# [*osenv*]
# Allows setting environment variables for the gunicorn service. Accepts a
# hash of 'key': 'value' pairs.
# Default: false
#
# [*template*]
# Which ERB template to use. Default: python/gunicorn.erb
#
Expand All @@ -44,6 +49,7 @@
# owner => 'www-data',
# group => 'www-data',
# appmodule => 'app:app',
# osenv => { 'DBHOST' => 'dbserver.example.com' },
# template => 'python/gunicorn.erb',
# }
#
Expand All @@ -63,6 +69,7 @@
$owner = 'www-data',
$group = 'www-data',
$appmodule = 'app:app',
$osenv = false,
$template = 'python/gunicorn.erb',
) {

Expand Down
3 changes: 3 additions & 0 deletions templates/gunicorn.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ CONFIG = {
<% end -%>
<% if @virtualenv -%>
'environment': {
<% if @osenv -%><% @osenv.sort.each do |key, value| -%>
'<%= key %>': '<%= value %>',
<% end -%><% end -%>
<% if @environment -%>
'ENVIRONMENT': '<%= @environment %>',
<% end -%>
Expand Down
2 changes: 2 additions & 0 deletions tests/gunicorn.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,7 @@
dir => '/var/www/project1/current',
bind => 'unix:/tmp/gunicorn.socket',
environment => 'prod',
appmodule => 'app:app',
osenv => { 'DBHOST' => 'dbserver.example.com' },
template => 'python/gunicorn.erb',
}