From 04bffc411afb19a572af34d1a2e0f7029f16dfe4 Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Fri, 29 Nov 2013 09:16:31 +1100 Subject: Added manage_gunicorn flag. This will allow a user to stop the module from trying to do anything with gunicorn. --- manifests/config.pp | 21 +++++++++++---------- manifests/init.pp | 9 +++++---- manifests/install.pp | 11 ++++++----- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 49e5230..fdd808f 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -6,18 +6,19 @@ class python::config { Python::Virtualenv <| |> -> Python::Pip <| |> - if $python::gunicorn { - Class['python::install'] -> Python::Gunicorn <| |> + if $python::manage_gunicorn { + if $python::gunicorn { + Class['python::install'] -> Python::Gunicorn <| |> - Python::Gunicorn <| |> ~> Service['gunicorn'] + Python::Gunicorn <| |> ~> Service['gunicorn'] - service { 'gunicorn': - ensure => running, - enable => true, - hasrestart => true, - hasstatus => false, - pattern => '/usr/bin/gunicorn', + service { 'gunicorn': + ensure => running, + enable => true, + hasrestart => true, + hasstatus => false, + pattern => '/usr/bin/gunicorn', + } } } - } diff --git a/manifests/init.pp b/manifests/init.pp index c4e469d..574573b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -35,10 +35,11 @@ # class python ( $version = 'system', - $pip = false, - $dev = false, - $virtualenv = false, - $gunicorn = false + $pip = false, + $dev = false, + $virtualenv = false, + $gunicorn = false, + $manage_gunicorn = false ) { # Module compatibility check diff --git a/manifests/install.pp b/manifests/install.pp index 415092e..caead49 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -32,11 +32,12 @@ class python::install { package { 'python-virtualenv': ensure => $venv_ensure } - $gunicorn_ensure = $python::gunicorn ? { - true => present, - default => absent, + if $python::manage_gunicorn { + $gunicorn_ensure = $python::gunicorn ? { + true => present, + default => absent, + } + package { 'gunicorn': ensure => $gunicorn_ensure } } - package { 'gunicorn': ensure => $gunicorn_ensure } - } -- cgit v1.2.3 From fdf81012ea5f3d8124c86f41d91e4e97f769bc80 Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Fri, 29 Nov 2013 22:23:23 +1100 Subject: added manage_gunicorn docs --- Modulefile | 2 +- README.md | 2 ++ manifests/init.pp | 5 ++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Modulefile b/Modulefile index 82069d4..171490c 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.2.0' +version '1.3.0' author 'Sergey Stankevich' license 'Apache License, Version 2.0' diff --git a/README.md b/README.md index 751376a..6aa0c98 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ Installs and manages python, python-dev, python-virtualenv and Gunicorn. **gunicorn** - Install Gunicorn. Default: false +**manage_gunicorn** - Allow Installation / Removal of Gunicorn. Default: true + class { 'python': version => 'system', dev => true, diff --git a/manifests/init.pp b/manifests/init.pp index 574573b..74244e1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -19,6 +19,9 @@ # [*gunicorn*] # Install Gunicorn. Default: false # +# [*manage_gunicorn*] +# Allow Installation / Removal of Gunicorn. Default: true +# # === Examples # # class { 'python': @@ -39,7 +42,7 @@ class python ( $dev = false, $virtualenv = false, $gunicorn = false, - $manage_gunicorn = false + $manage_gunicorn = true ) { # Module compatibility check -- cgit v1.2.3