Skip to content

Commit

Permalink
Merge pull request #4 from fraenki/python
Browse files Browse the repository at this point in the history
Improvements related to puppet/python
  • Loading branch information
hp197 authored Oct 23, 2019
2 parents 871958b + 2bff555 commit 9cf3b96
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 13 deletions.
6 changes: 4 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@
# @param virtualenv_path Optional[String] If we use virtualenv (false if undef) and what path we use as base, default undef
# @param package_name [String] Package name of the thumbor application as found in pip, default thumbor
# @param package_ensure Enum['present', 'absent', 'latest'] Control the ensure on pip, default $ensure ('present')
# @param pip_proxyserver Variant[Boolean, String] The full url (including credentials) to a proxy server or false to not use one at all, default false
# @param pip_proxyserver Optional[String] The full url (including credentials) to a proxy server or undef to not use one at all, default undef
# @param ensure_user [Boolean] If we control the installation of the user, default true
# @param user [String] Name of the user to install (optional) and under which we run the thumbor service, default thumbor
# @param ensure_group [Boolean] If we control the installation of the group, default true
# @param group [String] Name of the group to install (optional) and under which we run the thumbor service, default thumbor
# @param extensions Variant[Array[String],String] Extentions to install in thumbor virtual environment, default []
# @param additional_packages [Array] Specifies a list of additional packages that are required for thumbor or any of it's dependencies.
# @param manage_python [Boolean] If we control the installation of Python, default true
#
#
class thumbor (
Expand All @@ -32,13 +33,14 @@
Optional[String] $virtualenv_path = $thumbor::params::virtualenv_path,
String $package_name = $thumbor::params::package_name,
Enum['present', 'absent', 'latest'] $package_ensure = $thumbor::params::package_ensure,
Variant[Boolean, String] $pip_proxyserver = $thumbor::params::pip_proxyserver,
Optional[String] $pip_proxyserver = $thumbor::params::pip_proxyserver,
Boolean $ensure_user = $thumbor::params::ensure_user,
String $user = $thumbor::params::user,
Boolean $ensure_group = $thumbor::params::ensure_group,
String $group = $thumbor::params::group,
Variant[Array[String],String] $extentions = $thumbor::params::extentions,
Array $additional_packages = $thumbor::params::additional_packages,
Boolean $manage_python = $thumbor::params::manage_python,
) inherits thumbor::params
{
$apppath = $virtualenv_path ? {
Expand Down
16 changes: 9 additions & 7 deletions manifests/install.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,22 @@
}
}

class { 'python' :
version => 'system',
pip => 'present',
dev => 'present',
virtualenv => 'present',
require => Anchor['thumbor::install::begin'],
if $thumbor::manage_python {
class { 'python' :
version => 'system',
pip => 'present',
dev => 'present',
virtualenv => 'present',
require => Anchor['thumbor::install::begin'],
}
}

if $thumbor::virtualenv_path {
# Install thumbor in a virtualenv.
python::virtualenv { $thumbor::virtualenv_path:
ensure => $thumbor::ensure,
version => 'system',
proxy => $thumbor::proxy,
proxy => $thumbor::pip_proxyserver,
owner => $thumbor::user,
group => $thumbor::group,
require => [ Class['python'] ],
Expand Down
3 changes: 2 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
Optional[String] $virtualenv_path = undef,
String $package_name = 'thumbor',
String $package_ensure = $ensure,
Variant[Boolean, String] $pip_proxyserver = false,
Optional[String] $pip_proxyserver = undef,
Boolean $ensure_user = true,
String $user = 'thumbor',
Boolean $ensure_group = true,
String $group = 'thumbor',
Variant[Array[String],String] $extentions = [],
Hash $default_options = {},
Boolean $manage_python = true,
)
{
case $facts['os']['family'] {
Expand Down
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 1.0.0"
"version_requirement": ">= 4.0.0 < 7.0.0"
},
{
"name": "puppet/python",
"version_requirement": ">= 1.12.0 < 3.0.0"
"version_requirement": ">= 3.0.0 < 4.0.0"
},
{
"name": "camptocamp/systemd",
"version_requirement": ">= 1.0.0 < 3.0.0"
"version_requirement": ">= 2.0.0 < 3.0.0"
}
],
"data_provider": null
Expand Down

0 comments on commit 9cf3b96

Please sign in to comment.