Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gunicorn.pp - Add manage_config_dir #382

Merged
merged 1 commit into from
Apr 28, 2018
Merged
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
37 changes: 31 additions & 6 deletions manifests/gunicorn.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
# [*ensure*]
# present|absent. Default: present
#
# [*config_dir*]
# Configure the gunicorn config directory path. Default: /etc/gunicorn.d
#
# [*manage_config_dir*]
# Set if the gunicorn config directory should be created. Default: false
#
# [*virtualenv*]
# Run in virtualenv, specify directory. Default: disabled
#
Expand Down Expand Up @@ -70,6 +76,8 @@
#
define python::gunicorn (
$ensure = present,
$config_dir = '/etc/gunicorn.d',
$manage_config_dir = false,
$virtualenv = false,
$mode = 'wsgi',
$dir = false,
Expand All @@ -96,12 +104,29 @@

validate_re($log_level, 'debug|info|warning|error|critical', "Invalid \$log_level value ${log_level}")

file { "/etc/gunicorn.d/${name}":
ensure => $ensure,
mode => '0644',
owner => 'root',
group => 'root',
content => template($template),
if $manage_config_dir {
file { $config_dir:
ensure => directory,
mode => '0755',
owner => 'root',
group => 'root',
}
file { "${config_dir}/${name}":
ensure => $ensure,
mode => '0644',
owner => 'root',
group => 'root',
content => template($template),
require => File[$config_dir],
}
} else {
file { "${config_dir}/${name}":
ensure => $ensure,
mode => '0644',
owner => 'root',
group => 'root',
content => template($template),
}
}

}