From c2a96f8dd40d75c6cf15518010e0a00889df6690 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Wed, 18 Dec 2013 14:20:15 +0300 Subject: Version 1.3.0 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 5806e9d..171490c 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.2.1' +version '1.3.0' author 'Sergey Stankevich' license 'Apache License, Version 2.0' -- cgit v1.2.3 From 071cc312167d3722bff723191fec229a071a03f4 Mon Sep 17 00:00:00 2001 From: Neil Saunders Date: Thu, 19 Dec 2013 17:43:51 +0000 Subject: Adding forcerefresh parameter --- manifests/requirements.pp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index ee44fa4..5fa6eb9 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -27,6 +27,11 @@ # [*environment*] # Additional environment variables required to install the packages. Default: none # +# [*forceupdate*] +# Run a pip install requirements even if we don't receive an event from the +# requirements file - Useful for when the requirements file is written as part of a +# resource other than file (E.g vcsrepo) +# # === Examples # # python::requirements { '/var/www/project1/requirements.txt': @@ -47,7 +52,8 @@ define python::requirements ( $group = 'root', $proxy = false, $src = false, - $environment = [] + $environment = [], + $forceupdate = false, ) { if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { @@ -56,7 +62,7 @@ define python::requirements ( $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}", + default => $virtualenv, } $pip_env = $virtualenv ? { @@ -91,7 +97,7 @@ define python::requirements ( exec { "python_requirements${name}": provider => shell, command => "${pip_env} --log ${cwd}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements}", - refreshonly => true, + refreshonly => !$forceupdate, timeout => 1800, user => $owner, subscribe => File[$requirements], -- cgit v1.2.3 From e92b2d2a7e1b20925a71d34dc83cd3bfa760fbf2 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 19 Dec 2013 20:53:01 +0300 Subject: Version 1.3.1 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 171490c..c94af43 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.3.0' +version '1.3.1' author 'Sergey Stankevich' license 'Apache License, Version 2.0' -- cgit v1.2.3 From 535115b9d1426a4d380dc4631fdd2944e0c29e88 Mon Sep 17 00:00:00 2001 From: Neil Saunders Date: Thu, 19 Dec 2013 18:06:25 +0000 Subject: Fixing lint issues as per http://docs.puppetlabs.com/guides/style_guide.html --- manifests/config.pp | 18 ++++++++++++++++-- manifests/install.pp | 15 +++++++++++++++ manifests/pip.pp | 20 ++++++++++---------- manifests/requirements.pp | 2 +- manifests/virtualenv.pp | 12 ++++++------ 5 files changed, 48 insertions(+), 19 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 49e5230..52c10be 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -1,3 +1,18 @@ +# == Define: python::config +# +# Optionally installs the gunicorn service +# +# === Examples +# +# include python::config +# +# === Authors +# +# Sergey Stankevich +# Ashley Penney +# Fotis Gimian +# + class python::config { Class['python::install'] -> Python::Pip <| |> @@ -19,5 +34,4 @@ class python::config { pattern => '/usr/bin/gunicorn', } } - -} +} \ No newline at end of file diff --git a/manifests/install.pp b/manifests/install.pp index 0d16659..bb5f090 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -1,3 +1,18 @@ +# == Define: python::install +# +# Installs core python packages +# +# === Examples +# +# include python::install +# +# === Authors +# +# Sergey Stankevich +# Ashley Penney +# Fotis Gimian +# + class python::install { $python = $python::version ? { diff --git a/manifests/pip.pp b/manifests/pip.pp index bcb7911..ebe549b 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -57,7 +57,7 @@ define python::pip ( $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}", + default => $virtualenv, } $pip_env = $virtualenv ? { @@ -88,26 +88,26 @@ define python::pip ( case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install $install_args ${proxy_flag} ${source}", - unless => "$pip_env freeze | grep -i -e ${grep_regex}", + command => "${pip_env} --log ${cwd}/pip.log install ${install_args} ${proxy_flag} ${source}", + unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, - path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], } } latest: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install --upgrade ${proxy_flag} ${source}", + command => "${pip_env} --log ${cwd}/pip.log install --upgrade ${proxy_flag} ${source}", user => $owner, environment => $environment, - path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], } } latest: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install -U $install_args ${proxy_flag} ${source}", + command => "${pip_env} --log ${cwd}/pip.log install -U ${install_args} ${proxy_flag} ${source}", user => $owner, environment => $environment, } @@ -115,11 +115,11 @@ define python::pip ( default: { exec { "pip_uninstall_${name}": - command => "echo y | $pip_env uninstall $uninstall_args ${proxy_flag} ${name}", - onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", + command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}", + onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, - path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], } } } diff --git a/manifests/requirements.pp b/manifests/requirements.pp index ee44fa4..9769b13 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -56,7 +56,7 @@ define python::requirements ( $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}", + default => $virtualenv, } $pip_env = $virtualenv ? { diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index bc7141c..85fc67a 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -98,7 +98,7 @@ define python::virtualenv ( default => "&& export http_proxy=${proxy}", } - # Virtualenv versions prior to 1.7 do not support the + # Virtualenv versions prior to 1.7 do not support the # --system-site-packages flag, default off for prior versions # Prior to version 1.7 the default was equal to --system-site-packages # and the flag --no-site-packages had to be passed to do the opposite @@ -120,12 +120,12 @@ define python::virtualenv ( } exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", - user => $owner, - path => $path, - cwd => "/tmp", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", + user => $owner, + path => $path, + cwd => '/tmp', environment => $environment, - unless => "grep '^[ \t]*VIRTUAL_ENV=[\'\"]*/tmp[\"\']*[ \t]*$' /tmp/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv + unless => "grep '^[ \t]*VIRTUAL_ENV=[\'\"]*/tmp[\"\']*[ \t]*$' /tmp/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } if $requirements { -- cgit v1.2.3 From ed1fed8d5cef752603ee469d2a093bd9218488ea Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Thu, 26 Dec 2013 16:57:08 -0300 Subject: Expose user/group config to configure gunicorn gunicorn setup was forcing users to run their processes with the user www-data which isn't available in all distributions (for instance Fedora Linux) and it's a good practice to run each website under different users to reduce security issues --- manifests/gunicorn.pp | 4 ++++ templates/gunicorn.erb | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 13f4872..159afa3 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -37,6 +37,8 @@ # dir => '/var/www/project1/current', # bind => 'unix:/tmp/gunicorn.socket', # environment => 'prod', +# owner => 'www-data', +# group => 'www-data', # template => 'python/gunicorn.erb', # } # @@ -53,6 +55,8 @@ define python::gunicorn ( $dir = false, $bind = false, $environment = false, + $owner = 'www-data', + $group = 'www-data', $template = 'python/gunicorn.erb', ) { diff --git a/templates/gunicorn.erb b/templates/gunicorn.erb index 99481e7..10f81fa 100644 --- a/templates/gunicorn.erb +++ b/templates/gunicorn.erb @@ -13,8 +13,8 @@ CONFIG = { }, <% end -%> 'working_dir': '<%= @dir %>', - 'user': 'www-data', - 'group': 'www-data', + 'user': '<%= @owner %>', + 'group': '<%= @group %>', <% if @virtualenv -%> 'python': '<%= @virtualenv %>/bin/python', <% else -%> -- cgit v1.2.3 From 80ee7bcdf5ca4287432da9d2e06c3bb6c1dd8a91 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Mon, 30 Dec 2013 17:52:27 +0300 Subject: Version 1.4.0 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index c94af43..be19691 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.3.1' +version '1.4.0' author 'Sergey Stankevich' license 'Apache License, Version 2.0' -- cgit v1.2.3 From 0e72400bfd33df651c23f2f7c71c3c5cf8bfe815 Mon Sep 17 00:00:00 2001 From: Davide Mendolia Date: Thu, 2 Jan 2014 23:11:52 +0100 Subject: Replace operatingsystem test for osfamily to increase os support --- manifests/init.pp | 4 ++-- manifests/install.pp | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 9fe0420..54dae45 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -44,8 +44,8 @@ class python ( ) { # Module compatibility check - $compatible = [ 'Debian', 'Ubuntu', 'CentOS', 'RedHat', 'Scientific' ] - if ! ($::operatingsystem in $compatible) { + $compatible = [ 'debian', 'redhat'] + if ! ($::osfamily in $compatible) { fail("Module is not compatible with ${::operatingsystem}") } diff --git a/manifests/install.pp b/manifests/install.pp index bb5f090..dc9bd76 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -20,9 +20,9 @@ class python::install { default => "python${python::version}", } - $pythondev = $::operatingsystem ? { - /(?i:RedHat|CentOS|Fedora|Scientific)/ => "${python}-devel", - /(?i:Debian|Ubuntu)/ => "${python}-dev" + $pythondev = $::osfamily ? { + redhat => "${python}-devel", + debian => "${python}-dev" } $dev_ensure = $python::dev ? { -- cgit v1.2.3 From e165f319501eda83ca1e996fa2c4cd06341657f9 Mon Sep 17 00:00:00 2001 From: Davide Mendolia Date: Thu, 2 Jan 2014 23:49:12 +0100 Subject: Fixed osfamily name --- manifests/init.pp | 2 +- manifests/install.pp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 54dae45..451bdda 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -44,7 +44,7 @@ class python ( ) { # Module compatibility check - $compatible = [ 'debian', 'redhat'] + $compatible = [ 'Debian', 'RedHat'] if ! ($::osfamily in $compatible) { fail("Module is not compatible with ${::operatingsystem}") } diff --git a/manifests/install.pp b/manifests/install.pp index dc9bd76..b2debcc 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -21,8 +21,8 @@ class python::install { } $pythondev = $::osfamily ? { - redhat => "${python}-devel", - debian => "${python}-dev" + RedHat => "${python}-devel", + Debian => "${python}-dev" } $dev_ensure = $python::dev ? { -- cgit v1.2.3