From 452451e8f5c0bd40b867088f481c130a21efb0a1 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Sun, 4 Nov 2012 21:31:46 +0100 Subject: [PATCH 001/241] python::gunicorn - removed unused/undocumented attributes. --- manifests/gunicorn.pp | 1 - manifests/requirements.pp | 1 - 2 files changed, 2 deletions(-) diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 2548e95d..659555fa 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -46,7 +46,6 @@ $mode = 'wsgi', $dir = false, $bind = false, - $app_interface = 'wsgi', $environment = false, ) { diff --git a/manifests/requirements.pp b/manifests/requirements.pp index b6c9b346..c7b9c255 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -38,7 +38,6 @@ default => "--proxy=${proxy}", } - $req_dir = inline_template('<%= requirements.match(%r!(.+)/.+!)[1] %>') $req_crc = "${requirements}.sha1" file { $requirements: From 5477c34707d6d59b4e7fd0a77c87183b59c37e52 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Tue, 6 Nov 2012 21:23:46 +0100 Subject: [PATCH 002/241] python::virtualenv - '--system-site-packages' option New 'systempkgs' parameter will call virtualenv with the '--system-site-packages' option, which can greatly speed up creation in some cases. --- README.md | 3 +++ manifests/virtualenv.pp | 14 ++++++++++++-- tests/virtualenv.pp | 1 + 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7b00d5d..ba4b7668 100644 --- a/README.md +++ b/README.md @@ -64,11 +64,14 @@ Creates Python virtualenv. **proxy** — Proxy server to use for outbound connections. Default: none +**systempkgs** — Copy system site-packages into virtualenv. Default: don't + python::virtualenv { '/var/www/project1': ensure => present, version => 'system', requirements => '/var/www/project1/requirements.txt', proxy => 'http://proxy.domain.com:3128', + systempkgs => true, } ### python::gunicorn diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index f22f4e14..e2866992 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -16,6 +16,9 @@ # [*proxy*] # Proxy server to use for outbound connections. Default: none # +# [*systempkgs*] +# Copy system site-packages into virtualenv. Default: don't +# # === Examples # # python::virtualenv { '/var/www/project1': @@ -23,6 +26,7 @@ # version => 'system', # requirements => '/var/www/project1/requirements.txt', # proxy => 'http://proxy.domain.com:3128', +# systempkgs => true, # } # # === Authors @@ -33,7 +37,8 @@ $ensure = present, $version = 'system', $requirements = false, - $proxy = false + $proxy = false, + $systempkgs = false, ) { $venv_dir = $name @@ -55,10 +60,15 @@ default => "&& export http_proxy=${proxy}", } + $system_pkgs_flag = $systempkgs ? { + false => '', + default => '--system-site-packages', + } + exec { "python_virtualenv_${venv_dir}": command => "mkdir -p ${venv_dir} \ ${proxy_command} \ - && virtualenv -p `which ${python}` ${venv_dir} \ + && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \ && ${venv_dir}/bin/pip install ${proxy_flag} --upgrade distribute pip", creates => $venv_dir, } diff --git a/tests/virtualenv.pp b/tests/virtualenv.pp index 190492c7..da5ab57c 100644 --- a/tests/virtualenv.pp +++ b/tests/virtualenv.pp @@ -9,4 +9,5 @@ version => 'system', requirements => '/var/www/project1/requirements.txt', proxy => 'http://proxy.domain.com:3128', + systempkgs => true, } From e63664bc1ccc540a45a1c4eea90a0f7ea482e406 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Tue, 6 Nov 2012 21:34:03 +0100 Subject: [PATCH 003/241] python::gunicorn - added template parameter The idea is to be able to use a different template, in case the one provided with the module doesn't fit the user's need. --- README.md | 3 +++ manifests/gunicorn.pp | 7 ++++++- tests/gunicorn.pp | 1 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ba4b7668..65cd3912 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,8 @@ Manages Gunicorn virtual hosts. **environment** — Set ENVIRONMENT variable. Default: none +**template** — Which ERB template to use. Default: python/gunicorn.erb + python::gunicorn { 'vhost': ensure => present, virtualenv => '/var/www/project1', @@ -97,6 +99,7 @@ Manages Gunicorn virtual hosts. dir => '/var/www/project1/current', bind => 'unix:/tmp/gunicorn.socket', environment => 'prod', + template => 'python/gunicorn.erb', } ## Authors diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 659555fa..1b53fc8e 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -25,6 +25,9 @@ # [*environment*] # Set ENVIRONMENT variable. Default: none # +# [*template*] +# Which ERB template to use. Default: python/gunicorn.erb +# # === Examples # # python::gunicorn { 'vhost': @@ -34,6 +37,7 @@ # dir => '/var/www/project1/current', # bind => 'unix:/tmp/gunicorn.socket', # environment => 'prod', +# template => 'python/gunicorn.erb', # } # # === Authors @@ -47,6 +51,7 @@ $dir = false, $bind = false, $environment = false, + $template = 'python/gunicorn.erb', ) { # Parameter validation @@ -59,7 +64,7 @@ mode => '0644', owner => 'root', group => 'root', - content => template('python/gunicorn.erb'), + content => template($template), } } diff --git a/tests/gunicorn.pp b/tests/gunicorn.pp index c081fd64..c32ea1a2 100644 --- a/tests/gunicorn.pp +++ b/tests/gunicorn.pp @@ -11,4 +11,5 @@ dir => '/var/www/project1/current', bind => 'unix:/tmp/gunicorn.socket', environment => 'prod', + template => 'python/gunicorn.erb', } From e7f975a20639d1e3adbfa85f956485238c040506 Mon Sep 17 00:00:00 2001 From: Marc Fournier Date: Tue, 6 Nov 2012 21:42:02 +0100 Subject: [PATCH 004/241] updated authors. --- README.md | 2 ++ manifests/gunicorn.pp | 2 ++ manifests/requirements.pp | 1 + manifests/virtualenv.pp | 2 ++ 4 files changed, 7 insertions(+) diff --git a/README.md b/README.md index 65cd3912..272c92a4 100644 --- a/README.md +++ b/README.md @@ -105,3 +105,5 @@ Manages Gunicorn virtual hosts. ## Authors [Sergey Stankevich](https://github.com/stankevich) +[Ashley Penney](https://github.com/apenney) +[Marc Fournier](https://github.com/mfournier) diff --git a/manifests/gunicorn.pp b/manifests/gunicorn.pp index 1b53fc8e..13f48720 100644 --- a/manifests/gunicorn.pp +++ b/manifests/gunicorn.pp @@ -43,6 +43,8 @@ # === Authors # # Sergey Stankevich +# Ashley Penney +# Marc Fournier # define python::gunicorn ( $ensure = present, diff --git a/manifests/requirements.pp b/manifests/requirements.pp index c7b9c255..4dd1f1fe 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -20,6 +20,7 @@ # === Authors # # Sergey Stankevich +# Ashley Penney # define python::requirements ( $virtualenv = 'system', diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index e2866992..e816468f 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -32,6 +32,8 @@ # === Authors # # Sergey Stankevich +# Ashley Penney +# Marc Fournier # define python::virtualenv ( $ensure = present, From 63b4288450a3165cbd15e04fc9480fd16ff53885 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 8 Nov 2012 07:11:56 -0500 Subject: [PATCH 005/241] Adding pip; modifying Gunicorn template for Django --- README.md | 2 +- manifests/install.pp | 2 +- templates/gunicorn.erb | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7b00d5d..67c9d072 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [puppet-python](https://github.com/stankevich/puppet-python) ====== -Puppet module for installing and managing python, pip, virtualenv, Gunicorn virtual hosts +Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. ## Usage diff --git a/manifests/install.pp b/manifests/install.pp index dec99b8a..e52e7e4c 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -12,7 +12,7 @@ default => absent, } - package { "${python}-dev": ensure => $dev_ensure } + package { [ "${python}-dev", 'python-pip' ]: ensure => $dev_ensure } $venv_ensure = $python::virtualenv ? { true => present, diff --git a/templates/gunicorn.erb b/templates/gunicorn.erb index 2cf3eedd..1a965315 100644 --- a/templates/gunicorn.erb +++ b/templates/gunicorn.erb @@ -30,6 +30,8 @@ CONFIG = { <% end -%> '--workers=<%= @processorcount.to_i*2 %>', '--timeout=30', +<% if mode != 'django' -%> 'app:app', +<% end -%> ), } From 451b21537565b335a45bca0d90ff03567a10e9c2 Mon Sep 17 00:00:00 2001 From: Nick Groenen Date: Mon, 11 Mar 2013 14:20:25 +0100 Subject: [PATCH 006/241] Resolve a cyclic dependency There was a dependency between python::virtualenv and python::requirements. Basically, the virtualenv wanted to initialize requirements, but requirements depended on the virtualenv being created already, resulting in: err: Could not apply complete catalog: Found 1 dependency cycle: (Exec[python_requirements_check_/usr/share/err/repo/requirements.txt] => Python::Requirements[/usr/share/err/repo/requirements.txt] => Exec[python_virtualenv_/usr/share/err/python3] => Python::Requirements[/usr/share/err/repo/requirements.txt] => Exec[python_requirements_check_/usr/share/err/repo/requirements.txt]) --- manifests/config.pp | 1 - manifests/virtualenv.pp | 9 +++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/manifests/config.pp b/manifests/config.pp index 43da22e4..49e52307 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -5,7 +5,6 @@ Class['python::install'] -> Python::Virtualenv <| |> Python::Virtualenv <| |> -> Python::Pip <| |> - Python::Virtualenv <| |> -> Python::Requirements <| |> if $python::gunicorn { Class['python::install'] -> Python::Gunicorn <| |> diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index e816468f..e6c39009 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -76,12 +76,17 @@ } if $requirements { - Exec["python_virtualenv_${venv_dir}"] - -> Python::Requirements[$requirements] + exec { "python_requirements_initial_install_${requirements}": + command => "${venv_dir}/bin/pip install ${proxy_flag} --requirement ${requirements}", + refreshonly => true, + timeout => 1800, + subscribe => Exec["python_virtualenv_${venv_dir}"], + } python::requirements { $requirements: virtualenv => $venv_dir, proxy => $proxy, + require => Exec["python_virtualenv_${venv_dir}"], } } From 191376c9c29a7b069ba618a3b59ecad129d4e320 Mon Sep 17 00:00:00 2001 From: Nick Groenen Date: Mon, 11 Mar 2013 14:28:38 +0100 Subject: [PATCH 007/241] Make pip install distribute in a virtualenv optional pip install distribute currentlyfails on Python 3, this way people can skip installing it. It's included by default to remain backward- compatible --- README.md | 3 +++ manifests/virtualenv.pp | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6289fdb0..816610dd 100644 --- a/README.md +++ b/README.md @@ -66,12 +66,15 @@ Creates Python virtualenv. **systempkgs** — Copy system site-packages into virtualenv. Default: don't +**distribute** — Include distribute in the virtualenv. Default: true + python::virtualenv { '/var/www/project1': ensure => present, version => 'system', requirements => '/var/www/project1/requirements.txt', proxy => 'http://proxy.domain.com:3128', systempkgs => true, + distribute => false, } ### python::gunicorn diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index e816468f..c2595e2b 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -19,6 +19,9 @@ # [*systempkgs*] # Copy system site-packages into virtualenv. Default: don't # +# [*distribute*] +# Include distribute in the virtualenv. Default: true +# # === Examples # # python::virtualenv { '/var/www/project1': @@ -41,6 +44,7 @@ $requirements = false, $proxy = false, $systempkgs = false, + $distribute = true, ) { $venv_dir = $name @@ -67,11 +71,16 @@ default => '--system-site-packages', } + $distribute_pkg = $distribute ? { + true => 'distribute', + default => '', + } + exec { "python_virtualenv_${venv_dir}": command => "mkdir -p ${venv_dir} \ ${proxy_command} \ && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \ - && ${venv_dir}/bin/pip install ${proxy_flag} --upgrade distribute pip", + && ${venv_dir}/bin/pip install ${proxy_flag} --upgrade ${distribute_pkg} pip", creates => $venv_dir, } From 88c178043145581d38c8040baec67051ee5c937a Mon Sep 17 00:00:00 2001 From: Nick Groenen Date: Mon, 11 Mar 2013 15:14:08 +0100 Subject: [PATCH 008/241] Allow virtualenv definitions to share the same requirements file --- manifests/requirements.pp | 28 +++++++++++++++++----------- manifests/virtualenv.pp | 11 ++++++----- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 4dd1f1fe..22988e5e 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -4,6 +4,9 @@ # # === Parameters # +# [*requirements*] +# Path to the requirements file. Defaults to the resource name +# # [*virtualenv*] # virtualenv to run pip in. Default: system-wide # @@ -23,12 +26,11 @@ # Ashley Penney # define python::requirements ( - $virtualenv = 'system', - $proxy = false + $requirements = $name, + $virtualenv = 'system', + $proxy = false ) { - $requirements = $name - $pip_env = $virtualenv ? { 'system' => '`which pip`', default => "${virtualenv}/bin/pip", @@ -41,13 +43,17 @@ $req_crc = "${requirements}.sha1" - file { $requirements: - ensure => present, - mode => '0644', - owner => 'root', - group => 'root', - replace => false, - content => '# Puppet will install and/or update pip packages listed here', + # This will ensure multiple python::virtualenv definitions can share the + # the same requirements file. + if !defined(File[$requirements]) { + file { $requirements: + ensure => present, + mode => '0644', + owner => 'root', + group => 'root', + replace => false, + content => '# Puppet will install and/or update pip packages listed here', + } } # SHA1 checksum to detect changes diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index e6c39009..b56da853 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -76,17 +76,18 @@ } if $requirements { - exec { "python_requirements_initial_install_${requirements}": + exec { "python_requirements_initial_install_${requirements}_${venv_dir}": command => "${venv_dir}/bin/pip install ${proxy_flag} --requirement ${requirements}", refreshonly => true, timeout => 1800, subscribe => Exec["python_virtualenv_${venv_dir}"], } - python::requirements { $requirements: - virtualenv => $venv_dir, - proxy => $proxy, - require => Exec["python_virtualenv_${venv_dir}"], + python::requirements { "${requirements}_${venv_dir}": + requirements => $requirements, + virtualenv => $venv_dir, + proxy => $proxy, + require => Exec["python_virtualenv_${venv_dir}"], } } From b1aa3198c8d950b0e0f1254ffc28438a49540297 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sun, 31 Mar 2013 19:36:18 -0400 Subject: [PATCH 009/241] URL support for pip --- README.md | 2 ++ manifests/pip.pp | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 816610dd..aafff6a8 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,8 @@ Installs and manages packages from pip. **virtualenv** — virtualenv to run pip in. +**url** — URL to install from. Default: none + **proxy** — Proxy server to use for outbound connections. Default: none python::pip { 'flask': diff --git a/manifests/pip.pp b/manifests/pip.pp index 9762c103..3a8ec1b2 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -10,6 +10,9 @@ # [*virtualenv*] # virtualenv to run pip in. # +# [*url*] +# URL to install from. Default: none +# # [*proxy*] # Proxy server to use for outbound connections. Default: none # @@ -27,6 +30,7 @@ define python::pip ( $virtualenv, $ensure = present, + $url = false, $proxy = false ) { @@ -45,10 +49,15 @@ default => "^${name}==", } + $source = $url ? { + false => $name, + default => "${url}#egg=${name}", + } + case $ensure { present: { exec { "pip_install_${name}": - command => "${virtualenv}/bin/pip install ${proxy_flag} ${name}", + command => "${virtualenv}/bin/pip install ${proxy_flag} ${source}", unless => "${virtualenv}/bin/pip freeze | grep -i -e ${grep_regex}", } } From 7182643bfea6dfa379dbd779b95bfad9aac3f783 Mon Sep 17 00:00:00 2001 From: woldan Date: Mon, 15 Apr 2013 23:17:45 +0200 Subject: [PATCH 010/241] Added `path` to ensure `mkdir` and `virtualenv` are found. --- manifests/virtualenv.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index ace2a00f..b9ab88ed 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -82,6 +82,7 @@ && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \ && ${venv_dir}/bin/pip install ${proxy_flag} --upgrade ${distribute_pkg} pip", creates => $venv_dir, + path => [ '/bin', '/usr/bin', '/usr/sbin' ], } if $requirements { From 8b22e3ecd90dd3ac741ff107d6f3fc8c511443ba Mon Sep 17 00:00:00 2001 From: Salimane Adjao Moustapha Date: Fri, 19 Apr 2013 18:11:14 +0800 Subject: [PATCH 011/241] fix python::requirements Error: Parameter cwd failed on Exec and command not found --- manifests/requirements.pp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 22988e5e..cae32bfd 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -31,6 +31,11 @@ $proxy = false ) { + $cwd = $virtualenv ? { + 'system' => '/', + default => "${virtualenv}/bin/pip", + } + $pip_env = $virtualenv ? { 'system' => '`which pip`', default => "${virtualenv}/bin/pip", @@ -46,7 +51,7 @@ # This will ensure multiple python::virtualenv definitions can share the # the same requirements file. if !defined(File[$requirements]) { - file { $requirements: + file { $requirements: ensure => present, mode => '0644', owner => 'root', @@ -64,8 +69,9 @@ } exec { "python_requirements_update_${name}": + provider => shell, command => "${pip_env} install ${proxy_flag} -Ur ${requirements}", - cwd => $virtualenv, + cwd => $cwd, refreshonly => true, timeout => 1800, subscribe => Exec["python_requirements_check_${name}"], From 8e99e56af8b85923aa146d2d0ef4e7b2f92b3471 Mon Sep 17 00:00:00 2001 From: Salimane Adjao Moustapha Date: Fri, 19 Apr 2013 18:26:20 +0800 Subject: [PATCH 012/241] add system virtualenv to tests --- tests/requirements.pp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/requirements.pp b/tests/requirements.pp index a57093f0..9a954fa2 100644 --- a/tests/requirements.pp +++ b/tests/requirements.pp @@ -8,3 +8,8 @@ virtualenv => '/var/www/project1', proxy => 'http://proxy.domain.com:3128', } + +python::requirements { '/var/www/project1/requirements.txt': + virtualenv => 'system', + proxy => 'http://proxy.domain.com:3128', +} From 2712963d1b42b91030a2ccc81c3dcbc3df92ab82 Mon Sep 17 00:00:00 2001 From: Nick Groenen Date: Sun, 21 Apr 2013 12:03:43 +0200 Subject: [PATCH 013/241] Conform to Puppet style guide Fixes: puppet-lint "ERROR: two-space soft tabs not used" error --- manifests/requirements.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index cae32bfd..2fabb96a 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -48,10 +48,10 @@ $req_crc = "${requirements}.sha1" - # This will ensure multiple python::virtualenv definitions can share the - # the same requirements file. - if !defined(File[$requirements]) { - file { $requirements: + # This will ensure multiple python::virtualenv definitions can share the + # the same requirements file. + if !defined(File[$requirements]) { + file { $requirements: ensure => present, mode => '0644', owner => 'root', From 156499f5938078b5ab3ec2170f00cd2500f64df1 Mon Sep 17 00:00:00 2001 From: Nick Groenen Date: Sun, 21 Apr 2013 12:08:53 +0200 Subject: [PATCH 014/241] Fix regression with $cwd in python::requirements Commit 8b22e3ecd90dd3ac741ff107d6f3fc8c511443ba introduces a regression which in some cases specifies the full path to pip as it's current working directory, rather than the actual directory pip is in. Obviously this will fail. This commit fixes this. --- manifests/requirements.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 2fabb96a..05596325 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -33,7 +33,7 @@ $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}/bin/pip", + default => "${virtualenv}/bin/", } $pip_env = $virtualenv ? { From ee2a67ad8596fa68cb3952e9ee659546f6cbd66d Mon Sep 17 00:00:00 2001 From: Theo Spears Date: Sat, 4 May 2013 17:07:00 +0100 Subject: [PATCH 015/241] Allow setting owner for virtualenv and requirements --- manifests/requirements.pp | 10 +++++++--- manifests/virtualenv.pp | 14 ++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 05596325..3a32b0ff 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -28,7 +28,9 @@ define python::requirements ( $requirements = $name, $virtualenv = 'system', - $proxy = false + $proxy = false, + $owner = 'root', + $group = 'root' ) { $cwd = $virtualenv ? { @@ -54,8 +56,8 @@ file { $requirements: ensure => present, mode => '0644', - owner => 'root', - group => 'root', + owner => $owner, + group => $group, replace => false, content => '# Puppet will install and/or update pip packages listed here', } @@ -65,6 +67,7 @@ exec { "python_requirements_check_${name}": command => "sha1sum ${requirements} > ${req_crc}", unless => "sha1sum -c ${req_crc}", + user => $owner, require => File[$requirements], } @@ -74,6 +77,7 @@ cwd => $cwd, refreshonly => true, timeout => 1800, + user => $owner, subscribe => Exec["python_requirements_check_${name}"], } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index b9ab88ed..ae0e8472 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -45,6 +45,8 @@ $proxy = false, $systempkgs = false, $distribute = true, + $owner = 'root', + $group = 'root' ) { $venv_dir = $name @@ -81,15 +83,25 @@ ${proxy_command} \ && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \ && ${venv_dir}/bin/pip install ${proxy_flag} --upgrade ${distribute_pkg} pip", + user => $owner, creates => $venv_dir, path => [ '/bin', '/usr/bin', '/usr/sbin' ], } + file{$venv_dir: + ensure => directory, + owner => $owner, + group => $group, + recurse => true, + require => Exec["python_virtualenv_${venv_dir}"], + } + if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": command => "${venv_dir}/bin/pip install ${proxy_flag} --requirement ${requirements}", refreshonly => true, timeout => 1800, + user => $owner, subscribe => Exec["python_virtualenv_${venv_dir}"], } @@ -97,6 +109,8 @@ requirements => $requirements, virtualenv => $venv_dir, proxy => $proxy, + owner => $owner, + group => $group, require => Exec["python_virtualenv_${venv_dir}"], } } From 83c9847a506b3f30dedae500f529fc706f96a875 Mon Sep 17 00:00:00 2001 From: Thomas Bartelmess Date: Sun, 12 May 2013 22:26:54 -0400 Subject: [PATCH 016/241] CentOS and RedHat support --- manifests/init.pp | 2 +- manifests/install.pp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index c7ab10f2..8e8de9e2 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -37,7 +37,7 @@ ) { # Module compatibility check - $compatible = [ 'Debian', 'Ubuntu' ] + $compatible = [ 'Debian', 'Ubuntu', 'CentOS', 'RedHat' ] if ! ($::operatingsystem in $compatible) { fail("Module is not compatible with ${::operatingsystem}") } diff --git a/manifests/install.pp b/manifests/install.pp index e52e7e4c..d2acec02 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -5,6 +5,11 @@ default => "python${python::version}", } + $pythondev = $::operatingsystem ? { + 'RedHat', 'CentOS', 'Fedora' => "$python-devel", + 'Debian', 'Ubuntu' => "$python-dev" + } + package { $python: ensure => present } $dev_ensure = $python::dev ? { @@ -12,7 +17,7 @@ default => absent, } - package { [ "${python}-dev", 'python-pip' ]: ensure => $dev_ensure } + package { [ $pythondev, 'python-pip' ]: ensure => $dev_ensure } $venv_ensure = $python::virtualenv ? { true => present, From c1ca0cef3e27e585eca0366c56100f75a60660c1 Mon Sep 17 00:00:00 2001 From: Thomas Bartelmess Date: Sun, 12 May 2013 22:30:41 -0400 Subject: [PATCH 017/241] Use regex for OS matching --- manifests/install.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index d2acec02..cf0a13e0 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -6,8 +6,8 @@ } $pythondev = $::operatingsystem ? { - 'RedHat', 'CentOS', 'Fedora' => "$python-devel", - 'Debian', 'Ubuntu' => "$python-dev" + /(?i:RedHat|CentOS|Fedora)/ => "$python-devel", + /(?i:Debian|Ubuntu)/ => "$python-dev" } package { $python: ensure => present } From 0ee4d8dcbf10145f319920c474053ccb747630af Mon Sep 17 00:00:00 2001 From: Oded Simon Date: Thu, 16 May 2013 12:18:49 +1000 Subject: [PATCH 018/241] add -i
'/var/www/project1/requirements.txt', # proxy => 'http://proxy.domain.com:3128', # systempkgs => true, +# index => 'http://www.example.com/simple/' # } # # === Authors @@ -47,6 +48,7 @@ $distribute = true, $owner = 'root', $group = 'root' + $index = false, ) { $venv_dir = $name @@ -77,12 +79,17 @@ true => 'distribute', default => '', } + $pypi_index = $index ? { + false => '', + default => "-i ${index}", + } + exec { "python_virtualenv_${venv_dir}": command => "mkdir -p ${venv_dir} \ ${proxy_command} \ && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \ - && ${venv_dir}/bin/pip install ${proxy_flag} --upgrade ${distribute_pkg} pip", + && ${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", user => $owner, creates => $venv_dir, path => [ '/bin', '/usr/bin', '/usr/sbin' ], @@ -98,7 +105,7 @@ if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip install ${proxy_flag} --requirement ${requirements}", + command => "${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --requirement ${requirements}", refreshonly => true, timeout => 1800, user => $owner, From c8693cf024b96d7eacd263cff0dbb48fb2a14b31 Mon Sep 17 00:00:00 2001 From: Aaron DeVore Date: Sat, 18 May 2013 22:45:18 -0700 Subject: [PATCH 019/241] Fix typo from pull request #14 --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 9888cd2b..9f9e96c2 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -47,7 +47,7 @@ $systempkgs = false, $distribute = true, $owner = 'root', - $group = 'root' + $group = 'root', $index = false, ) { From 26cb1fb50d87037bc5494124212bdc9165d62b34 Mon Sep 17 00:00:00 2001 From: Aaron DeVore Date: Sat, 18 May 2013 22:52:20 -0700 Subject: [PATCH 020/241] Use the shell in an exec to avoid specifying a path --- manifests/requirements.pp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 3a32b0ff..67d24ce2 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -65,10 +65,11 @@ # SHA1 checksum to detect changes exec { "python_requirements_check_${name}": - command => "sha1sum ${requirements} > ${req_crc}", - unless => "sha1sum -c ${req_crc}", - user => $owner, - require => File[$requirements], + provider => shell, + command => "sha1sum ${requirements} > ${req_crc}", + unless => "sha1sum -c ${req_crc}", + user => $owner, + require => File[$requirements], } exec { "python_requirements_update_${name}": From 5d3b340ac6ebbee8cca959c2653f141e3030f646 Mon Sep 17 00:00:00 2001 From: schacki Date: Mon, 20 May 2013 14:23:14 +0200 Subject: [PATCH 021/241] Removed multiline backslashes from the execution statement, since this can cause issues with vagrant, linux guest, windows host and shared folders --- manifests/virtualenv.pp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 9f9e96c2..fc0f45b7 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -86,10 +86,7 @@ exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} \ - ${proxy_command} \ - && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} \ - && ${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", user => $owner, creates => $venv_dir, path => [ '/bin', '/usr/bin', '/usr/sbin' ], From 0132b8fb2abe798f2f27541816bdc71a9289b0ba Mon Sep 17 00:00:00 2001 From: schacki Date: Mon, 20 May 2013 15:17:03 +0200 Subject: [PATCH 022/241] Removed SHA calculation from requirements and applied the audit option the requirements file resource which should do exaxtly the same out of the box --- manifests/requirements.pp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 67d24ce2..8b94839d 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -48,8 +48,6 @@ default => "--proxy=${proxy}", } - $req_crc = "${requirements}.sha1" - # This will ensure multiple python::virtualenv definitions can share the # the same requirements file. if !defined(File[$requirements]) { @@ -58,28 +56,20 @@ mode => '0644', owner => $owner, group => $group, + audit => content, replace => false, content => '# Puppet will install and/or update pip packages listed here', } } - # SHA1 checksum to detect changes - exec { "python_requirements_check_${name}": - provider => shell, - command => "sha1sum ${requirements} > ${req_crc}", - unless => "sha1sum -c ${req_crc}", - user => $owner, - require => File[$requirements], - } - - exec { "python_requirements_update_${name}": + exec { "python_requirements${name}": provider => shell, - command => "${pip_env} install ${proxy_flag} -Ur ${requirements}", + command => "${pip_env} install ${proxy_flag} -r ${requirements}", cwd => $cwd, refreshonly => true, timeout => 1800, user => $owner, - subscribe => Exec["python_requirements_check_${name}"], + subscribe => File[$requirements], } } From eec58589feaaafd6e3f4e8500df48f5ed833bbdf Mon Sep 17 00:00:00 2001 From: James Carr Date: Thu, 30 May 2013 22:30:15 -0500 Subject: [PATCH 023/241] Added owner and group params for virtualenv. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index aafff6a8..5a4c8b5b 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,11 @@ Creates Python virtualenv. **distribute** — Include distribute in the virtualenv. Default: true +** owner ** - specify the owner of this virtualenv + +** group ** - specify the group for this virtualenv + + python::virtualenv { '/var/www/project1': ensure => present, version => 'system', @@ -77,6 +82,8 @@ Creates Python virtualenv. proxy => 'http://proxy.domain.com:3128', systempkgs => true, distribute => false, + owner => 'appuser', + group => 'apps', } ### python::gunicorn From a0e9b8c1958966d0d783f1d71b7b5fe3be7ba02a Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Mon, 3 Jun 2013 19:38:35 +1000 Subject: [PATCH 024/241] Added braces around python variable to avoid Puppet syntax errors in install manifest --- manifests/install.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index cf0a13e0..6454377b 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -6,8 +6,8 @@ } $pythondev = $::operatingsystem ? { - /(?i:RedHat|CentOS|Fedora)/ => "$python-devel", - /(?i:Debian|Ubuntu)/ => "$python-dev" + /(?i:RedHat|CentOS|Fedora)/ => "${python}-devel", + /(?i:Debian|Ubuntu)/ => "${python}-dev" } package { $python: ensure => present } From 64de5abe35e71ad85b971bcf9f99a0ea738a41e9 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Mon, 3 Jun 2013 19:39:41 +1000 Subject: [PATCH 025/241] Specifically looked for the activate script when creating a virtualenv since this is created last. This ensures that a half-created virtualenv will be detected and corrected by Puppet. --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index fc0f45b7..9547e270 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -88,7 +88,7 @@ exec { "python_virtualenv_${venv_dir}": command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", user => $owner, - creates => $venv_dir, + creates => "${venv_dir}/bin/activate", path => [ '/bin', '/usr/bin', '/usr/sbin' ], } From 3c606c95e12be941529fdf86c14f3f35bcddbf69 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Mon, 3 Jun 2013 19:41:24 +1000 Subject: [PATCH 026/241] Added owner, group to the pip class which ensures that packages will be installed with the correct permissions. --- manifests/pip.pp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 3a8ec1b2..b40b916a 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -29,9 +29,11 @@ # define python::pip ( $virtualenv, - $ensure = present, - $url = false, - $proxy = false + $ensure = present, + $url = false, + $owner = 'root', + $group = 'root', + $proxy = false ) { # Parameter validation @@ -57,15 +59,17 @@ case $ensure { present: { exec { "pip_install_${name}": - command => "${virtualenv}/bin/pip install ${proxy_flag} ${source}", - unless => "${virtualenv}/bin/pip freeze | grep -i -e ${grep_regex}", + command => "${virtualenv}/bin/pip install ${proxy_flag} ${source}", + unless => "${virtualenv}/bin/pip freeze | grep -i -e ${grep_regex}", + user => $owner, } } default: { exec { "pip_uninstall_${name}": - command => "echo y | ${virtualenv}/bin/pip uninstall ${proxy_flag} ${name}", - onlyif => "${virtualenv}/bin/pip freeze | grep -i -e ${grep_regex}", + command => "echo y | ${virtualenv}/bin/pip uninstall ${proxy_flag} ${name}", + onlyif => "${virtualenv}/bin/pip freeze | grep -i -e ${grep_regex}", + user => $owner, } } } From 5617ad20f4515254d9ac7b9cdef63de59ebece08 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Mon, 3 Jun 2013 19:43:14 +1000 Subject: [PATCH 027/241] Added environment attribute to the pip class which allows for users to override environment variables like LD_LIBRARY_PATH and ORACLE_HOME which are needed to install packages like cx_Oracle. --- manifests/pip.pp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index b40b916a..73f4cdc4 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -33,7 +33,8 @@ $url = false, $owner = 'root', $group = 'root', - $proxy = false + $proxy = false, + environment = [] ) { # Parameter validation @@ -62,6 +63,7 @@ command => "${virtualenv}/bin/pip install ${proxy_flag} ${source}", unless => "${virtualenv}/bin/pip freeze | grep -i -e ${grep_regex}", user => $owner, + environment => $environment, } } @@ -70,6 +72,7 @@ command => "echo y | ${virtualenv}/bin/pip uninstall ${proxy_flag} ${name}", onlyif => "${virtualenv}/bin/pip freeze | grep -i -e ${grep_regex}", user => $owner, + environment => $environment, } } } From f6fd9f46fe9c058d1f0877043d42829efe0c45cb Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Mon, 3 Jun 2013 20:48:10 +1000 Subject: [PATCH 028/241] Now that all exec statements run under a particular owner, there is no need for the CPU intensive recursive virtualenv permission check --- manifests/virtualenv.pp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 9547e270..5946e157 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -84,7 +84,6 @@ default => "-i ${index}", } - exec { "python_virtualenv_${venv_dir}": command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", user => $owner, @@ -92,14 +91,6 @@ path => [ '/bin', '/usr/bin', '/usr/sbin' ], } - file{$venv_dir: - ensure => directory, - owner => $owner, - group => $group, - recurse => true, - require => Exec["python_virtualenv_${venv_dir}"], - } - if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": command => "${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --requirement ${requirements}", From 1aaef848f4a52d83a6b44eeb4cffd9b61a665c41 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Mon, 3 Jun 2013 23:13:50 +1000 Subject: [PATCH 029/241] Made system virtualenv more robust and ensured that pip logging would occur in an appropriate directory upon failure to avoid errors --- manifests/pip.pp | 24 +++++++++++++++++++----- manifests/requirements.pp | 9 ++++++--- manifests/virtualenv.pp | 4 ++-- 3 files changed, 27 insertions(+), 10 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 73f4cdc4..0693057b 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -28,7 +28,7 @@ # Sergey Stankevich # define python::pip ( - $virtualenv, + $virtualenv = 'system', $ensure = present, $url = false, $owner = 'root', @@ -42,6 +42,20 @@ fail('python::pip: virtualenv parameter must not be empty') } + if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { + fail('python::pip: root user must be used when virtualenv is system') + } + + $cwd = $virtualenv ? { + 'system' => '/', + default => "${virtualenv}", + } + + $pip_env = $virtualenv ? { + 'system' => '`which pip`', + default => "${virtualenv}/bin/pip", + } + $proxy_flag = $proxy ? { false => '', default => "--proxy=${proxy}", @@ -60,8 +74,8 @@ case $ensure { present: { exec { "pip_install_${name}": - command => "${virtualenv}/bin/pip install ${proxy_flag} ${source}", - unless => "${virtualenv}/bin/pip freeze | grep -i -e ${grep_regex}", + command => "$pip_env --log-file ${cwd}/pip.log install ${proxy_flag} ${source}", + unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, } @@ -69,8 +83,8 @@ default: { exec { "pip_uninstall_${name}": - command => "echo y | ${virtualenv}/bin/pip uninstall ${proxy_flag} ${name}", - onlyif => "${virtualenv}/bin/pip freeze | grep -i -e ${grep_regex}", + command => "echo y | $pip_env uninstall ${proxy_flag} ${name}", + onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, } diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 8b94839d..3019a469 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -33,9 +33,13 @@ $group = 'root' ) { + if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { + fail('python::pip: root user must be used when virtualenv is system') + } + $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}/bin/", + default => "${virtualenv}", } $pip_env = $virtualenv ? { @@ -64,8 +68,7 @@ exec { "python_requirements${name}": provider => shell, - command => "${pip_env} install ${proxy_flag} -r ${requirements}", - cwd => $cwd, + command => "${pip_env} --log-file ${cwd}/pip.log install ${proxy_flag} -r ${requirements}", refreshonly => true, timeout => 1800, user => $owner, diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 5946e157..53f30f8a 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -85,7 +85,7 @@ } exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", user => $owner, creates => "${venv_dir}/bin/activate", path => [ '/bin', '/usr/bin', '/usr/sbin' ], @@ -93,7 +93,7 @@ if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip install ${pypi_index} ${proxy_flag} --requirement ${requirements}", + command => "${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --requirement ${requirements}", refreshonly => true, timeout => 1800, user => $owner, From 5132cf1798d862e28f9c9355a2e01a96f585f28f Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Mon, 3 Jun 2013 23:29:44 +1000 Subject: [PATCH 030/241] Removed owner attribute from the pip class as it was not needed and touched up a few mistakes. --- manifests/pip.pp | 15 +++++++-------- manifests/virtualenv.pp | 2 +- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 0693057b..3940374f 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -28,13 +28,12 @@ # Sergey Stankevich # define python::pip ( - $virtualenv = 'system', - $ensure = present, - $url = false, - $owner = 'root', - $group = 'root', - $proxy = false, - environment = [] + $ensure = present, + $virtualenv = 'system', + $url = false, + $owner = 'root', + $proxy = false, + $environment = [] ) { # Parameter validation @@ -42,7 +41,7 @@ fail('python::pip: virtualenv parameter must not be empty') } - if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { + if $virtualenv == 'system' and $owner != 'root' { fail('python::pip: root user must be used when virtualenv is system') } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 53f30f8a..684a4175 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -93,7 +93,7 @@ if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --requirement ${requirements}", + command => "${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} -r ${requirements}", refreshonly => true, timeout => 1800, user => $owner, From 01bf2791ecadfbb954b947fefa8b15ca0c0b9947 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Tue, 4 Jun 2013 09:36:33 +1000 Subject: [PATCH 031/241] Amended all documentation and updated version to 1.1.0 --- Modulefile | 2 +- README.md | 87 ++++++++++++++++++++++++++------------- manifests/pip.pp | 7 ++++ manifests/requirements.pp | 7 ++++ manifests/virtualenv.pp | 10 +++++ 5 files changed, 84 insertions(+), 29 deletions(-) diff --git a/Modulefile b/Modulefile index c7f2f97f..e132e991 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppet-python' -version '1.0.0' +version '1.1.0' author 'Sergey Stankevich' license 'Apache License, Version 2.0' diff --git a/README.md b/README.md index 5a4c8b5b..1108ba03 100644 --- a/README.md +++ b/README.md @@ -3,19 +3,36 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. +**Version 1.1.0 Notes** + +Version 1.1.0 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 everal changes have been made in v1.1.0 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: + +* All pip definitions MUST include the owner field which specifies which user owns the virtualenv that packages will be installed in. Adding this greatly improves performance and efficiency of this module. + +## Installation + +``` bash +cd /etc/puppet/modules +git clone git://github.com/stankevich/puppet-python.git +``` + ## Usage ### python Installs and manages python, python-dev, python-virtualenv and Gunicorn. -**version** — Python version to install. Default: system default +**version** - Python version to install. Default: system default -**dev** — Install python-dev. Default: false +**dev** - Install python-dev. Default: false -**virtualenv** — Install python-virtualenv. Default: false +**virtualenv** - Install python-virtualenv. Default: false -**gunicorn** — Install Gunicorn. Default: false +**gunicorn** - Install Gunicorn. Default: false class { 'python': version => 'system', @@ -28,52 +45,65 @@ Installs and manages python, python-dev, python-virtualenv and Gunicorn. Installs and manages packages from pip. -**ensure** — present/absent. Default: present +**ensure** - present/absent. Default: present -**virtualenv** — virtualenv to run pip in. +**virtualenv** - virtualenv to run pip in. Default: system (no virtualenv) -**url** — URL to install from. Default: none +**url** - URL to install from. Default: none -**proxy** — Proxy server to use for outbound connections. Default: none +**owner** - The owner of the virtualenv to ensure that packages are installed with the correct permissions (must be specified). Default: root - python::pip { 'flask': - virtualenv => '/var/www/project1', - proxy => 'http://proxy.domain.com:3128', +**proxy** - Proxy server to use for outbound connections. Default: none + +**environment** - Additional environment variables required to install the packages. Default: none + + python::pip { 'cx_Oracle': + virtualenv => '/var/www/project1', + owner => 'appuser', + proxy => 'http://proxy.domain.com:3128', + environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', } ### python::requirements Installs and manages Python packages from requirements file. -**virtualenv** — virtualenv to run pip in. Default: system-wide +**virtualenv** - virtualenv to run pip in. Default: system-wide + +**proxy** - Proxy server to use for outbound connections. Default: none + +**owner** - The owner of the virtualenv to ensure that packages are installed with the correct permissions (must be specified). Default: root -**proxy** — Proxy server to use for outbound connections. Default: none +**group** - The group that was used to create the virtualenv. This is used to create the requirements file with correct permissions if it's not present already. python::requirements { '/var/www/project1/requirements.txt': virtualenv => '/var/www/project1', proxy => 'http://proxy.domain.com:3128', + owner => 'appuser', + group => 'apps', } ### python::virtualenv Creates Python virtualenv. -**ensure** — present/absent. Default: present +**ensure** - present/absent. Default: present -**version** — Python version to use. Default: system default +**version** - Python version to use. Default: system default -**requirements** — Path to pip requirements.txt file. Default: none +**requirements** - Path to pip requirements.txt file. Default: none -**proxy** — Proxy server to use for outbound connections. Default: none +**proxy** - Proxy server to use for outbound connections. Default: none -**systempkgs** — Copy system site-packages into virtualenv. Default: don't +**systempkgs** - Copy system site-packages into virtualenv. Default: don't -**distribute** — Include distribute in the virtualenv. Default: true +**distribute** - Include distribute in the virtualenv. Default: true -** owner ** - specify the owner of this virtualenv +**owner** - Specify the owner of this virtualenv -** group ** - specify the group for this virtualenv +**group** - Specify the group for this virtualenv +**index** - Base URL of Python package index. Default: none python::virtualenv { '/var/www/project1': ensure => present, @@ -90,19 +120,19 @@ Creates Python virtualenv. Manages Gunicorn virtual hosts. -**ensure** — present/absent. Default: present +**ensure** - present/absent. Default: present -**virtualenv** — Run in virtualenv, specify directory. Default: disabled +**virtualenv** - Run in virtualenv, specify directory. Default: disabled -**mode** — Gunicorn mode. wsgi/django. Default: wsgi +**mode** - Gunicorn mode. wsgi/django. Default: wsgi -**dir** — Application directory. +**dir** - Application directory. -**bind** — Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. Default: unix:/tmp/gunicorn-$name.socket or unix:${virtualenv}/${name}.socket +**bind** - Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. Default: unix:/tmp/gunicorn-$name.socket or unix:${virtualenv}/${name}.socket -**environment** — Set ENVIRONMENT variable. Default: none +**environment** - Set ENVIRONMENT variable. Default: none -**template** — Which ERB template to use. Default: python/gunicorn.erb +**template** - Which ERB template to use. Default: python/gunicorn.erb python::gunicorn { 'vhost': ensure => present, @@ -119,3 +149,4 @@ Manages Gunicorn virtual hosts. [Sergey Stankevich](https://github.com/stankevich) [Ashley Penney](https://github.com/apenney) [Marc Fournier](https://github.com/mfournier) +[Fotis Gimian](https://github.com/fgimian) diff --git a/manifests/pip.pp b/manifests/pip.pp index 3940374f..a9805d34 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -13,9 +13,15 @@ # [*url*] # URL to install from. Default: none # +# [*owner*] +# The owner of the virtualenv being manipulated. Default: root +# # [*proxy*] # Proxy server to use for outbound connections. Default: none # +# [*environment*] +# Additional environment variables required to install the packages. Default: none +# # === Examples # # python::pip { 'flask': @@ -26,6 +32,7 @@ # === Authors # # Sergey Stankevich +# Fotis Gimian # define python::pip ( $ensure = present, diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 3019a469..789c0d3c 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -13,6 +13,12 @@ # [*proxy*] # Proxy server to use for outbound connections. Default: none # +# [*owner*] +# The owner of the virtualenv being manipulated. Default: root +# +# [*group*] +# The group relating to the virtualenv being manipulated. Default: root +# # === Examples # # python::requirements { '/var/www/project1/requirements.txt': @@ -24,6 +30,7 @@ # # Sergey Stankevich # Ashley Penney +# Fotis Gimian # define python::requirements ( $requirements = $name, diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 684a4175..f45678be 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -22,6 +22,15 @@ # [*distribute*] # Include distribute in the virtualenv. Default: true # +# [*owner*] +# The owner of the virtualenv being manipulated. Default: root +# +# [*group*] +# The group relating to the virtualenv being manipulated. Default: root +# +# [*index*] +# Base URL of Python package index. Default: none (http://pypi.python.org/simple/) +# # === Examples # # python::virtualenv { '/var/www/project1': @@ -38,6 +47,7 @@ # Sergey Stankevich # Ashley Penney # Marc Fournier +# Fotis Gimian # define python::virtualenv ( $ensure = present, From 17debdc04506a2bfd4297b7620acffdbd01c9176 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Tue, 4 Jun 2013 10:20:38 +1000 Subject: [PATCH 032/241] Made the pip package independent from the dev package in the python class and updated version to 1.1.1 --- Modulefile | 2 +- README.md | 9 ++++++--- manifests/init.pp | 5 +++++ manifests/install.pp | 8 +++++++- 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/Modulefile b/Modulefile index e132e991..fc139205 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppet-python' -version '1.1.0' +version '1.1.1' author 'Sergey Stankevich' license 'Apache License, Version 2.0' diff --git a/README.md b/README.md index 1108ba03..d072b768 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,16 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. -**Version 1.1.0 Notes** +**Version 1.1.1 Notes** -Version 1.1.0 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.1 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 everal changes have been made in v1.1.0 which make manifests incompatible with the previous version. However, modifying your manifests to suit is trivial. Please see the notes below. +Please note that everal changes have been made in v1.1.1 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: * All pip definitions MUST include the owner field which specifies which user owns the virtualenv that packages will be installed in. Adding this greatly improves performance and efficiency of this module. +* You must explicitly specify pip => true in the python class if you want pip installed. As such, the pip package is now independent of the dev package and so one can exist without the other. ## Installation @@ -28,6 +29,8 @@ Installs and manages python, python-dev, python-virtualenv and Gunicorn. **version** - Python version to install. Default: system default +**pip** - Install python-pip. Default: false + **dev** - Install python-dev. Default: false **virtualenv** - Install python-virtualenv. Default: false diff --git a/manifests/init.pp b/manifests/init.pp index 8e8de9e2..2a9a44c3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -7,6 +7,9 @@ # [*version*] # Python version to install. Default: system default # +# [*pip*] +# Install python-pip. Default: false +# # [*dev*] # Install python-dev. Default: false # @@ -20,6 +23,7 @@ # # class { 'python': # version => 'system', +# pip => true, # dev => true, # virtualenv => true, # gunicorn => true, @@ -31,6 +35,7 @@ # class python ( $version = 'system', + $pip = false, $dev = false, $virtualenv = false, $gunicorn = false diff --git a/manifests/install.pp b/manifests/install.pp index 6454377b..9306e3a3 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -17,7 +17,13 @@ default => absent, } - package { [ $pythondev, 'python-pip' ]: ensure => $dev_ensure } + $pip_ensure = $python::pip ? { + true => present, + default => absent, + } + + package { $pythondev: ensure => $dev_ensure } + package { 'python-pip': ensure => $pip_ensure } $venv_ensure = $python::virtualenv ? { true => present, From 8608958fe1bb7fec4bb75c65bd6b1f1e236e88bd Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Tue, 4 Jun 2013 11:25:48 +1000 Subject: [PATCH 033/241] Removed unnecessary which commands for obtaining the pip and python executables --- manifests/pip.pp | 2 +- manifests/requirements.pp | 2 +- manifests/virtualenv.pp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index a9805d34..ddbcd6fd 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -58,7 +58,7 @@ } $pip_env = $virtualenv ? { - 'system' => '`which pip`', + 'system' => 'pip', default => "${virtualenv}/bin/pip", } diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 789c0d3c..ba16d1e2 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -50,7 +50,7 @@ } $pip_env = $virtualenv ? { - 'system' => '`which pip`', + 'system' => 'pip', default => "${virtualenv}/bin/pip", } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index f45678be..7fbf25ef 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -95,7 +95,7 @@ } exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv -p `which ${python}` ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", user => $owner, creates => "${venv_dir}/bin/activate", path => [ '/bin', '/usr/bin', '/usr/sbin' ], From 167b43b8b0fb54311c7703a1bbb627a54e84ebab Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Tue, 4 Jun 2013 11:26:22 +1000 Subject: [PATCH 034/241] Touched up virtualenv to run from /tmp to avoid write errors --- manifests/virtualenv.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 7fbf25ef..07007fb5 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -99,6 +99,7 @@ user => $owner, creates => "${venv_dir}/bin/activate", path => [ '/bin', '/usr/bin', '/usr/sbin' ], + cwd => "/tmp", } if $requirements { From a6d9f59d0bd9c27e1fd9668b926913c44dfb52e6 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Tue, 4 Jun 2013 11:26:46 +1000 Subject: [PATCH 035/241] Incremented version to 1.1.2 --- Modulefile | 2 +- README.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Modulefile b/Modulefile index fc139205..dfd366b7 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppet-python' -version '1.1.1' +version '1.1.2' author 'Sergey Stankevich' license 'Apache License, Version 2.0' diff --git a/README.md b/README.md index d072b768..2cf6b7d0 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. -**Version 1.1.1 Notes** +**Version 1.1.x Notes** -Version 1.1.1 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 everal changes have been made in v1.1.1 which make manifests incompatible with the previous version. However, modifying your manifests to suit is trivial. Please see the notes below. +Please note that everal 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: From d3d69488a9a9f2bf2edd170ea6db31830690e8d9 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Tue, 4 Jun 2013 11:55:04 +1000 Subject: [PATCH 036/241] Added environment parameter to requirements and virtualenv classes and incremented version to 1.1.3 --- Modulefile | 2 +- manifests/requirements.pp | 15 ++++++++++----- manifests/virtualenv.pp | 20 +++++++++++++------- 3 files changed, 24 insertions(+), 13 deletions(-) diff --git a/Modulefile b/Modulefile index dfd366b7..1fb0c2da 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppet-python' -version '1.1.2' +version '1.1.3' author 'Sergey Stankevich' license 'Apache License, Version 2.0' diff --git a/manifests/requirements.pp b/manifests/requirements.pp index ba16d1e2..67906fc8 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -10,15 +10,18 @@ # [*virtualenv*] # virtualenv to run pip in. Default: system-wide # -# [*proxy*] -# Proxy server to use for outbound connections. Default: none -# # [*owner*] # The owner of the virtualenv being manipulated. Default: root # # [*group*] # The group relating to the virtualenv being manipulated. Default: root # +# [*proxy*] +# Proxy server to use for outbound connections. Default: none +# +# [*environment*] +# Additional environment variables required to install the packages. Default: none +# # === Examples # # python::requirements { '/var/www/project1/requirements.txt': @@ -35,9 +38,10 @@ define python::requirements ( $requirements = $name, $virtualenv = 'system', - $proxy = false, $owner = 'root', - $group = 'root' + $group = 'root', + $proxy = false, + $environment = [] ) { if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { @@ -80,6 +84,7 @@ timeout => 1800, user => $owner, subscribe => File[$requirements], + environment => $environment, } } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 07007fb5..354e4d82 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -13,23 +13,26 @@ # [*requirements*] # Path to pip requirements.txt file. Default: none # -# [*proxy*] -# Proxy server to use for outbound connections. Default: none -# # [*systempkgs*] # Copy system site-packages into virtualenv. Default: don't # # [*distribute*] # Include distribute in the virtualenv. Default: true # +# [*index*] +# Base URL of Python package index. Default: none (http://pypi.python.org/simple/) +# # [*owner*] # The owner of the virtualenv being manipulated. Default: root # # [*group*] # The group relating to the virtualenv being manipulated. Default: root # -# [*index*] -# Base URL of Python package index. Default: none (http://pypi.python.org/simple/) +# [*proxy*] +# Proxy server to use for outbound connections. Default: none +# +# [*environment*] +# Additional environment variables required to install the packages. Default: none # # === Examples # @@ -53,12 +56,13 @@ $ensure = present, $version = 'system', $requirements = false, - $proxy = false, $systempkgs = false, $distribute = true, + $index = false, $owner = 'root', $group = 'root', - $index = false, + $proxy = false, + $environment = [] ) { $venv_dir = $name @@ -100,6 +104,7 @@ creates => "${venv_dir}/bin/activate", path => [ '/bin', '/usr/bin', '/usr/sbin' ], cwd => "/tmp", + environment => $environment, } if $requirements { @@ -109,6 +114,7 @@ timeout => 1800, user => $owner, subscribe => Exec["python_virtualenv_${venv_dir}"], + environment => $environment, } python::requirements { "${requirements}_${venv_dir}": From 96e50bf5038add993258f6d8f4b317cf3c779d33 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Tue, 4 Jun 2013 12:04:18 +1000 Subject: [PATCH 037/241] Fixed minor typo in installation instructions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2cf6b7d0..971bbe87 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Currently, the changes you need to make are as follows: ``` bash cd /etc/puppet/modules -git clone git://github.com/stankevich/puppet-python.git +git clone git://github.com/stankevich/puppet-python.git python ``` ## Usage From 07e6cc6b3d2afa25be0ae829c5bff8385c2815f3 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Tue, 4 Jun 2013 12:15:01 +1000 Subject: [PATCH 038/241] Changed documentation to reflect that it's a fork and that I will be maintaining it --- Modulefile | 8 ++++---- README.md | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Modulefile b/Modulefile index 1fb0c2da..3fe40336 100644 --- a/Modulefile +++ b/Modulefile @@ -1,9 +1,9 @@ name 'puppet-python' -version '1.1.3' +version '1.1.4' -author 'Sergey Stankevich' +author 'Fotis Gimian' license 'Apache License, Version 2.0' -project_page 'https://github.com/stankevich/puppet-python' -source 'git://github.com/stankevich/puppet-python' +project_page 'https://github.com/fgimian/puppet-python' +source 'git://github.com/fgimian/puppet-python' summary 'Puppet module for Python' description 'Installs and manages Python, pip, virtualenv, Gunicorn virtual hosts.' diff --git a/README.md b/README.md index 971bbe87..9e35e36e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,11 @@ -[puppet-python](https://github.com/stankevich/puppet-python) +[puppet-python](https://github.com/fgimian/puppet-python) ====== -Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. +This project was forked from [stankevich's Github page](https://github.com/stankevich/puppet-python) -**Version 1.1.x Notes** +Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. This fork 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 Notes (fgimian fork)** 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. @@ -18,7 +20,7 @@ Currently, the changes you need to make are as follows: ``` bash cd /etc/puppet/modules -git clone git://github.com/stankevich/puppet-python.git python +git clone git://github.com/fgimian/puppet-python.git python ``` ## Usage From 006692eceb86079ab4c0976c978d705b160217f0 Mon Sep 17 00:00:00 2001 From: Fotis Gimian Date: Thu, 13 Jun 2013 08:30:19 +1000 Subject: [PATCH 039/241] Reverted documentation to reflect Sergey as the owner now that the pull request was accepted --- Modulefile | 6 +++--- README.md | 10 ++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Modulefile b/Modulefile index 3fe40336..6bfbe7a4 100644 --- a/Modulefile +++ b/Modulefile @@ -1,9 +1,9 @@ name 'puppet-python' version '1.1.4' -author 'Fotis Gimian' +author 'Sergey Stankevich' license 'Apache License, Version 2.0' -project_page 'https://github.com/fgimian/puppet-python' -source 'git://github.com/fgimian/puppet-python' +project_page 'https://github.com/stankevich/puppet-python' +source 'git://github.com/stankevich/puppet-python' summary 'Puppet module for Python' description 'Installs and manages Python, pip, virtualenv, Gunicorn virtual hosts.' diff --git a/README.md b/README.md index 9e35e36e..971bbe87 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,9 @@ -[puppet-python](https://github.com/fgimian/puppet-python) +[puppet-python](https://github.com/stankevich/puppet-python) ====== -This project was forked from [stankevich's Github page](https://github.com/stankevich/puppet-python) +Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. -Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. This fork 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 Notes (fgimian fork)** +**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. @@ -20,7 +18,7 @@ Currently, the changes you need to make are as follows: ``` bash cd /etc/puppet/modules -git clone git://github.com/fgimian/puppet-python.git python +git clone git://github.com/stankevich/puppet-python.git python ``` ## Usage From 291ebd17cdc6ffe16e731bf4ba49cf7e185fc1cf Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 9 Jul 2013 11:57:38 +0100 Subject: [PATCH 040/241] Install pip before distribute --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 354e4d82..039d0853 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -99,7 +99,7 @@ } exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade ${distribute_pkg} pip", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", user => $owner, creates => "${venv_dir}/bin/activate", path => [ '/bin', '/usr/bin', '/usr/sbin' ], From e9520954b699fc87c3e58c62bffe027fe11e2f1c Mon Sep 17 00:00:00 2001 From: Frank Chiang Date: Thu, 15 Aug 2013 08:23:48 -0400 Subject: [PATCH 041/241] Change hardcoded path in virtualenv module to take in an optional parameter. --- manifests/virtualenv.pp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 039d0853..14207a5f 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -62,7 +62,8 @@ $owner = 'root', $group = 'root', $proxy = false, - $environment = [] + $environment = [], + $path = [ '/bin', '/usr/bin', '/usr/sbin' ] ) { $venv_dir = $name @@ -102,7 +103,7 @@ command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", user => $owner, creates => "${venv_dir}/bin/activate", - path => [ '/bin', '/usr/bin', '/usr/sbin' ], + path => $path, cwd => "/tmp", environment => $environment, } From 98a51c5885a2f8e27ee41d56e6a8c64de4c9848c Mon Sep 17 00:00:00 2001 From: Frank Chiang Date: Thu, 15 Aug 2013 08:46:29 -0400 Subject: [PATCH 042/241] Add comments describing what path parameter does. --- manifests/virtualenv.pp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 14207a5f..26f50ed4 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -34,6 +34,9 @@ # [*environment*] # Additional environment variables required to install the packages. Default: none # +# [*path*] +# Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] +# # === Examples # # python::virtualenv { '/var/www/project1': From 12d5427d2856f773427ec17b70cea687afd9c8b1 Mon Sep 17 00:00:00 2001 From: Veros Kaplan Date: Thu, 5 Sep 2013 16:13:36 +0200 Subject: [PATCH 043/241] Added missing Python version --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 039d0853..cefffccd 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -99,7 +99,7 @@ } exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} ${venv_dir} && ${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", user => $owner, creates => "${venv_dir}/bin/activate", path => [ '/bin', '/usr/bin', '/usr/sbin' ], From 4f2c04b70452249e6917859fdbf02bd90ec3af79 Mon Sep 17 00:00:00 2001 From: Antonis Christofides Date: Tue, 8 Oct 2013 17:59:17 +0300 Subject: [PATCH 044/241] Added src parameter for pip in python::requirements A requirements file can have --editable resources; in such a case the pip default is to install them in ~/src/, which can be unsuitable; for example, if run by root, /root/src/ is usually unreadable by other users. pip provides an --src parameter to specify an alternative directory. This is useful for installing requirements systemwide, outside a virtualenv. --- README.md | 2 ++ manifests/requirements.pp | 13 ++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 971bbe87..7fa9dac4 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,8 @@ Installs and manages Python packages from requirements file. **owner** - The owner of the virtualenv to ensure that packages are installed with the correct permissions (must be specified). Default: root +**src** - The ``--src`` parameter to ``pip``, used to specify where to install ``--editable`` resources; by default no ``--src`` parameter is passed to ``pip``. + **group** - The group that was used to create the virtualenv. This is used to create the requirements file with correct permissions if it's not present already. python::requirements { '/var/www/project1/requirements.txt': diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 67906fc8..60c5b6c8 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -19,6 +19,11 @@ # [*proxy*] # Proxy server to use for outbound connections. Default: none # +# [*src*] +# Pip --src parameter; if the requirements file contains --editable resources, +# this parameter specifies where they will be installed. See the pip +# documentation for more. Default: none (i.e. use the pip default). +# # [*environment*] # Additional environment variables required to install the packages. Default: none # @@ -41,6 +46,7 @@ $owner = 'root', $group = 'root', $proxy = false, + $src = false, $environment = [] ) { @@ -63,6 +69,11 @@ default => "--proxy=${proxy}", } + $src_flag = $src ? { + false => '', + default => "--src=${src}", + } + # This will ensure multiple python::virtualenv definitions can share the # the same requirements file. if !defined(File[$requirements]) { @@ -79,7 +90,7 @@ exec { "python_requirements${name}": provider => shell, - command => "${pip_env} --log-file ${cwd}/pip.log install ${proxy_flag} -r ${requirements}", + command => "${pip_env} --log-file ${cwd}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements}", refreshonly => true, timeout => 1800, user => $owner, From a2e66713c380c81a484583a3a33ff6dead87a496 Mon Sep 17 00:00:00 2001 From: Fredrik Thulin Date: Wed, 9 Oct 2013 15:56:13 +0200 Subject: [PATCH 045/241] Add options install_args and uninstall_args. Modern pip does not install what it considers 'pre-release' versions unless '--pre' is given as argument. This change adds a mechanism for supplying the '--pre' argument or any other argument deemed necessary. --- manifests/pip.pp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index ddbcd6fd..1d576e0f 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -35,12 +35,14 @@ # Fotis Gimian # define python::pip ( - $ensure = present, - $virtualenv = 'system', - $url = false, - $owner = 'root', - $proxy = false, - $environment = [] + $ensure = present, + $virtualenv = 'system', + $url = false, + $owner = 'root', + $proxy = false, + $environment = [], + $install_args = '', + $uninstall_args = '', ) { # Parameter validation @@ -80,7 +82,7 @@ case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env --log-file ${cwd}/pip.log install ${proxy_flag} ${source}", + command => "$pip_env --log-file ${cwd}/pip.log install $install_args ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -89,7 +91,7 @@ default: { exec { "pip_uninstall_${name}": - command => "echo y | $pip_env uninstall ${proxy_flag} ${name}", + command => "echo y | $pip_env uninstall $uninstall_args ${proxy_flag} ${name}", onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, From b84a20709beecc417893fdee4e25060ea63fab21 Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 15 Oct 2013 13:38:38 +0100 Subject: [PATCH 046/241] Added support for setting egg name --- manifests/pip.pp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 1d576e0f..8bd21d38 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -40,6 +40,7 @@ $url = false, $owner = 'root', $proxy = false, + $egg = false, $environment = [], $install_args = '', $uninstall_args = '', @@ -74,9 +75,14 @@ default => "^${name}==", } + $egg_name = $egg ? { + false => $name, + default => $egg + } + $source = $url ? { false => $name, - default => "${url}#egg=${name}", + default => "${url}#egg=${egg_name}", } case $ensure { From f7718f0d9b6184328a301dbcbbd6e5346c8c1f0a Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 15 Oct 2013 15:23:42 +0100 Subject: [PATCH 047/241] Updated docs to include egg param --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 7fa9dac4..b8544f42 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,8 @@ Installs and manages packages from pip. **environment** - Additional environment variables required to install the packages. Default: none +**egg** - The egg name to use. Default: $name of the class, e.g. cx_Oracle + python::pip { 'cx_Oracle': virtualenv => '/var/www/project1', owner => 'appuser', From e7b0e1475daaf778861220835a01c7c6f699a2b8 Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 15 Oct 2013 15:29:37 +0100 Subject: [PATCH 048/241] Updated readme to include install and uninstall args --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index b8544f42..a259470a 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,10 @@ Installs and manages packages from pip. **egg** - The egg name to use. Default: $name of the class, e.g. cx_Oracle +**install_args** - Array of additional flags to pass to pip during installaton. Default: none + +**uninstall_args** - Array of additional flags to pass to pip during uninstall. Default: none + python::pip { 'cx_Oracle': virtualenv => '/var/www/project1', owner => 'appuser', From 31d96b912c16f82aa61d581a443a9b4c52914aa9 Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 15 Oct 2013 15:30:43 +0100 Subject: [PATCH 049/241] Updated python::pip example to include install_args --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a259470a..e9a2b852 100644 --- a/README.md +++ b/README.md @@ -67,10 +67,11 @@ Installs and manages packages from pip. **uninstall_args** - Array of additional flags to pass to pip during uninstall. Default: none python::pip { 'cx_Oracle': - virtualenv => '/var/www/project1', - owner => 'appuser', - proxy => 'http://proxy.domain.com:3128', - environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', + virtualenv => '/var/www/project1', + owner => 'appuser', + proxy => 'http://proxy.domain.com:3128', + environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', + install_args => ['-e'], } ### python::requirements From df25cc78db263ddfbd8588b6cc320a1970387c47 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sat, 19 Oct 2013 15:01:45 +0300 Subject: [PATCH 050/241] Adding .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..b2bcbe85 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +pkg/ \ No newline at end of file From 680107d214b452feea02b4ad8dc4fdecaa565d94 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sat, 19 Oct 2013 15:02:25 +0300 Subject: [PATCH 051/241] Version bump --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 6bfbe7a4..f8b02b54 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppet-python' -version '1.1.4' +version '1.1.6' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 94f0993b4f37a7f64bcf54f885f69f9de3a7ccc3 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sat, 19 Oct 2013 16:10:44 +0300 Subject: [PATCH 052/241] Forge upload --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index f8b02b54..0b1feed6 100644 --- a/Modulefile +++ b/Modulefile @@ -1,4 +1,4 @@ -name 'puppet-python' +name 'stankevich-python' version '1.1.6' author 'Sergey Stankevich' From 65bf6fe8b6cf23050e755d62291f56f7e8654ede Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sat, 19 Oct 2013 16:10:59 +0300 Subject: [PATCH 053/241] pip log option. Fixes #28 --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 8bd21d38..3ca33a85 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -88,7 +88,7 @@ case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env --log-file ${cwd}/pip.log install $install_args ${proxy_flag} ${source}", + 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, From e47c5bbc602cdc7d0e2c1fffe890517dd190999c Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sat, 19 Oct 2013 16:14:44 +0300 Subject: [PATCH 054/241] Version 1.1.7 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 0b1feed6..890910f3 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.1.6' +version '1.1.7' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 176915523acd5ddd88de187426966b0d9ffb5f4b Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 1 Nov 2013 18:20:01 -0400 Subject: [PATCH 055/241] Disable system package flag on older virtualenv --- lib/facter/virtualenv_version.rb | 7 +++++++ manifests/virtualenv.pp | 11 ++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 lib/facter/virtualenv_version.rb diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb new file mode 100644 index 00000000..2ede3f93 --- /dev/null +++ b/lib/facter/virtualenv_version.rb @@ -0,0 +1,7 @@ +require 'puppet' +pkg = Puppet::Type.type(:package).new(:name => "virtualenv") +Facter.add("virtualenv_version") do + setcode do + /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end +end diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index bdcfc6f5..fc46c72d 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -15,6 +15,8 @@ # # [*systempkgs*] # Copy system site-packages into virtualenv. Default: don't +# If virtualenv version < 1.7 this flag has no effect since +# the system packages were not supported # # [*distribute*] # Include distribute in the virtualenv. Default: true @@ -88,9 +90,12 @@ default => "&& export http_proxy=${proxy}", } - $system_pkgs_flag = $systempkgs ? { - false => '', - default => '--system-site-packages', + # Virtualenv versions prior to 1.7 do not support the + # --system-site-packages flag, default off for prior versions + if versioncmp($::virtualenv_version,'1.7') > 0 and systempkgs == true { + $system_pkgs_flag = '--system-site-packages', + } else { + $system_pkgs_flag = '' } $distribute_pkg = $distribute ? { From d38db335949c6f8abfb4247276492b1a5051e8f9 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 1 Nov 2013 18:32:16 -0400 Subject: [PATCH 056/241] Fix virtualenv conditional syntax --- manifests/virtualenv.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index fc46c72d..8b707c8a 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -92,8 +92,8 @@ # Virtualenv versions prior to 1.7 do not support the # --system-site-packages flag, default off for prior versions - if versioncmp($::virtualenv_version,'1.7') > 0 and systempkgs == true { - $system_pkgs_flag = '--system-site-packages', + if (( versioncmp($::virtualenv_version,'1.7') > 0 ) and ( $systempkgs == true )) { + $system_pkgs_flag = '--system-site-packages' } else { $system_pkgs_flag = '' } From b044b0b9fa03adb6897a20fdc5adbb56f97856e4 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Mon, 4 Nov 2013 15:39:02 -0500 Subject: [PATCH 057/241] Add system wide default python version to facter --- lib/facter/system_python_version.rb | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 lib/facter/system_python_version.rb diff --git a/lib/facter/system_python_version.rb b/lib/facter/system_python_version.rb new file mode 100644 index 00000000..099104fe --- /dev/null +++ b/lib/facter/system_python_version.rb @@ -0,0 +1,7 @@ +require 'puppet' +pkg = Puppet::Type.type(:package).new(:name => "python") +Facter.add("system_python_version") do + setcode do + /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end +end From 42e0f436f08778374bc44aa6a0b81d6fd48d6f43 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Mon, 4 Nov 2013 16:32:46 -0500 Subject: [PATCH 058/241] Added support for pip installed virtualenv facter --- lib/facter/virtualenv_version.rb | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb index 2ede3f93..327b2ca2 100644 --- a/lib/facter/virtualenv_version.rb +++ b/lib/facter/virtualenv_version.rb @@ -1,7 +1,19 @@ +# Show the virtualenv version +# works with virualenv loaded and without, pip installed and package installed require 'puppet' pkg = Puppet::Type.type(:package).new(:name => "virtualenv") Facter.add("virtualenv_version") do + has_weight 100 setcode do - /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + Facter::Util::Resolution.exec('virtualenv --version') + end +end + +Facter.add("virtualenv_version") do + has_eight 50 + setcode do + if pkg.retrieve[pkg.property(:ensure)] != 'purged' + /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end end end From 669e62ca668255b179d93644101fd4e534f02bcb Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 5 Nov 2013 10:44:38 -0500 Subject: [PATCH 059/241] Improve python version and virtualenv version facts --- lib/facter/system_python_version.rb | 19 +++++++++++++++++++ lib/facter/virtualenv_version.rb | 6 +++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/lib/facter/system_python_version.rb b/lib/facter/system_python_version.rb index 099104fe..6df6ae4a 100644 --- a/lib/facter/system_python_version.rb +++ b/lib/facter/system_python_version.rb @@ -1,7 +1,26 @@ +# Make python versions available as facts +# In lists default python and system python versions require 'puppet' pkg = Puppet::Type.type(:package).new(:name => "python") + Facter.add("system_python_version") do setcode do /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] end end + +Facter.add("python_version") do + has_weight 100 + setcode do + /^.*(\d+\.\d+\.\d+)$/.match(Facter::Util::Resolution.exec('python -V'))[1] + end +end + +Facter.add("python_version") do + has_weight 50 + setcode do + if pkg.retrieve[pkg.property(:ensure)] != 'purged' + /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end + end +end diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb index 327b2ca2..c923b096 100644 --- a/lib/facter/virtualenv_version.rb +++ b/lib/facter/virtualenv_version.rb @@ -1,5 +1,5 @@ -# Show the virtualenv version -# works with virualenv loaded and without, pip installed and package installed +# Make virtualenv version available as a fact +# Works with virualenv loaded and without, pip installed and package installed require 'puppet' pkg = Puppet::Type.type(:package).new(:name => "virtualenv") Facter.add("virtualenv_version") do @@ -10,7 +10,7 @@ end Facter.add("virtualenv_version") do - has_eight 50 + has_weight 50 setcode do if pkg.retrieve[pkg.property(:ensure)] != 'purged' /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] From b4cf920545959bf6cbb5f438b59b2cba6c0ff492 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 5 Nov 2013 11:22:59 -0500 Subject: [PATCH 060/241] Fix facter for versions --- lib/facter/{system_python_version.rb => python_version.rb} | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) rename lib/facter/{system_python_version.rb => python_version.rb} (81%) diff --git a/lib/facter/system_python_version.rb b/lib/facter/python_version.rb similarity index 81% rename from lib/facter/system_python_version.rb rename to lib/facter/python_version.rb index 6df6ae4a..a2bdb267 100644 --- a/lib/facter/system_python_version.rb +++ b/lib/facter/python_version.rb @@ -5,7 +5,9 @@ Facter.add("system_python_version") do setcode do - /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + if pkg.retrieve[pkg.property(:ensure)] != 'purged' + /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end end end From f6709549671caa40be8dd477ec4abb94fab7e36a Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 5 Nov 2013 17:13:40 -0500 Subject: [PATCH 061/241] Add support to install virtualenv from pip --- manifests/init.pp | 3 ++- manifests/install.pp | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 2a9a44c3..cc9336f6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -14,7 +14,8 @@ # Install python-dev. Default: false # # [*virtualenv*] -# Install python-virtualenv. Default: false +# Install python-virtualenv. Default: false, also accepts 'pip' which will +# install latest virtualenv from pip rather than package manager # # [*gunicorn*] # Install Gunicorn. Default: false diff --git a/manifests/install.pp b/manifests/install.pp index 9306e3a3..10331ff8 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -28,9 +28,24 @@ $venv_ensure = $python::virtualenv ? { true => present, default => absent, + pip => absent, } - package { 'python-virtualenv': ensure => $venv_ensure } + case $venv_ensure { + 'pip': { + exec { "pip-virtualenv": + command => "pip install --upgrade virtualenv", + cwd => $cwd, + user => $run_as_user, + timeout => 0, + path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], + require => Package['python-pip'] + } + } + default: { + package { 'python-virtualenv': ensure => $venv_ensure } + } + } $gunicorn_ensure = $python::gunicorn ? { true => present, From ec2b62a53479cbc8dea7adad69904ad1a430cc5d Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 5 Nov 2013 17:31:55 -0500 Subject: [PATCH 062/241] Fix pip bug --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index 10331ff8..cf0f78a5 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -31,7 +31,7 @@ pip => absent, } - case $venv_ensure { + case $python::virtualenv { 'pip': { exec { "pip-virtualenv": command => "pip install --upgrade virtualenv", From 0a97baffaec11215137d49a5e2e7b905f7f681db Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 5 Nov 2013 18:36:27 -0500 Subject: [PATCH 063/241] Fixing up virtualenv pip install --- manifests/install.pp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index cf0f78a5..e90ecfe3 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -28,19 +28,12 @@ $venv_ensure = $python::virtualenv ? { true => present, default => absent, - pip => absent, } - case $python::virtualenv { - 'pip': { - exec { "pip-virtualenv": - command => "pip install --upgrade virtualenv", - cwd => $cwd, - user => $run_as_user, - timeout => 0, - path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], - require => Package['python-pip'] - } + # Install latest from pip if pip is the provider + case $python::provider { + pip: { + package { 'python-virtualenv': ensure => latest, provider => pip } } default: { package { 'python-virtualenv': ensure => $venv_ensure } From c5c61860a5261b0334781fd2875f248d96fc2aff Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 11:53:12 -0500 Subject: [PATCH 064/241] Add provider flag to class parameters --- manifests/init.pp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/manifests/init.pp b/manifests/init.pp index cc9336f6..889d9c64 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -39,7 +39,8 @@ $pip = false, $dev = false, $virtualenv = false, - $gunicorn = false + $gunicorn = false, + $provider = undef, ) { # Module compatibility check From e7997712ce3d4ee520a2a335171d41e79f867176 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 12:19:41 -0500 Subject: [PATCH 065/241] Fix package names for pip --- manifests/install.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/install.pp b/manifests/install.pp index e90ecfe3..ba4ff871 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -33,7 +33,7 @@ # Install latest from pip if pip is the provider case $python::provider { pip: { - package { 'python-virtualenv': ensure => latest, provider => pip } + package { 'virtualenv': ensure => latest, provider => pip } } default: { package { 'python-virtualenv': ensure => $venv_ensure } From 56df14fb57b8583146b72560afa0a83e0ca63ef0 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 12:39:26 -0500 Subject: [PATCH 066/241] Add /usr/local/bin to path for pip installed bins --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 8b707c8a..06c342e8 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -68,7 +68,7 @@ $group = 'root', $proxy = false, $environment = [], - $path = [ '/bin', '/usr/bin', '/usr/sbin' ] + $path = [ '/bin', '/usr/bin', '/usr/sbin','/usr/local/bin' ] ) { $venv_dir = $name From 8a68085f7450f95ca736c690e14b58a0998a13f1 Mon Sep 17 00:00:00 2001 From: Justin Quick Date: Thu, 7 Nov 2013 15:57:10 -0500 Subject: [PATCH 067/241] added cwd parameter, made timeout configurable --- manifests/virtualenv.pp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index bdcfc6f5..8fc17a97 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -66,7 +66,9 @@ $group = 'root', $proxy = false, $environment = [], - $path = [ '/bin', '/usr/bin', '/usr/sbin' ] + $path = [ '/bin', '/usr/bin', '/usr/sbin' ], + $cwd = undef, + $timeout = 1800 ) { $venv_dir = $name @@ -115,10 +117,11 @@ exec { "python_requirements_initial_install_${requirements}_${venv_dir}": command => "${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} -r ${requirements}", refreshonly => true, - timeout => 1800, + timeout => $timeout, user => $owner, subscribe => Exec["python_virtualenv_${venv_dir}"], environment => $environment, + cwd => $cwd } python::requirements { "${requirements}_${venv_dir}": From c45a37b5819d3c0dab423b93cefb31e65bddad9d Mon Sep 17 00:00:00 2001 From: Justin Quick Date: Thu, 7 Nov 2013 16:03:28 -0500 Subject: [PATCH 068/241] docs --- README.md | 4 ++++ manifests/virtualenv.pp | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/README.md b/README.md index e9a2b852..cea0c2d2 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,10 @@ Creates Python virtualenv. **index** - Base URL of Python package index. Default: none +**cwd** - The directory from which to run the "pip install" command. Default: undef + +**timeout** - The maximum time in seconds the "pip install" command should take. Default: 1800 + python::virtualenv { '/var/www/project1': ensure => present, version => 'system', diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 8fc17a97..84861834 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -37,6 +37,12 @@ # [*path*] # Specifies the PATH variable. Default: [ '/bin', '/usr/bin', '/usr/sbin' ] # +# [*cwd*] +# The directory from which to run the "pip install" command. Default: undef +# +# [*timeout*] +# The maximum time in seconds the "pip install" command should take. Default: 1800 +# # === Examples # # python::virtualenv { '/var/www/project1': From 343788fcd8b64f494145c07c41a39c1afd6eafd6 Mon Sep 17 00:00:00 2001 From: Justin Quick Date: Thu, 7 Nov 2013 16:04:30 -0500 Subject: [PATCH 069/241] example docs --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index cea0c2d2..ec30953c 100644 --- a/README.md +++ b/README.md @@ -130,6 +130,8 @@ Creates Python virtualenv. distribute => false, owner => 'appuser', group => 'apps', + cwd => '/var/www/project1', + timeout => 0, } ### python::gunicorn From 2d0f8216ab222a533d05d31331267b180c3aac47 Mon Sep 17 00:00:00 2001 From: Justin Quick Date: Thu, 7 Nov 2013 16:05:12 -0500 Subject: [PATCH 070/241] ws fix --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ec30953c..0bcd9521 100644 --- a/README.md +++ b/README.md @@ -130,8 +130,8 @@ Creates Python virtualenv. distribute => false, owner => 'appuser', group => 'apps', - cwd => '/var/www/project1', - timeout => 0, + cwd => '/var/www/project1', + timeout => 0, } ### python::gunicorn From be335fa2048a60921b0896c770d87a60b53c4aea Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 16:36:28 -0500 Subject: [PATCH 071/241] Add path to pip when executed out of virtualenv --- manifests/pip.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/pip.pp b/manifests/pip.pp index ddbcd6fd..a6faea87 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -84,6 +84,7 @@ unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, + path => [ '/usr/bin', '/usr/local/bin/' ], } } From 52dfd22110ab3fdf83edb11868c53803d9f82b45 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 17:24:53 -0500 Subject: [PATCH 072/241] Fix paths --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index a6faea87..6075c3a8 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -84,7 +84,7 @@ unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, - path => [ '/usr/bin', '/usr/local/bin/' ], + path => [ '/bin', '/usr/bin', '/usr/local/bin/' ], } } From a1fc8ab73c6c34413e2957bea1d3a6719e4612c4 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 18:01:16 -0500 Subject: [PATCH 073/241] Add path to pip install/uninstall --- manifests/pip.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/pip.pp b/manifests/pip.pp index 6075c3a8..f64ea97f 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -94,6 +94,7 @@ onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, + path => [ '/bin', '/usr/bin', '/usr/local/bin/' ], } } } From 99a7bbbf8a0d4db3a2abba9f4a47ac65c223bbaa Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 18:05:06 -0500 Subject: [PATCH 074/241] Fix paths --- manifests/pip.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index f64ea97f..9589b1aa 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -84,7 +84,7 @@ unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, - path => [ '/bin', '/usr/bin', '/usr/local/bin/' ], + path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], } } @@ -94,7 +94,7 @@ onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, - path => [ '/bin', '/usr/bin', '/usr/local/bin/' ], + path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], } } } From 2e3784ba2c93f8240648682ce0b3c14bcb8605a7 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 18:46:52 -0500 Subject: [PATCH 075/241] Added latest support to pip, fixed log param --log-file is not supported in older versions, changed to use --log Added ability to do pip --upgrade by using latest --- lib/facter/pip_version.rb | 19 +++++++++++++++++++ manifests/pip.pp | 11 ++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 lib/facter/pip_version.rb diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb new file mode 100644 index 00000000..48dd0bff --- /dev/null +++ b/lib/facter/pip_version.rb @@ -0,0 +1,19 @@ +# Make pip version available as a fact +# Works with pip loaded and without, pip installed using pip and package installed +require 'puppet' +pkg = Puppet::Type.type(:package).new(:name => "python-pip") +Facter.add("pip_version") do + has_weight 100 + setcode do + Facter::Util::Resolution.exec('pip --version') + end +end + +Facter.add("pip_version") do + has_weight 50 + setcode do + if pkg.retrieve[pkg.property(:ensure)] != 'purged' + /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end + end +end diff --git a/manifests/pip.pp b/manifests/pip.pp index 9589b1aa..0bed6dc6 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -80,7 +80,7 @@ case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env --log-file ${cwd}/pip.log install ${proxy_flag} ${source}", + command => "$pip_env --log ${cwd}/pip.log install ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -88,6 +88,15 @@ } } + latest: { + exec { "pip_install_${name}": + 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"], + } + } + default: { exec { "pip_uninstall_${name}": command => "echo y | $pip_env uninstall ${proxy_flag} ${name}", From 2a6f96857f44c5781733be314b92c0053ba0e9a6 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 19:03:13 -0500 Subject: [PATCH 076/241] Change --log-file to --log for backw. pip compat --- manifests/requirements.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 67906fc8..af847072 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -79,7 +79,7 @@ exec { "python_requirements${name}": provider => shell, - command => "${pip_env} --log-file ${cwd}/pip.log install ${proxy_flag} -r ${requirements}", + command => "${pip_env} --log ${cwd}/pip.log install ${proxy_flag} -r ${requirements}", refreshonly => true, timeout => 1800, user => $owner, From 29bf73bfa6d3e0f6b880bb4c4125edc1b8f0675e Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Fri, 8 Nov 2013 13:28:12 +0200 Subject: [PATCH 077/241] Release 1.1.8 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 890910f3..37a5401f 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.1.7' +version '1.1.8' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 56b98bc177f34fbafa292e8a339fcce3abdd939b Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 8 Nov 2013 11:34:54 -0500 Subject: [PATCH 078/241] Fix system package handling for < v.1.7 --- manifests/virtualenv.pp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 06c342e8..96d48ee2 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -92,8 +92,12 @@ # 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 if (( versioncmp($::virtualenv_version,'1.7') > 0 ) and ( $systempkgs == true )) { $system_pkgs_flag = '--system-site-packages' + } elif (( versioncmp($::virtualenv_version,'1.7') < { 0 ) and ( $systempkgs == false )) + $system_pkgs_flag = '--no-site-packages' } else { $system_pkgs_flag = '' } From 5f38429dbb30a119c8e7e4b646012075c862fa38 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 8 Nov 2013 11:48:06 -0500 Subject: [PATCH 079/241] change elif to elsif --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 96d48ee2..e5397da5 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -96,7 +96,7 @@ # and the flag --no-site-packages had to be passed to do the opposite if (( versioncmp($::virtualenv_version,'1.7') > 0 ) and ( $systempkgs == true )) { $system_pkgs_flag = '--system-site-packages' - } elif (( versioncmp($::virtualenv_version,'1.7') < { 0 ) and ( $systempkgs == false )) + } elsif (( versioncmp($::virtualenv_version,'1.7') < { 0 ) and ( $systempkgs == false )) $system_pkgs_flag = '--no-site-packages' } else { $system_pkgs_flag = '' From df103dd55f719de52b17f059557593bf6e383cb1 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 8 Nov 2013 11:54:07 -0500 Subject: [PATCH 080/241] Fix syntax error --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index e5397da5..282742b9 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -96,7 +96,7 @@ # and the flag --no-site-packages had to be passed to do the opposite if (( versioncmp($::virtualenv_version,'1.7') > 0 ) and ( $systempkgs == true )) { $system_pkgs_flag = '--system-site-packages' - } elsif (( versioncmp($::virtualenv_version,'1.7') < { 0 ) and ( $systempkgs == false )) + } elsif (( versioncmp($::virtualenv_version,'1.7') < { 0 ) and ( $systempkgs == false )) { $system_pkgs_flag = '--no-site-packages' } else { $system_pkgs_flag = '' From 0f83afd92aeea4af35795f881f9eaa408d4082c3 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 8 Nov 2013 11:56:04 -0500 Subject: [PATCH 081/241] Fix more syntax --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 282742b9..95fe1f7a 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -96,7 +96,7 @@ # and the flag --no-site-packages had to be passed to do the opposite if (( versioncmp($::virtualenv_version,'1.7') > 0 ) and ( $systempkgs == true )) { $system_pkgs_flag = '--system-site-packages' - } elsif (( versioncmp($::virtualenv_version,'1.7') < { 0 ) and ( $systempkgs == false )) { + } elsif (( versioncmp($::virtualenv_version,'1.7') < 0 ) and ( $systempkgs == false )) { $system_pkgs_flag = '--no-site-packages' } else { $system_pkgs_flag = '' From 69d2a1447cb3b72fc25ebf19f6f82a35ef4aeb1f Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 8 Nov 2013 18:32:32 -0500 Subject: [PATCH 082/241] Added full pip install support for all packages --- manifests/install.pp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index ba4ff871..8bc1b49c 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -10,8 +10,6 @@ /(?i:Debian|Ubuntu)/ => "${python}-dev" } - package { $python: ensure => present } - $dev_ensure = $python::dev ? { true => present, default => absent, @@ -22,9 +20,6 @@ default => absent, } - package { $pythondev: ensure => $dev_ensure } - package { 'python-pip': ensure => $pip_ensure } - $venv_ensure = $python::virtualenv ? { true => present, default => absent, @@ -33,10 +28,16 @@ # Install latest from pip if pip is the provider case $python::provider { pip: { - package { 'virtualenv': ensure => latest, provider => pip } + package { 'virtualenv': ensure => latest, provider => pip } + package { 'pip': ensure => latest, provider => pip } + package { $pythondev: ensure => latest } + package { "python==${python::version}": ensure => latest, provider => pip } } default: { package { 'python-virtualenv': ensure => $venv_ensure } + package { 'python-pip': ensure => $pip_ensure } + package { $pythondev: ensure => $dev_ensure } + package { $python: ensure => present } } } From 8bf9aac814812d0235ee5aa08e097d6dd03c188d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hubert=20Jagodzi=C5=84ski?= Date: Mon, 18 Nov 2013 08:27:57 +0100 Subject: [PATCH 083/241] Add to python::pip ensure => latest --- README.md | 2 +- manifests/pip.pp | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0bcd9521..751376a5 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ Installs and manages python, python-dev, python-virtualenv and Gunicorn. Installs and manages packages from pip. -**ensure** - present/absent. Default: present +**ensure** - present/latest/absent. Default: present **virtualenv** - virtualenv to run pip in. Default: system (no virtualenv) diff --git a/manifests/pip.pp b/manifests/pip.pp index 3ca33a85..7b51439a 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -95,6 +95,14 @@ } } + latest: { + exec { "pip_install_${name}": + command => "$pip_env --log ${cwd}/pip.log install -U $install_args ${proxy_flag} ${source}", + user => $owner, + environment => $environment, + } + } + default: { exec { "pip_uninstall_${name}": command => "echo y | $pip_env uninstall $uninstall_args ${proxy_flag} ${name}", From 1f79c6c00bafb4afd744a4be74e804f87a09aba8 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Mon, 18 Nov 2013 10:32:11 +0200 Subject: [PATCH 084/241] Release 1.1.9 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 37a5401f..7b21f05c 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.1.8' +version '1.1.9' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 0d5e10790f83b6f2662bb89d34c510bb29f403bc Mon Sep 17 00:00:00 2001 From: John Jacobsen Date: Mon, 18 Nov 2013 17:11:24 -0600 Subject: [PATCH 085/241] Add support for Scientific Linux Fixes #39. Tested manually in a few cases on a Vagrant Scientific Linux 6 VM and seems to work OK so far. --- 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 2a9a44c3..c4e469d1 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -42,7 +42,7 @@ ) { # Module compatibility check - $compatible = [ 'Debian', 'Ubuntu', 'CentOS', 'RedHat' ] + $compatible = [ 'Debian', 'Ubuntu', 'CentOS', 'RedHat', 'Scientific' ] if ! ($::operatingsystem in $compatible) { fail("Module is not compatible with ${::operatingsystem}") } diff --git a/manifests/install.pp b/manifests/install.pp index 9306e3a3..415092e0 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -6,8 +6,8 @@ } $pythondev = $::operatingsystem ? { - /(?i:RedHat|CentOS|Fedora)/ => "${python}-devel", - /(?i:Debian|Ubuntu)/ => "${python}-dev" + /(?i:RedHat|CentOS|Fedora|Scientific)/ => "${python}-devel", + /(?i:Debian|Ubuntu)/ => "${python}-dev" } package { $python: ensure => present } From 725cf0d480b73abd53c8b4d31dc6b3190188ca74 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Tue, 19 Nov 2013 12:11:22 +0200 Subject: [PATCH 086/241] Release 1.2.0 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 7b21f05c..82069d4c 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.1.9' +version '1.2.0' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 04bffc411afb19a572af34d1a2e0f7029f16dfe4 Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Fri, 29 Nov 2013 09:16:31 +1100 Subject: [PATCH 087/241] 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 49e52307..fdd808f8 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -6,18 +6,19 @@ 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 c4e469d1..574573bb 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 415092e0..caead49d 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -32,11 +32,12 @@ 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 } - } From fdf81012ea5f3d8124c86f41d91e4e97f769bc80 Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Fri, 29 Nov 2013 22:23:23 +1100 Subject: [PATCH 088/241] 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 82069d4c..171490cd 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 751376a5..6aa0c986 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 574573bb..74244e1a 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 @@ $dev = false, $virtualenv = false, $gunicorn = false, - $manage_gunicorn = false + $manage_gunicorn = true ) { # Module compatibility check From 4781e59cc6ccf2499100bb1e35f862dc3f3af460 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 6 Dec 2013 15:23:56 -0500 Subject: [PATCH 089/241] Fix deprecation warnings in template --- templates/gunicorn.erb | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/templates/gunicorn.erb b/templates/gunicorn.erb index 1a965315..99481e7b 100644 --- a/templates/gunicorn.erb +++ b/templates/gunicorn.erb @@ -1,36 +1,36 @@ CONFIG = { -<% if mode == 'django' -%> +<% if @mode == 'django' -%> 'mode': 'django', <% else -%> 'mode': 'wsgi', <% end -%> -<% if virtualenv -%> +<% if @virtualenv -%> 'environment': { -<% if environment -%> - 'ENVIRONMENT': '<%= environment %>', +<% if @environment -%> + 'ENVIRONMENT': '<%= @environment %>', <% end -%> - 'PYTHONPATH': '<%= virtualenv %>' + 'PYTHONPATH': '<%= @virtualenv %>' }, <% end -%> - 'working_dir': '<%= dir %>', + 'working_dir': '<%= @dir %>', 'user': 'www-data', 'group': 'www-data', -<% if virtualenv -%> - 'python': '<%= virtualenv %>/bin/python', +<% if @virtualenv -%> + 'python': '<%= @virtualenv %>/bin/python', <% else -%> 'python': '/usr/bin/python', <% end -%> 'args': ( -<% if !virtualenv and !bind -%> - '--bind=unix:/tmp/gunicorn-<%= name %>.socket', -<% elsif virtualenv and !bind -%> - '--bind=unix:<%= virtualenv %>/<%= name %>.socket', +<% if !@virtualenv and !@bind -%> + '--bind=unix:/tmp/gunicorn-<%= @name %>.socket', +<% elsif @virtualenv and !@bind -%> + '--bind=unix:<%= @virtualenv %>/<%= @name %>.socket', <% else -%> - '--bind=<%= bind %>', + '--bind=<%= @bind %>', <% end -%> '--workers=<%= @processorcount.to_i*2 %>', '--timeout=30', -<% if mode != 'django' -%> +<% if @mode != 'django' -%> 'app:app', <% end -%> ), From 4854c78b29be47d7e23c09774a8b017c607998f9 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Fri, 6 Dec 2013 15:27:30 -0500 Subject: [PATCH 090/241] Updated version to 1.2.1 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 82069d4c..5806e9da 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.2.0' +version '1.2.1' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From f7801a4b0d9ae58187891d124c21d269eae19ba5 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 12 Dec 2013 14:00:03 -0500 Subject: [PATCH 091/241] Fix virtualenv, rebuild if not correct env --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 95fe1f7a..1a2b093c 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -114,10 +114,10 @@ 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-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", user => $owner, - creates => "${venv_dir}/bin/activate", 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 } if $requirements { From 37363c422b7525006abafd824493324868a5cd1a Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 13 Dec 2013 16:27:34 -0500 Subject: [PATCH 092/241] Fix syntax error --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 1fb55d65..d8e39158 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -74,7 +74,7 @@ $group = 'root', $proxy = false, $environment = [], - $path = [ '/bin', '/usr/bin', '/usr/sbin','/usr/local/bin' ] + $path = [ '/bin', '/usr/bin', '/usr/sbin','/usr/local/bin' ], $cwd = undef, $timeout = 1800 ) { From 607b527a11657ddd24545ebc33f0c0984d4c0093 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 17 Dec 2013 16:05:05 -0500 Subject: [PATCH 093/241] Pip needs log argument not log-file. --- manifests/requirements.pp | 2 +- manifests/virtualenv.pp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 60c5b6c8..ee44fa48 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -90,7 +90,7 @@ exec { "python_requirements${name}": provider => shell, - command => "${pip_env} --log-file ${cwd}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements}", + command => "${pip_env} --log ${cwd}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements}", refreshonly => true, timeout => 1800, user => $owner, diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index d8e39158..bc7141c1 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -120,7 +120,7 @@ } 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-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", + 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", @@ -130,7 +130,7 @@ if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} -r ${requirements}", + command => "${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} -r ${requirements}", refreshonly => true, timeout => $timeout, user => $owner, From c2a96f8dd40d75c6cf15518010e0a00889df6690 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Wed, 18 Dec 2013 14:20:15 +0300 Subject: [PATCH 094/241] Version 1.3.0 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 5806e9da..171490cd 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' From 071cc312167d3722bff723191fec229a071a03f4 Mon Sep 17 00:00:00 2001 From: Neil Saunders Date: Thu, 19 Dec 2013 17:43:51 +0000 Subject: [PATCH 095/241] 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 ee44fa48..5fa6eb9f 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 @@ $group = 'root', $proxy = false, $src = false, - $environment = [] + $environment = [], + $forceupdate = false, ) { if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { @@ -56,7 +62,7 @@ $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}", + default => $virtualenv, } $pip_env = $virtualenv ? { @@ -91,7 +97,7 @@ 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], From e92b2d2a7e1b20925a71d34dc83cd3bfa760fbf2 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 19 Dec 2013 20:53:01 +0300 Subject: [PATCH 096/241] Version 1.3.1 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 171490cd..c94af433 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' From 535115b9d1426a4d380dc4631fdd2944e0c29e88 Mon Sep 17 00:00:00 2001 From: Neil Saunders Date: Thu, 19 Dec 2013 18:06:25 +0000 Subject: [PATCH 097/241] 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 49e52307..52c10bed 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 @@ pattern => '/usr/bin/gunicorn', } } - -} +} \ No newline at end of file diff --git a/manifests/install.pp b/manifests/install.pp index 0d16659d..bb5f0908 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 bcb79114..ebe549be 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -57,7 +57,7 @@ $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}", + default => $virtualenv, } $pip_env = $virtualenv ? { @@ -88,26 +88,26 @@ 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 @@ 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 ee44fa48..9769b13e 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -56,7 +56,7 @@ $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}", + default => $virtualenv, } $pip_env = $virtualenv ? { diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index bc7141c1..85fc67a2 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -98,7 +98,7 @@ 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 @@ } 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 { From ed1fed8d5cef752603ee469d2a093bd9218488ea Mon Sep 17 00:00:00 2001 From: Felipe Reyes Date: Thu, 26 Dec 2013 16:57:08 -0300 Subject: [PATCH 098/241] 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 13f48720..159afa39 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 @@ $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 99481e7b..10f81faa 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 -%> From 80ee7bcdf5ca4287432da9d2e06c3bb6c1dd8a91 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Mon, 30 Dec 2013 17:52:27 +0300 Subject: [PATCH 099/241] Version 1.4.0 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index c94af433..be196914 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' From 0b4438b64eb2f24f9aff75116cbefb3fc85b5241 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Wed, 1 Jan 2014 12:44:24 -0500 Subject: [PATCH 100/241] Fix path for unless statement. https://github.com/stankevich/puppet-python/issues/46 --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index bc7141c1..f74cc4f4 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -125,7 +125,7 @@ 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]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } if $requirements { From ae04aad7b8fd5f88f6bc379dbabd21000dcb9a85 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 11:36:39 -0500 Subject: [PATCH 101/241] Add flag to disable wheels for python 2.6 Setuptools 0.8 is required for pip wheel support, Python 2.6 and older only support setuptools 0.7, we therefor need to disable wheels. --- manifests/virtualenv.pp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index f74cc4f4..3a7997e4 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -98,7 +98,7 @@ 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 @@ -110,6 +110,14 @@ $system_pkgs_flag = '' } + # Python 2.6 and older don't support setuptools > 0.8 which is required + # for pip wheel support, it therefor requires --no-use-wheel flag + if ( versioncmp($::python_version,'2.6') > 0 ) { + $wheel_support_flag = '--no-use-wheel' + } else { + $wheel_support_flag = '' + } + $distribute_pkg = $distribute ? { true => 'distribute', default => '', @@ -120,7 +128,7 @@ } 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}", + 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} ${wheel_support_flag} --upgrade pip ${distribute_pkg}", user => $owner, path => $path, cwd => "/tmp", @@ -130,7 +138,7 @@ if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} -r ${requirements}", + command => "${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} ${wheel_support_flag} -r ${requirements}", refreshonly => true, timeout => $timeout, user => $owner, From 5dfe3e57489790823928a90363d7ab81500ce5e8 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 12:45:56 -0500 Subject: [PATCH 102/241] Fix wheel flag for pip commands Python 2.6 does not support setuptools < 0.8 which is required for pip wheel support, older versions need to use the --no-use-wheel flag --- manifests/pip.pp | 16 ++++++++++++---- manifests/virtualenv.pp | 2 +- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index bcb79114..ba836584 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -70,6 +70,14 @@ default => "--proxy=${proxy}", } + # Python 2.6 and older don't support setuptools > 0.8 which is required + # for pip wheel support, pip therefor requires --no-use-wheel flag + if ( versioncmp($::python_version,'2.6') > 0 ) { + $wheel_support_flag = '--no-use-wheel' + } else { + $wheel_support_flag = '' + } + $grep_regex = $name ? { /==/ => "^${name}\$", default => "^${name}==", @@ -88,7 +96,7 @@ case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install $install_args ${proxy_flag} ${source}", + command => "$pip_env --log ${cwd}/pip.log install $install_args ${wheel_support_flag} ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -98,7 +106,7 @@ 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 ${wheel_support_flag} ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], @@ -107,7 +115,7 @@ 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 ${wheel_support_flag} ${proxy_flag} ${source}", user => $owner, environment => $environment, } @@ -115,7 +123,7 @@ default: { exec { "pip_uninstall_${name}": - command => "echo y | $pip_env uninstall $uninstall_args ${proxy_flag} ${name}", + command => "echo y | $pip_env uninstall $uninstall_args ${wheel_support_flag} ${proxy_flag} ${name}", onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 3a7997e4..7b4b53c4 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -111,7 +111,7 @@ } # Python 2.6 and older don't support setuptools > 0.8 which is required - # for pip wheel support, it therefor requires --no-use-wheel flag + # for pip wheel support, pip therefor requires --no-use-wheel flag if ( versioncmp($::python_version,'2.6') > 0 ) { $wheel_support_flag = '--no-use-wheel' } else { From 6d88eb88f3ec00655a25f9cb83efd58f293ef4fe Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 15:25:27 -0500 Subject: [PATCH 103/241] Fix wheel support and pip version compatability Fix wheel support and compatability for older pip versions by detecting suppport when running the pip command inside a virtualenv. --- lib/facter/pip_version.rb | 2 +- manifests/pip.pp | 20 ++++++++++---------- manifests/virtualenv.pp | 7 ++++--- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb index 48dd0bff..131d1f94 100644 --- a/lib/facter/pip_version.rb +++ b/lib/facter/pip_version.rb @@ -5,7 +5,7 @@ Facter.add("pip_version") do has_weight 100 setcode do - Facter::Util::Resolution.exec('pip --version') + /^pip (\d+\.\d+\.?\d*).*$/.match(Facter::Util::Resolution.exec('pip --version'))[1] end end diff --git a/manifests/pip.pp b/manifests/pip.pp index ba836584..a818e23f 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -70,13 +70,6 @@ default => "--proxy=${proxy}", } - # Python 2.6 and older don't support setuptools > 0.8 which is required - # for pip wheel support, pip therefor requires --no-use-wheel flag - if ( versioncmp($::python_version,'2.6') > 0 ) { - $wheel_support_flag = '--no-use-wheel' - } else { - $wheel_support_flag = '' - } $grep_regex = $name ? { /==/ => "^${name}\$", @@ -93,10 +86,17 @@ default => "${url}#egg=${egg_name}", } + # Python 2.6 and older don't support setuptools/distribute > 0.8 which is required + # for pip wheel support, pip therefor requires --no-use-wheel flag if the + # pip version is more recent thatn 1.4.1 but using an old python or + # setuputils/distribute version + # To check for this we test for wheel parameter using help and then using + # version, this makes sure we only use wheels if they are supported + case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install $install_args ${wheel_support_flag} ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -106,7 +106,7 @@ latest: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install --upgrade ${wheel_support_flag} ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env x--log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], @@ -115,7 +115,7 @@ latest: { exec { "pip_install_${name}": - command => "$pip_env --log ${cwd}/pip.log install -U $install_args ${wheel_support_flag} ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 7b4b53c4..7b392124 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -110,9 +110,10 @@ $system_pkgs_flag = '' } - # Python 2.6 and older don't support setuptools > 0.8 which is required - # for pip wheel support, pip therefor requires --no-use-wheel flag - if ( versioncmp($::python_version,'2.6') > 0 ) { + # Python 2.6 and older don't support setuptools/distribute > 0.8 which is required + # for pip wheel support, pip therefor requires --no-use-wheel flag if the + # version is newer than 1.4.1 when they added wheels + if (( versioncmp($::python_version,'2.6') > 0 and ( versioncmp($::pip_version,'1.4.1') > 0)) { $wheel_support_flag = '--no-use-wheel' } else { $wheel_support_flag = '' From a49582f22a71baf746ff06c10850a207a99a9750 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 15:32:51 -0500 Subject: [PATCH 104/241] Fix quoting of exec commands to use single quotes --- manifests/pip.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index a818e23f..6c0425e0 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -96,7 +96,7 @@ case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -106,7 +106,7 @@ latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env x--log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env x--log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], @@ -115,7 +115,7 @@ latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag="--no-use-wheel"; $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, } From 784a8bca85023490169bf9663740419caea776a0 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 15:44:44 -0500 Subject: [PATCH 105/241] Fix syntax error in conditional statement --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 7b392124..3e61e1f7 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -113,7 +113,7 @@ # Python 2.6 and older don't support setuptools/distribute > 0.8 which is required # for pip wheel support, pip therefor requires --no-use-wheel flag if the # version is newer than 1.4.1 when they added wheels - if (( versioncmp($::python_version,'2.6') > 0 and ( versioncmp($::pip_version,'1.4.1') > 0)) { + if (( versioncmp($::python_version,'2.6') > 0 ) and ( versioncmp($::pip_version,'1.4.1') > 0)) { $wheel_support_flag = '--no-use-wheel' } else { $wheel_support_flag = '' From 10633ecbde7bd269e0e02d1ae5ba5313bc00c24b Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 15:56:38 -0500 Subject: [PATCH 106/241] Fix handling of wheel support for initial pip --- manifests/pip.pp | 6 +++--- manifests/virtualenv.pp | 18 ++++++++---------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 6c0425e0..5849ca9f 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -86,9 +86,9 @@ default => "${url}#egg=${egg_name}", } - # Python 2.6 and older don't support setuptools/distribute > 0.8 which is required - # for pip wheel support, pip therefor requires --no-use-wheel flag if the - # pip version is more recent thatn 1.4.1 but using an old python or + # Python 2.6 and older does not support setuptools/distribute > 0.8 which + # is required for pip wheel support, pip therefor requires --no-use-wheel flag + # if the # pip version is more recent than 1.4.1 but using an old python or # setuputils/distribute version # To check for this we test for wheel parameter using help and then using # version, this makes sure we only use wheels if they are supported diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 3e61e1f7..94bbd15d 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -110,15 +110,6 @@ $system_pkgs_flag = '' } - # Python 2.6 and older don't support setuptools/distribute > 0.8 which is required - # for pip wheel support, pip therefor requires --no-use-wheel flag if the - # version is newer than 1.4.1 when they added wheels - if (( versioncmp($::python_version,'2.6') > 0 ) and ( versioncmp($::pip_version,'1.4.1') > 0)) { - $wheel_support_flag = '--no-use-wheel' - } else { - $wheel_support_flag = '' - } - $distribute_pkg = $distribute ? { true => 'distribute', default => '', @@ -128,8 +119,15 @@ default => "-i ${index}", } + # Python 2.6 and older does not support setuptools/distribute > 0.8 which + # is required for pip wheel support, pip therefor requires --no-use-wheel flag + # if the # pip version is more recent than 1.4.1 but using an old python or + # setuputils/distribute version + # To check for this we test for wheel parameter using help and then using + # version, this makes sure we only use wheels if they are supported + 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} ${wheel_support_flag} --upgrade pip ${distribute_pkg}", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip $pip_env wheel --help && ${venv_dir}/bin/pip wheel --version || wheel_support_flag='--no-use-wheel'; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", user => $owner, path => $path, cwd => "/tmp", From 44acbef424819e226bec875aabf3db44a06b7015 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 16:01:36 -0500 Subject: [PATCH 107/241] Fix simple typo --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 5849ca9f..5e287f70 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -106,7 +106,7 @@ latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env x--log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], From f2266d7070a3c6f1a07b7746448c647e3bc37b88 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 2 Jan 2014 16:14:57 -0500 Subject: [PATCH 108/241] Fix bash logic false positives --- manifests/pip.pp | 6 +++--- manifests/virtualenv.pp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 5e287f70..5c218c5a 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -96,7 +96,7 @@ case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -106,7 +106,7 @@ latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], @@ -115,7 +115,7 @@ latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && pip wheel --version || wheel_support_flag='--no-use-wheel'; $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 94bbd15d..9c9502d6 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -127,7 +127,7 @@ # version, this makes sure we only use wheels if they are supported exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip $pip_env wheel --help && ${venv_dir}/bin/pip wheel --version || wheel_support_flag='--no-use-wheel'; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip $pip_env wheel --help && (${venv_dir}/bin/pip wheel --version || wheel_support_flag='--no-use-wheel'); ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", user => $owner, path => $path, cwd => "/tmp", From 0e72400bfd33df651c23f2f7c71c3c5cf8bfe815 Mon Sep 17 00:00:00 2001 From: Davide Mendolia Date: Thu, 2 Jan 2014 23:11:52 +0100 Subject: [PATCH 109/241] 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 9fe0420e..54dae457 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -44,8 +44,8 @@ ) { # 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 bb5f0908..dc9bd760 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -20,9 +20,9 @@ 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 ? { From e165f319501eda83ca1e996fa2c4cd06341657f9 Mon Sep 17 00:00:00 2001 From: Davide Mendolia Date: Thu, 2 Jan 2014 23:49:12 +0100 Subject: [PATCH 110/241] 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 54dae457..451bdda3 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -44,7 +44,7 @@ ) { # 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 dc9bd760..b2debcc6 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -21,8 +21,8 @@ } $pythondev = $::osfamily ? { - redhat => "${python}-devel", - debian => "${python}-dev" + RedHat => "${python}-devel", + Debian => "${python}-dev" } $dev_ensure = $python::dev ? { From 1087abd3ba21bcb5b33f7c40f07724c1b9a093eb Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 09:34:04 -0500 Subject: [PATCH 111/241] Further fixes for pip 1.5 and wheel handling --- manifests/pip.pp | 6 +++--- manifests/virtualenv.pp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 5c218c5a..e9ab7cd2 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -96,7 +96,7 @@ case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help > /dev/null 2>&1 && { pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; $pip_env --log ${cwd}/pip.log install $install_args \$wheel_support_flag ${proxy_flag} ${source}", unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -106,7 +106,7 @@ latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help > /dev/null 2>&1&& { pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; $pip_env --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, path => ["/usr/local/bin","/usr/bin","/bin", "/usr/sbin"], @@ -115,7 +115,7 @@ latest: { exec { "pip_install_${name}": - command => "$pip_env wheel --help && (pip wheel --version || wheel_support_flag='--no-use-wheel'); $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", + command => "$pip_env wheel --help > /dev/null 2>&1&& { pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; $pip_env --log ${cwd}/pip.log install -U $install_args \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, environment => $environment, } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 9c9502d6..7a548a6c 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -127,7 +127,7 @@ # version, this makes sure we only use wheels if they are supported exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip $pip_env wheel --help && (${venv_dir}/bin/pip wheel --version || wheel_support_flag='--no-use-wheel'); ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip $pip_env wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", user => $owner, path => $path, cwd => "/tmp", From d8a72b218455de66b59af0229ebae2e708538e77 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 10:09:56 -0500 Subject: [PATCH 112/241] Fix testing for existing virtual environment --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 7a548a6c..f3ca1ced 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -132,7 +132,7 @@ path => $path, cwd => "/tmp", environment => $environment, - unless => "grep '^[ \t]*VIRTUAL_ENV=[\'\"]*/tmp[\"\']*[ \t]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv + unless => "grep '^[ \t]*VIRTUAL_ENV=[\'\"]*${venv_dir}[\"\']*[ \t]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } if $requirements { From 7ae9495652889b69543c57869d181e4b479070b4 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 10:49:25 -0500 Subject: [PATCH 113/241] Fix grep for detecting if virtenv needs rebuild --- manifests/virtualenv.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index f3ca1ced..cee35fc0 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -119,7 +119,7 @@ default => "-i ${index}", } - # Python 2.6 and older does not support setuptools/distribute > 0.8 which + # Python 2.6 and older does not support setuptools/distribute > 0.8 which # is required for pip wheel support, pip therefor requires --no-use-wheel flag # if the # pip version is more recent than 1.4.1 but using an old python or # setuputils/distribute version @@ -132,7 +132,7 @@ path => $path, cwd => "/tmp", environment => $environment, - unless => "grep '^[ \t]*VIRTUAL_ENV=[\'\"]*${venv_dir}[\"\']*[ \t]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv + unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } if $requirements { From 895eebf2a03a29959d0c4dbd613cfa345ac22b55 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 10:53:24 -0500 Subject: [PATCH 114/241] Cleanup for merge request --- manifests/pip.pp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index e9ab7cd2..f71cdcd3 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -70,7 +70,6 @@ default => "--proxy=${proxy}", } - $grep_regex = $name ? { /==/ => "^${name}\$", default => "^${name}==", @@ -123,7 +122,7 @@ default: { exec { "pip_uninstall_${name}": - command => "echo y | $pip_env uninstall $uninstall_args ${wheel_support_flag} ${proxy_flag} ${name}", + command => "echo y | $pip_env uninstall $uninstall_args ${proxy_flag} ${name}", onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, From 223da1caddb69418fc1a6383dbb5ea65c9fcdf90 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 11:45:39 -0500 Subject: [PATCH 115/241] Fix wheel/pip1.5 handing with requirements --- manifests/virtualenv.pp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index a7791417..fc540a8a 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -127,17 +127,17 @@ # version, this makes sure we only use wheels if they are supported exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_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 wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", + user => $owner, + path => $path, + cwd => "/tmp", environment => $environment, - unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv + unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} ${wheel_support_flag} -r ${requirements}", + command => "${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag -r ${requirements}", refreshonly => true, timeout => $timeout, user => $owner, From b5f48bc7cc5861dee404d43eed5a6d327d22c54e Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 3 Jan 2014 13:01:45 -0500 Subject: [PATCH 116/241] Fix working dir for virtualenv creation --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index fc540a8a..7f7fbb43 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -130,7 +130,7 @@ command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", user => $owner, path => $path, - cwd => "/tmp", + cwd => $venv_dir, environment => $environment, unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } From 9d019a6cba04f95a14a8d57fc2510732e9a5b53e Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sat, 4 Jan 2014 10:17:49 +0300 Subject: [PATCH 117/241] Version 1.5.0 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index be196914..3e205cfd 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.4.0' +version '1.5.0' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From e6b4b9417139c97414f940dd4450fce21cf9af24 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 7 Jan 2014 13:20:27 -0500 Subject: [PATCH 118/241] Revert to using /tmp fir for cwd for virte inst. If the virtualenv target directory does not exist before running the virtualenv command the puppet command will fail if the cwd does not exist, hence revert back to using the /tmp directory for current working directory. --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 7f7fbb43..fc540a8a 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -130,7 +130,7 @@ command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", user => $owner, path => $path, - cwd => $venv_dir, + cwd => "/tmp", environment => $environment, unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv } From fae8ae4476142112db877470fe6d374c0e63acc9 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 7 Jan 2014 13:29:00 -0500 Subject: [PATCH 119/241] Silence facter by redirecting python -V stderr --- lib/facter/python_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/facter/python_version.rb b/lib/facter/python_version.rb index a2bdb267..6b88ee96 100644 --- a/lib/facter/python_version.rb +++ b/lib/facter/python_version.rb @@ -14,7 +14,7 @@ Facter.add("python_version") do has_weight 100 setcode do - /^.*(\d+\.\d+\.\d+)$/.match(Facter::Util::Resolution.exec('python -V'))[1] + /^.*(\d+\.\d+\.\d+)$/.match(Facter::Util::Resolution.exec('python -V 2>/dev/null'))[1] end end From 25d7203f8c7c152dcc4ecd75569effebee9ba25a Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 7 Jan 2014 14:25:42 -0500 Subject: [PATCH 120/241] Fix Python version detection, stderr to stdout --- lib/facter/python_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/facter/python_version.rb b/lib/facter/python_version.rb index 6b88ee96..50fef723 100644 --- a/lib/facter/python_version.rb +++ b/lib/facter/python_version.rb @@ -14,7 +14,7 @@ Facter.add("python_version") do has_weight 100 setcode do - /^.*(\d+\.\d+\.\d+)$/.match(Facter::Util::Resolution.exec('python -V 2>/dev/null'))[1] + /^.*(\d+\.\d+\.\d+)$/.match(Facter::Util::Resolution.exec('python -V 2>&1'))[1] end end From 743c57790affea2694f2553ff66920ef543411ac Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Wed, 8 Jan 2014 03:36:15 +0200 Subject: [PATCH 121/241] Version 1.6.1 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 4f2424b2..048c5cd2 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.6.0' +version '1.6.1' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From cfcc3781d49239834d7bb91e7c2ec3c08c982a13 Mon Sep 17 00:00:00 2001 From: Franz Pletz Date: Tue, 14 Jan 2014 15:25:38 +0100 Subject: [PATCH 122/241] Wheel support in pip needs current setuptools When virtualenvs are used without distribute and an old setuptools python package is installed in the system, upgrading pip in the virtualenv won't ensure setuptools > 0.8 is installed which is required by the pip wheel command. This patch upgrades setuptools if distribute isn't used. Signed-off-by: Franz Pletz --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index fc540a8a..a7a2bcb2 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -112,7 +112,7 @@ $distribute_pkg = $distribute ? { true => 'distribute', - default => '', + default => 'setuptools', } $pypi_index = $index ? { false => '', From 94f907ef6c0979ae72b8614e88640609baf74de8 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Tue, 14 Jan 2014 09:37:17 -0500 Subject: [PATCH 123/241] Version 1.6.2 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 048c5cd2..1cd9de18 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.6.1' +version '1.6.2' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 05fc36b8d6f0a9eaeedd72a9dbbbe899aeeed8e2 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 14 Jan 2014 17:02:38 -0500 Subject: [PATCH 124/241] Update documentation for python pip --- manifests/pip.pp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index fb73ae74..367cdb3f 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -85,12 +85,20 @@ default => "${url}#egg=${egg_name}", } - # Python 2.6 and older does not support setuptools/distribute > 0.8 which - # is required for pip wheel support, pip therefor requires --no-use-wheel flag - # if the # pip version is more recent than 1.4.1 but using an old python or - # setuputils/distribute version + # We need to jump through hoops to make sure we issue the correct pip command + # depending on wheel support and versions. + # + # Pip does not support wheels prior to version 1.4.0 + # Pip wheels require setuptools/distribute > 0.8 + # Python 2.6 and older does not support setuptools/distribute > 0.8 + # Pip >= 1.5 tries to use wheels by default, even if wheel package is not + # installed, in this case the --no-use-wheel flag needs to be passed + # Versions prior to 1.5 don't support the --no-use-wheel flag + # # To check for this we test for wheel parameter using help and then using - # version, this makes sure we only use wheels if they are supported + # version, this makes sure we only use wheels if they are supported and + # installed + case $ensure { present: { From 4a0ad14203420a9d05db336bd48940dcd61876a6 Mon Sep 17 00:00:00 2001 From: Steffen Zieger Date: Thu, 16 Jan 2014 01:17:34 +0100 Subject: [PATCH 125/241] Add path to requirements exec --- manifests/requirements.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 5fa6eb9f..11c5f002 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -102,6 +102,7 @@ user => $owner, subscribe => File[$requirements], environment => $environment, + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], } } From dba29a61bda4ab44ec8c42a43583d0e51f3806d9 Mon Sep 17 00:00:00 2001 From: Steffen Zieger Date: Thu, 16 Jan 2014 01:19:41 +0100 Subject: [PATCH 126/241] remove duplicate pip_install exec for latest case --- manifests/pip.pp | 8 -------- 1 file changed, 8 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index fb73ae74..4aacb317 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -112,14 +112,6 @@ } } - latest: { - exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install -U ${install_args} \$wheel_support_flag ${proxy_flag} ${source}", - user => $owner, - environment => $environment, - } - } - default: { exec { "pip_uninstall_${name}": command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}", From 6e9f26a2e0ac360701876cb9cbac09efc2eeab75 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 16 Jan 2014 10:32:30 -0500 Subject: [PATCH 127/241] Fix pip 1.5/1.4.1 handling --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index fc540a8a..fa2e6546 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -127,7 +127,7 @@ # version, this makes sure we only use wheels if they are supported exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg}", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg} || ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg} }", user => $owner, path => $path, cwd => "/tmp", From ad2a8ba8081ee05a5b2abfb8eb813e8c6f103826 Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Mon, 20 Jan 2014 14:30:49 +0100 Subject: [PATCH 128/241] Drop stderr in pip --version --- lib/facter/pip_version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb index 131d1f94..bc725db1 100644 --- a/lib/facter/pip_version.rb +++ b/lib/facter/pip_version.rb @@ -5,7 +5,7 @@ Facter.add("pip_version") do has_weight 100 setcode do - /^pip (\d+\.\d+\.?\d*).*$/.match(Facter::Util::Resolution.exec('pip --version'))[1] + /^pip (\d+\.\d+\.?\d*).*$/.match(Facter::Util::Resolution.exec('pip --version 2>/dev/null'))[1] end end From 97793765ee15a93fbde928aaf17397d0c397fa69 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Mon, 20 Jan 2014 13:49:41 -0500 Subject: [PATCH 129/241] Fix syntax error with brace prioritization --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index fa2e6546..8c240ed2 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -127,7 +127,7 @@ # version, this makes sure we only use wheels if they are supported exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg} || ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg} }", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg} || ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg} ;}", user => $owner, path => $path, cwd => "/tmp", From 2bb37cdbc62868f11de93c93853eea03bda513fd Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sun, 2 Feb 2014 11:52:51 +0300 Subject: [PATCH 130/241] Version 1.6.3 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 1cd9de18..15e2fff4 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.6.2' +version '1.6.3' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From cc60884faa51751a7c2f07d94bec192fb57b76b3 Mon Sep 17 00:00:00 2001 From: Steve Huff Date: Wed, 26 Feb 2014 12:04:54 -0500 Subject: [PATCH 131/241] prevent Facter error when packages not installed on RHEL systems, `pkg.retrieve[pkg.property(:ensure)]` returns `:absent` when a package is not installed; this can generate an unsightly error when running these facts on a RHEL system where the necessary OS packages are not installed: [root@gepeto ~]# facter -p osfamily RedHat [root@gepeto ~]# facter -p lsbmajdistrelease 5 [root@gepeto ~]# grep version /etc/puppet/modules/python/Modulefile version '1.6.3' [root@gepeto ~]# facter -p virtualenv_version pip_version Could not retrieve virtualenv_version: can't convert Symbol into String Could not retrieve pip_version: undefined method `[]' for nil:NilClass Could not retrieve pip_version: can't convert Symbol into String pip_version => virtualenv_version => Fixes #50 --- lib/facter/pip_version.rb | 2 +- lib/facter/python_version.rb | 4 ++-- lib/facter/virtualenv_version.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb index bc725db1..46c50d94 100644 --- a/lib/facter/pip_version.rb +++ b/lib/facter/pip_version.rb @@ -12,7 +12,7 @@ Facter.add("pip_version") do has_weight 50 setcode do - if pkg.retrieve[pkg.property(:ensure)] != 'purged' + unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] end end diff --git a/lib/facter/python_version.rb b/lib/facter/python_version.rb index 50fef723..919fd89e 100644 --- a/lib/facter/python_version.rb +++ b/lib/facter/python_version.rb @@ -5,7 +5,7 @@ Facter.add("system_python_version") do setcode do - if pkg.retrieve[pkg.property(:ensure)] != 'purged' + unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] end end @@ -21,7 +21,7 @@ Facter.add("python_version") do has_weight 50 setcode do - if pkg.retrieve[pkg.property(:ensure)] != 'purged' + unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] end end diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb index c923b096..9a3b4b07 100644 --- a/lib/facter/virtualenv_version.rb +++ b/lib/facter/virtualenv_version.rb @@ -12,7 +12,7 @@ Facter.add("virtualenv_version") do has_weight 50 setcode do - if pkg.retrieve[pkg.property(:ensure)] != 'purged' + unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] end end From a29284170a6687669b00fbc574f1bdc5f9e5b404 Mon Sep 17 00:00:00 2001 From: Matt Callaway Date: Tue, 4 Mar 2014 15:14:08 -0600 Subject: [PATCH 132/241] Add begin/rescue/end to setcode block This silences these warnings: Could not retrieve pip_version: undefined method `[]' for nil:NilClass Could not retrieve pip_version: can't convert Symbol into String --- lib/facter/pip_version.rb | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/facter/pip_version.rb b/lib/facter/pip_version.rb index 46c50d94..ce32f989 100644 --- a/lib/facter/pip_version.rb +++ b/lib/facter/pip_version.rb @@ -5,15 +5,23 @@ Facter.add("pip_version") do has_weight 100 setcode do - /^pip (\d+\.\d+\.?\d*).*$/.match(Facter::Util::Resolution.exec('pip --version 2>/dev/null'))[1] + begin + /^pip (\d+\.\d+\.?\d*).*$/.match(Facter::Util::Resolution.exec('pip --version 2>/dev/null'))[1] + rescue + false + end end end Facter.add("pip_version") do has_weight 50 setcode do - unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) - /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + begin + unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) + /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end + rescue + false end end end From c47678748b39c0d7b524e6cfb4b3aab2e8811c6b Mon Sep 17 00:00:00 2001 From: Matt Callaway Date: Tue, 4 Mar 2014 15:17:07 -0600 Subject: [PATCH 133/241] Add begin/rescue/end to setcode block This silences these warnings: Could not retrieve pip_version: undefined method `[]' for nil:NilClass Could not retrieve pip_version: can't convert Symbol into String --- lib/facter/python_version.rb | 22 +++++++++++++++++----- lib/facter/virtualenv_version.rb | 14 +++++++++++--- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/lib/facter/python_version.rb b/lib/facter/python_version.rb index 919fd89e..bb9ec980 100644 --- a/lib/facter/python_version.rb +++ b/lib/facter/python_version.rb @@ -5,8 +5,12 @@ Facter.add("system_python_version") do setcode do - unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) - /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + begin + unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) + /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end + rescue + false end end end @@ -14,15 +18,23 @@ Facter.add("python_version") do has_weight 100 setcode do - /^.*(\d+\.\d+\.\d+)$/.match(Facter::Util::Resolution.exec('python -V 2>&1'))[1] + begin + /^.*(\d+\.\d+\.\d+)$/.match(Facter::Util::Resolution.exec('python -V 2>&1'))[1] + rescue + false + end end end Facter.add("python_version") do has_weight 50 setcode do - unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) - /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + begin + unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) + /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end + rescue + false end end end diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb index 9a3b4b07..04736ed7 100644 --- a/lib/facter/virtualenv_version.rb +++ b/lib/facter/virtualenv_version.rb @@ -5,15 +5,23 @@ Facter.add("virtualenv_version") do has_weight 100 setcode do - Facter::Util::Resolution.exec('virtualenv --version') + begin + Facter::Util::Resolution.exec('virtualenv --version') + rescue + false + end end end Facter.add("virtualenv_version") do has_weight 50 setcode do - unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) - /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + begin + unless [:absent,'purged'].include?(pkg.retrieve[pkg.property(:ensure)]) + /^.*(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end + rescue + false end end end From 661c14e22109ccbe1d9da695b8eb05031b1e4d72 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 6 Mar 2014 08:18:00 -0500 Subject: [PATCH 134/241] Release 1.6.4 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 15e2fff4..432c8cb3 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.6.3' +version '1.6.4' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From c298a80bc32e3dda2e6b0d1deb839cc2831f646e Mon Sep 17 00:00:00 2001 From: Marcin Zaremba Date: Thu, 6 Mar 2014 15:33:02 +0100 Subject: [PATCH 135/241] adds external pkgname variable --- manifests/pip.pp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 4f91e593..7e332fe0 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -4,6 +4,12 @@ # # === Parameters # +# [*name] +# must be unique +# +# [*pkgname] +# name of the package. +# # [*ensure*] # present|absent. Default: present # @@ -35,6 +41,7 @@ # Fotis Gimian # define python::pip ( + $pkgname = undef, $ensure = present, $virtualenv = 'system', $url = false, @@ -70,18 +77,18 @@ default => "--proxy=${proxy}", } - $grep_regex = $name ? { - /==/ => "^${name}\$", - default => "^${name}==", + $grep_regex = $pkgname ? { + /==/ => "^${pkgname}\$", + default => "^${pkgname}==", } $egg_name = $egg ? { - false => $name, + false => $pkgname, default => $egg } $source = $url ? { - false => $name, + false => $pkgname, default => "${url}#egg=${egg_name}", } @@ -122,7 +129,7 @@ default: { exec { "pip_uninstall_${name}": - command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}", + command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${pkgname}", onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, From 86c142afac34dde4a6d738fd27f94ffbd4ad762b Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 6 Mar 2014 09:38:54 -0500 Subject: [PATCH 136/241] Release 1.6.5 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 432c8cb3..4e41df0a 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.6.4' +version '1.6.5' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 2dde12a6bb58d84eff90fb13e120303ac61f8f49 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 6 Mar 2014 09:40:15 -0500 Subject: [PATCH 137/241] Release 1.6.6 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 4e41df0a..7ba4da7e 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.6.5' +version '1.6.6' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 4859c8968d41380a094c911c7d2db8aad234b480 Mon Sep 17 00:00:00 2001 From: Ezekiel Smithburg Date: Fri, 14 Mar 2014 16:21:37 -0700 Subject: [PATCH 138/241] Document newly required pkgname option for pip. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 6aa0c986..444b3b7b 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ Installs and manages python, python-dev, python-virtualenv and Gunicorn. Installs and manages packages from pip. +**pkgname** - the name of the package to install. Required. + **ensure** - present/latest/absent. Default: present **virtualenv** - virtualenv to run pip in. Default: system (no virtualenv) @@ -69,6 +71,7 @@ Installs and manages packages from pip. **uninstall_args** - Array of additional flags to pass to pip during uninstall. Default: none python::pip { 'cx_Oracle': + pkgname => 'cx_Oracle', virtualenv => '/var/www/project1', owner => 'appuser', proxy => 'http://proxy.domain.com:3128', From 066a10ea68c340773a94d19769ff77c02c39f128 Mon Sep 17 00:00:00 2001 From: Nathan Sullivan Date: Tue, 18 Mar 2014 13:15:32 +1000 Subject: [PATCH 139/241] add support for explicit version handling with ensure parameter for pip packages --- manifests/pip.pp | 38 ++++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 7e332fe0..cbd2ed8e 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -77,18 +77,29 @@ default => "--proxy=${proxy}", } - $grep_regex = $pkgname ? { - /==/ => "^${pkgname}\$", - default => "^${pkgname}==", + # If pkgname is not specified, use name (title) instead. + $use_pkgname = $pkgname ? { + undef => $name, + default => $pkgname + } + + # Check if searching by explicit version. + if $ensure =~ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.[0-9]+(\.[0-9]+)?)$/ { + $grep_regex = "^${use_pkgname}==${ensure}\$" + } else { + $grep_regex = $use_pkgname ? { + /==/ => "^${use_pkgname}\$", + default => "^${use_pkgname}==", + } } $egg_name = $egg ? { - false => $pkgname, + false => $use_pkgname, default => $egg } $source = $url ? { - false => $pkgname, + false => $use_pkgname, default => "${url}#egg=${egg_name}", } @@ -108,7 +119,20 @@ case $ensure { + /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.[0-9]+(\.[0-9]+)?)$/: { + # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes + # Explicit version. + exec { "pip_install_${name}": + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${source}==${ensure}", + unless => "${pip_env} freeze | grep -i -e ${grep_regex}", + user => $owner, + environment => $environment, + path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], + } + } + present: { + # Whatever version is available. exec { "pip_install_${name}": command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${source}", unless => "${pip_env} freeze | grep -i -e ${grep_regex}", @@ -119,6 +143,7 @@ } latest: { + # Latest version. exec { "pip_install_${name}": command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", user => $owner, @@ -128,8 +153,9 @@ } default: { + # Anti-action, uninstall. exec { "pip_uninstall_${name}": - command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${pkgname}", + command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${use_pkgname}", onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, From 0ce45d0b9a82bba68c4fd19c3b95551ede848dfc Mon Sep 17 00:00:00 2001 From: Giacomo Vacca Date: Tue, 18 Mar 2014 11:14:29 +0000 Subject: [PATCH 140/241] Don't try to reinstall pip packages on every Puppet run #59; Even if ensure latest, do not install if already latest --- manifests/pip.pp | 1 + 1 file changed, 1 insertion(+) diff --git a/manifests/pip.pp b/manifests/pip.pp index 7e332fe0..47e9732e 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -121,6 +121,7 @@ latest: { exec { "pip_install_${name}": command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", + unless => "${pip_env} search ${source} | grep -i INSTALLED | grep -i latest", user => $owner, environment => $environment, path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], From f3dc9dd4fe59c06dd32b4951d0e796ea0b37fa49 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Tue, 18 Mar 2014 08:38:33 -0400 Subject: [PATCH 141/241] Release 1.7.0 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 7ba4da7e..3aa9846b 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.6.6' +version '1.7.0' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 846844259b042a8ce3444e21aed880be299760ef Mon Sep 17 00:00:00 2001 From: Robert Deaton Date: Tue, 25 Mar 2014 12:32:55 -0700 Subject: [PATCH 142/241] Add pypy support --- manifests/install.pp | 1 + manifests/virtualenv.pp | 1 + 2 files changed, 2 insertions(+) diff --git a/manifests/install.pp b/manifests/install.pp index c4914f70..1c2cb0ba 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -17,6 +17,7 @@ $python = $python::version ? { 'system' => 'python', + 'pypy' => 'pypy', default => "python${python::version}", } diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index b9cd689b..2faa8097 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -85,6 +85,7 @@ $python = $version ? { 'system' => 'python', + 'pypy' => 'pypy', default => "python${version}", } From d9adcb640e078b43d41d2940c07f68c6cc83de92 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Tue, 25 Mar 2014 16:54:00 -0400 Subject: [PATCH 143/241] Release 1.7.1 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 3aa9846b..ac982786 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.7.0' +version '1.7.1' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 7c7afae3abdb0924fdc362a42ad3cd60644b910e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Sun, 6 Apr 2014 12:40:46 +0200 Subject: [PATCH 144/241] simplify pkgname default rather than having a rather ugly if and an unhandy case new variable, we can simplify this by making the default $name, in the parameter list. --- manifests/pip.pp | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index bf987a4a..0c789033 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -8,7 +8,7 @@ # must be unique # # [*pkgname] -# name of the package. +# name of the package. If pkgname is not specified, use name (title) instead. # # [*ensure*] # present|absent. Default: present @@ -41,7 +41,7 @@ # Fotis Gimian # define python::pip ( - $pkgname = undef, + $pkgname = $name, $ensure = present, $virtualenv = 'system', $url = false, @@ -77,29 +77,23 @@ default => "--proxy=${proxy}", } - # If pkgname is not specified, use name (title) instead. - $use_pkgname = $pkgname ? { - undef => $name, - default => $pkgname - } - # Check if searching by explicit version. if $ensure =~ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.[0-9]+(\.[0-9]+)?)$/ { - $grep_regex = "^${use_pkgname}==${ensure}\$" + $grep_regex = "^${pkgname}==${ensure}\$" } else { - $grep_regex = $use_pkgname ? { - /==/ => "^${use_pkgname}\$", - default => "^${use_pkgname}==", + $grep_regex = $pkgname ? { + /==/ => "^${pkgname}\$", + default => "^${pkgname}==", } } $egg_name = $egg ? { - false => $use_pkgname, + false => $pkgname, default => $egg } $source = $url ? { - false => $use_pkgname, + false => $pkgname, default => "${url}#egg=${egg_name}", } From 750d3538929316df9e18481a01acc0c7dc4de2dd Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 8 Apr 2014 13:45:09 +0100 Subject: [PATCH 145/241] Made venv_dir into a paramater to the virtualenv type --- manifests/virtualenv.pp | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index bdcfc6f5..d18fbdf4 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -16,6 +16,9 @@ # [*systempkgs*] # Copy system site-packages into virtualenv. Default: don't # +# [*venv_dir*] +# Directory to install virtualenv to. Default: $name +# # [*distribute*] # Include distribute in the virtualenv. Default: true # @@ -56,21 +59,20 @@ # Fotis Gimian # define python::virtualenv ( - $ensure = present, - $version = 'system', - $requirements = false, - $systempkgs = false, - $distribute = true, - $index = false, - $owner = 'root', - $group = 'root', - $proxy = false, - $environment = [], - $path = [ '/bin', '/usr/bin', '/usr/sbin' ] + $ensure = present, + $version = 'system', + $requirements = false, + $systempkgs = false, + $venv_dir = $name, + $distribute = true, + $index = false, + $owner = 'root', + $group = 'root', + $proxy = false, + $environment = [], + $path = [ '/bin', '/usr/bin', '/usr/sbin' ] ) { - $venv_dir = $name - if $ensure == 'present' { $python = $version ? { From 9c1bc0825f3ebbe8473d3691bdc8c18f31fae12b Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 8 Apr 2014 13:45:33 +0100 Subject: [PATCH 146/241] Fixed various linting issues --- manifests/pip.pp | 10 +++++----- manifests/requirements.pp | 2 +- manifests/virtualenv.pp | 10 +++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 8bd21d38..98b6facb 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -57,7 +57,7 @@ $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}", + default => $virtualenv, } $pip_env = $virtualenv ? { @@ -88,8 +88,8 @@ case $ensure { present: { exec { "pip_install_${name}": - command => "$pip_env --log-file ${cwd}/pip.log install $install_args ${proxy_flag} ${source}", - unless => "$pip_env freeze | grep -i -e ${grep_regex}", + command => "${pip_env} --log-file ${cwd}/pip.log install ${install_args} ${proxy_flag} ${source}", + unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, } @@ -97,8 +97,8 @@ 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, } diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 60c5b6c8..010a1996 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -56,7 +56,7 @@ $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}", + default => $virtualenv, } $pip_env = $virtualenv ? { diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index d18fbdf4..ebc75bea 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -105,11 +105,11 @@ } 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-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", - user => $owner, - creates => "${venv_dir}/bin/activate", - path => $path, - cwd => "/tmp", + command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip --log-file ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg}", + user => $owner, + creates => "${venv_dir}/bin/activate", + path => $path, + cwd => '/tmp', environment => $environment, } From 275cd8672ac5a0144f4d96ba39f0db6705786fc4 Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 8 Apr 2014 14:06:26 +0100 Subject: [PATCH 147/241] Bump module version --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 6bfbe7a4..af82867a 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'puppet-python' -version '1.1.4' +version '1.1.5' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From c3aa0cf84cdbc5ddb85de5d3fc9c2636d1eb633f Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 8 Apr 2014 15:01:59 +0100 Subject: [PATCH 148/241] Fixed a typo following the upstream merge --- manifests/virtualenv.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index a88042b5..419e2ae9 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -76,9 +76,9 @@ $group = 'root', $proxy = false, $environment = [], - $path = [ '/bin', '/usr/bin', '/usr/sbin' ] - $cwd = undef, - $timeout = 1800 + $path = [ '/bin', '/usr/bin', '/usr/sbin' ], + $cwd = undef, + $timeout = 1800 ) { if $ensure == 'present' { From 327351578a151bf9cf30f746075bb653b77ba57c Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Tue, 8 Apr 2014 10:14:30 -0400 Subject: [PATCH 149/241] Release 1.7.2 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index ac982786..463d5b51 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.7.1' +version '1.7.2' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From b5c629e482897e5acb2d085b3b23f788faac6dce Mon Sep 17 00:00:00 2001 From: Ali Asad Lotia Date: Thu, 24 Apr 2014 10:38:28 +0100 Subject: [PATCH 150/241] Ignore rbenv files --- .gitignore | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b2bcbe85..b468fdc5 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,5 @@ -pkg/ \ No newline at end of file +pkg/ + +# ignore rbvenv files used for puppet-lint, rspect etc. +.ruby-version +.rbenv-gemsets From d0d3e37f2bc4c0c4473e2cb586c61e3d3359637c Mon Sep 17 00:00:00 2001 From: Ali Asad Lotia Date: Thu, 24 Apr 2014 13:21:52 +0100 Subject: [PATCH 151/241] Add editable flag. Check passed arguments. --- manifests/pip.pp | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 0c789033..637960b2 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -25,9 +25,20 @@ # [*proxy*] # Proxy server to use for outbound connections. Default: none # +# [*editable*] +# Boolean. If true the package is installed as an editable resource. +# # [*environment*] # Additional environment variables required to install the packages. Default: none # +# [*install_args*] +# String. Any additional installation arguments that will be supplied +# when running pip install. +# +# [*uninstall args*] +# String. Any additional arguments that will be supplied when running +# pip uninstall. +# # === Examples # # python::pip { 'flask': @@ -48,6 +59,7 @@ $owner = 'root', $proxy = false, $egg = false, + $editable = false, $environment = [], $install_args = '', $uninstall_args = '', @@ -77,6 +89,22 @@ default => "--proxy=${proxy}", } + if $editable == true { + $install_editable = ' -e ' + } + else { + $install_editable = '' + } + + #TODO: Do more robust argument checking, but below is a start + if ($ensure == absent) and ($install_args != '') { + fail('python::pip cannot provide install_args with ensure => absent') + } + + if $(ensure == present) and ($uninstall_args != '') { + fail('python::pip cannot provide uninstall_args with ensure => present') + } + # Check if searching by explicit version. if $ensure =~ /^((19|20)[0-9][0-9]-(0[1-9]|1[1-2])-([0-2][1-9]|3[0-1])|[0-9]+\.[0-9]+(\.[0-9]+)?)$/ { $grep_regex = "^${pkgname}==${ensure}\$" @@ -117,7 +145,7 @@ # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes # Explicit version. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${source}==${ensure}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure}", unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -128,7 +156,7 @@ present: { # Whatever version is available. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${source}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source}", unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -139,7 +167,7 @@ latest: { # Latest version. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${source}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${uninstall_args} ${install_editable} ${source}", unless => "${pip_env} search ${source} | grep -i INSTALLED | grep -i latest", user => $owner, environment => $environment, From e1e3f8aedb0ac8f4f2fe5d173ded6b79558753ef Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 24 Apr 2014 08:33:14 -0400 Subject: [PATCH 152/241] Release 1.7.3 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 463d5b51..bb68a81f 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.7.2' +version '1.7.3' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 8268d348d7c4653a3120345e8796e9a888f5d613 Mon Sep 17 00:00:00 2001 From: Luca Invernizzi Date: Thu, 24 Apr 2014 13:15:47 -0700 Subject: [PATCH 153/241] Fixed $(ensure typo in pip.pp --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 637960b2..a0c0eb45 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -101,7 +101,7 @@ fail('python::pip cannot provide install_args with ensure => absent') } - if $(ensure == present) and ($uninstall_args != '') { + if ($ensure == present) and ($uninstall_args != '') { fail('python::pip cannot provide uninstall_args with ensure => present') } From 33e6b54cca73c7717b9965a083b9154dd7441b36 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 24 Apr 2014 16:16:38 -0400 Subject: [PATCH 154/241] Release 1.7.4 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index bb68a81f..876b7d5e 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.7.3' +version '1.7.4' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 95747cdbb5e5e7378fd2a8f74a01f0d44bf90e74 Mon Sep 17 00:00:00 2001 From: Steven Pecht Date: Wed, 7 May 2014 14:18:26 -0400 Subject: [PATCH 155/241] Added timeout option to python::pip The default timeout is set to 1800. The same default as virtual environement installations. A timeout parameter is needed for long running installs such as SciPy. --- README.md | 3 +++ manifests/pip.pp | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 444b3b7b..3632cd83 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,8 @@ Installs and manages packages from pip. **uninstall_args** - Array of additional flags to pass to pip during uninstall. Default: none +**timeout** - Timeout for the pip install command. Defaults to 1800. + python::pip { 'cx_Oracle': pkgname => 'cx_Oracle', virtualenv => '/var/www/project1', @@ -77,6 +79,7 @@ Installs and manages packages from pip. proxy => 'http://proxy.domain.com:3128', environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', install_args => ['-e'], + timeout => 1800, } ### python::requirements diff --git a/manifests/pip.pp b/manifests/pip.pp index a0c0eb45..2cb5bd54 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -31,6 +31,9 @@ # [*environment*] # Additional environment variables required to install the packages. Default: none # +# [*timeout*] +# The maximum time in seconds the "pip install" command should take. Default: 1800 +# # [*install_args*] # String. Any additional installation arguments that will be supplied # when running pip install. @@ -63,6 +66,7 @@ $environment = [], $install_args = '', $uninstall_args = '', + $timeout = 1800, ) { # Parameter validation @@ -150,6 +154,7 @@ user => $owner, environment => $environment, path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], + timeout => $timeout, } } @@ -161,6 +166,7 @@ user => $owner, environment => $environment, path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], + timeout => $timeout, } } @@ -172,6 +178,7 @@ user => $owner, environment => $environment, path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], + timeout => $timeout, } } @@ -183,6 +190,7 @@ user => $owner, environment => $environment, path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], + timeout => $timeout, } } } From 79b045cc90687feab374840c4448c4484931e3da Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Wed, 7 May 2014 14:29:05 -0400 Subject: [PATCH 156/241] Release 1.7.5 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 876b7d5e..0f4a5c63 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.7.4' +version '1.7.5' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 4b06f6e9a88e8fab01de377875ba78e442827b77 Mon Sep 17 00:00:00 2001 From: kracekumar Date: Wed, 21 May 2014 00:32:00 +0530 Subject: [PATCH 157/241] Fixed several spelling mistake --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3632cd83..449c74f4 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn 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 everal 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: From 73cfe738d9ff08a18e596f6e1c7e79ff6b972391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Gali=C4=87?= Date: Fri, 30 May 2014 15:54:16 +0200 Subject: [PATCH 158/241] introduce puppet syntax hilighting we also normalize tabs to spaces --- README.md | 97 ++++++++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 449c74f4..3ac97159 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Currently, the changes you need to make are as follows: ## Installation -``` bash +``` shell cd /etc/puppet/modules git clone git://github.com/stankevich/puppet-python.git python ``` @@ -39,12 +39,14 @@ Installs and manages python, python-dev, python-virtualenv and Gunicorn. **manage_gunicorn** - Allow Installation / Removal of Gunicorn. Default: true - class { 'python': - version => 'system', - dev => true, - virtualenv => true, - gunicorn => true, - } +```puppet + class { 'python': + version => 'system', + dev => true, + virtualenv => true, + gunicorn => true, + } } +``` ### python::pip @@ -71,16 +73,17 @@ Installs and manages packages from pip. **uninstall_args** - Array of additional flags to pass to pip during uninstall. Default: none **timeout** - Timeout for the pip install command. Defaults to 1800. - - python::pip { 'cx_Oracle': - pkgname => 'cx_Oracle', - virtualenv => '/var/www/project1', - owner => 'appuser', - proxy => 'http://proxy.domain.com:3128', - environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', - install_args => ['-e'], - timeout => 1800, - } +```puppet + python::pip { 'cx_Oracle': + pkgname => 'cx_Oracle', + virtualenv => '/var/www/project1', + owner => 'appuser', + proxy => 'http://proxy.domain.com:3128', + environment => 'ORACLE_HOME=/usr/lib/oracle/11.2/client64', + install_args => ['-e'], + timeout => 1800, + } +``` ### python::requirements @@ -96,12 +99,14 @@ Installs and manages Python packages from requirements file. **group** - The group that was used to create the virtualenv. This is used to create the requirements file with correct permissions if it's not present already. - python::requirements { '/var/www/project1/requirements.txt': - virtualenv => '/var/www/project1', - proxy => 'http://proxy.domain.com:3128', - owner => 'appuser', - group => 'apps', - } +```puppet + python::requirements { '/var/www/project1/requirements.txt': + virtualenv => '/var/www/project1', + proxy => 'http://proxy.domain.com:3128', + owner => 'appuser', + group => 'apps', + } +``` ### python::virtualenv @@ -129,18 +134,20 @@ Creates Python virtualenv. **timeout** - The maximum time in seconds the "pip install" command should take. Default: 1800 - python::virtualenv { '/var/www/project1': - ensure => present, - version => 'system', - requirements => '/var/www/project1/requirements.txt', - proxy => 'http://proxy.domain.com:3128', - systempkgs => true, - distribute => false, - owner => 'appuser', - group => 'apps', - cwd => '/var/www/project1', - timeout => 0, - } +```puppet + python::virtualenv { '/var/www/project1': + ensure => present, + version => 'system', + requirements => '/var/www/project1/requirements.txt', + proxy => 'http://proxy.domain.com:3128', + systempkgs => true, + distribute => false, + owner => 'appuser', + group => 'apps', + cwd => '/var/www/project1', + timeout => 0, + } +``` ### python::gunicorn @@ -160,15 +167,17 @@ Manages Gunicorn virtual hosts. **template** - Which ERB template to use. Default: python/gunicorn.erb - python::gunicorn { 'vhost': - ensure => present, - virtualenv => '/var/www/project1', - mode => 'wsgi', - dir => '/var/www/project1/current', - bind => 'unix:/tmp/gunicorn.socket', - environment => 'prod', - template => 'python/gunicorn.erb', - } +```puppet + python::gunicorn { 'vhost': + ensure => present, + virtualenv => '/var/www/project1', + mode => 'wsgi', + dir => '/var/www/project1/current', + bind => 'unix:/tmp/gunicorn.socket', + environment => 'prod', + template => 'python/gunicorn.erb', + } +``` ## Authors From e7a48690fc2597a11a566b74f13c82aa48e9511b Mon Sep 17 00:00:00 2001 From: GaleDragon Date: Tue, 17 Jun 2014 15:36:49 -0400 Subject: [PATCH 159/241] Update README.md Added a note that if the resource name is not an absolute path you need to include that path in the options. Added after personal experience. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 3ac97159..cb0b712e 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,8 @@ Creates Python virtualenv. **distribute** - Include distribute in the virtualenv. Default: true +**venv_dir** - The location of the virtualenv if resource path not specified. Must be absolute path. Default: resource name + **owner** - Specify the owner of this virtualenv **group** - Specify the group for this virtualenv @@ -142,6 +144,7 @@ Creates Python virtualenv. proxy => 'http://proxy.domain.com:3128', systempkgs => true, distribute => false, + venv_dir => '/home/appuser/virtualenvs', owner => 'appuser', group => 'apps', cwd => '/var/www/project1', From 3dd709eeaf4b00ca41a3b4e63ec246e6eb96f69e Mon Sep 17 00:00:00 2001 From: Tristan Helmich Date: Wed, 18 Jun 2014 18:13:16 +0200 Subject: [PATCH 160/241] Quote upper case strings for future parser compat. https://tickets.puppetlabs.com/browse/PUP-2800 explains the reasoning to quote upper case words. --- manifests/install.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/install.pp b/manifests/install.pp index 1c2cb0ba..a8d7d369 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -22,8 +22,8 @@ } $pythondev = $::osfamily ? { - RedHat => "${python}-devel", - Debian => "${python}-dev" + 'RedHat' => "${python}-devel", + 'Debian' => "${python}-dev" } $dev_ensure = $python::dev ? { From d7099ae3c2e9ad9c63bec0dda7df22848585f29a Mon Sep 17 00:00:00 2001 From: Don Reilly Date: Thu, 3 Jul 2014 15:41:41 -0500 Subject: [PATCH 161/241] Changed order pattern in init.pp to support the Anchor pattern to contain dependencies. See bug #8040 https://projects.puppetlabs.com/issues/8040 --- manifests/init.pp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 4797b11c..65a7e668 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -53,9 +53,10 @@ fail("Module is not compatible with ${::operatingsystem}") } - Class['python::install'] -> Class['python::config'] - - include python::install - include python::config + # Anchor pattern to contain dependencies + anchor { 'python::begin': } -> + class { 'python::install': } -> + class { 'python::config': } -> + anchor { 'python::end': } } From 83f42940563d183593b0e091c314dbf1484fae1e Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Mon, 7 Jul 2014 13:44:59 +0200 Subject: [PATCH 162/241] Release 1.7.6 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 0f4a5c63..0d6f2325 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.7.5' +version '1.7.6' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 8b1d6c0702aac3f38905c698bfa4d4ebd560313b Mon Sep 17 00:00:00 2001 From: Simon Tremblay Date: Thu, 17 Jul 2014 09:55:04 -0400 Subject: [PATCH 163/241] Ignore geppetto files --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index b468fdc5..56a7f81c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,7 @@ pkg/ # ignore rbvenv files used for puppet-lint, rspect etc. .ruby-version .rbenv-gemsets + +# ignore geppetto files +.project +metadata.json From 71a649190bafe3ff114e6eee3655bfbcb24bb22e Mon Sep 17 00:00:00 2001 From: Simon Tremblay Date: Thu, 17 Jul 2014 09:59:10 -0400 Subject: [PATCH 164/241] Fixed pip wheel as it was done for virtualenv pip --- manifests/pip.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 2cb5bd54..247295c7 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -149,7 +149,7 @@ # Version formats as per http://guide.python-distribute.org/specification.html#standard-versioning-schemes # Explicit version. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${cwd}/pip.log install ${install_args} \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} || ${pip_env} --log ${cwd}/pip.log install ${install_args} ${proxy_flag} ${install_args} ${install_editable} ${source}==${ensure} ;}", unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -161,7 +161,7 @@ present: { # Whatever version is available. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${cwd}/pip.log install \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${cwd}/pip.log install ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", unless => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, @@ -173,7 +173,7 @@ latest: { # Latest version. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${pip_env} --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${uninstall_args} ${install_editable} ${source}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${uninstall_args} ${install_editable} ${source} || ${pip_env} --log ${cwd}/pip.log install --upgrade ${proxy_flag} ${uninstall_args} ${install_editable} ${source} ;}", unless => "${pip_env} search ${source} | grep -i INSTALLED | grep -i latest", user => $owner, environment => $environment, From 55bad98e18d5f696db68b9a2a64c3c0a2efbc263 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 17 Jul 2014 17:06:14 +0300 Subject: [PATCH 165/241] Release 1.7.7 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 0d6f2325..af6843fa 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.7.6' +version '1.7.7' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 2865f4fb87ea7e5831ed497ddb90999f83913b7e Mon Sep 17 00:00:00 2001 From: wimh Date: Fri, 18 Jul 2014 18:46:27 +0200 Subject: [PATCH 166/241] allow to specify directory from which to run the "pip install" command --- manifests/requirements.pp | 9 +++++++-- manifests/virtualenv.pp | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 11c5f002..23733370 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -32,6 +32,9 @@ # requirements file - Useful for when the requirements file is written as part of a # resource other than file (E.g vcsrepo) # +# [*cwd*] +# The directory from which to run the "pip install" command. Default: undef +# # === Examples # # python::requirements { '/var/www/project1/requirements.txt': @@ -54,13 +57,14 @@ $src = false, $environment = [], $forceupdate = false, + $cwd = undef, ) { if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { fail('python::pip: root user must be used when virtualenv is system') } - $cwd = $virtualenv ? { + $rootdir = $virtualenv ? { 'system' => '/', default => $virtualenv, } @@ -96,9 +100,10 @@ exec { "python_requirements${name}": provider => shell, - command => "${pip_env} --log ${cwd}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements}", + command => "${pip_env} --log ${rootdir}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements}", refreshonly => !$forceupdate, timeout => 1800, + cwd => $cwd, user => $owner, subscribe => File[$requirements], environment => $environment, diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 419e2ae9..769c5a84 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -154,6 +154,7 @@ proxy => $proxy, owner => $owner, group => $group, + cwd => $cwd, require => Exec["python_virtualenv_${venv_dir}"], } } From 2fc900dbf8d98dcf48677112ae33951347e216ed Mon Sep 17 00:00:00 2001 From: Remi Ferrand Date: Wed, 23 Jul 2014 17:25:18 +0200 Subject: [PATCH 167/241] Handle case when virtualenv_version fact is not available. As specified in #94, when their is no way to find virtualenv version, fall back to user request. When fact virtualenv_version is not yet available, stupidly trust user input and force systempkgs options without taking care of virtualenv veresion. 1. If the option choosen is not recognized by the installed version of virtualenv, further Exec will fail and dependencies will not be processed. 2. On the next puppet execution, fact _virtualenv_version_ will be available and process should work as expected. --- manifests/virtualenv.pp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 769c5a84..d3bc3b58 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -108,7 +108,11 @@ } elsif (( versioncmp($::virtualenv_version,'1.7') < 0 ) and ( $systempkgs == false )) { $system_pkgs_flag = '--no-site-packages' } else { - $system_pkgs_flag = '' + $system_pkgs_flag = $systempkgs ? { + true => '--system-site-packages', + false => '--no-site-packages', + default => fail('Invalid value for systempkgs. Boolean value is expected') + } } $distribute_pkg = $distribute ? { From abf49f05202f3c10b3a60c15ae3c0d9bfe1eb65c Mon Sep 17 00:00:00 2001 From: Ray Lehtiniemi Date: Thu, 24 Jul 2014 09:32:52 -0600 Subject: [PATCH 168/241] Don't override PATH while installing requirements.txt Setting the path here causes installation failures if some package in requirements.txt needs tools which happen to be installed in a non-system location. Leave path alone so caller can use Exec { path=>[...] } or similar to locate the desired tools. Signed-off-by: Ray Lehtiniemi --- manifests/requirements.pp | 1 - 1 file changed, 1 deletion(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 23733370..d9b6242b 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -107,7 +107,6 @@ user => $owner, subscribe => File[$requirements], environment => $environment, - path => ['/usr/local/bin','/usr/bin','/bin', '/usr/sbin'], } } From 676be6403c428fa9e7c0bb7195484669b08333e9 Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Sun, 27 Jul 2014 17:59:03 +1000 Subject: [PATCH 169/241] puppet-lint: removed unused var 'use_pkgname' --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index 247295c7..dd2be0d9 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -185,7 +185,7 @@ default: { # Anti-action, uninstall. exec { "pip_uninstall_${name}": - command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${use_pkgname}", + command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag}", onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, From 6bd87535749c11d3a519677b9a6c88b4330e962b Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Sun, 27 Jul 2014 19:42:03 +1000 Subject: [PATCH 170/241] started adding spec tests --- .fixtures.yml | 6 ++++ Rakefile | 2 ++ spec/classes/python_spec.rb | 70 +++++++++++++++++++++++++++++++++++++ spec_helper.rb | 25 +++++++++++++ 4 files changed, 103 insertions(+) create mode 100644 .fixtures.yml create mode 100644 spec/classes/python_spec.rb create mode 100644 spec_helper.rb diff --git a/.fixtures.yml b/.fixtures.yml new file mode 100644 index 00000000..6dcef97b --- /dev/null +++ b/.fixtures.yml @@ -0,0 +1,6 @@ + fixtures: + repositories: + stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" +# concat: "git://github.com/puppetlabs/puppetlabs-concat.git" + symlinks: + python: "#{source_dir}" \ No newline at end of file diff --git a/Rakefile b/Rakefile index 58df3ec3..b133dffd 100644 --- a/Rakefile +++ b/Rakefile @@ -6,3 +6,5 @@ PuppetLint.configuration.with_filename = true PuppetLint.configuration.send('disable_documentation') PuppetLint.configuration.send('disable_class_parameter_defaults') PuppetLint.configuration.send('disable_80chars') + +require 'puppetlabs_spec_helper/rake_tasks' diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb new file mode 100644 index 00000000..af94b70e --- /dev/null +++ b/spec/classes/python_spec.rb @@ -0,0 +1,70 @@ +require_relative '../../spec_helper' + +describe 'python', :type => :class do + context "on Debian OS" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :lsbdistcodename => 'squeeze', + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemrelease => '6', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :concat_basedir => '/dne', + } + end + + it { is_expected.to contain_class("python::install") } + # Base debian packages. + it { is_expected.to contain_package("python") } + it { is_expected.to contain_package("python-dev") } + it { is_expected.to contain_package("python-pip") } + # Basic python packages (from pip) + it { is_expected.to contain_package("python-virtualenv")} + + describe "with manage_gunicorn" do + context "true" do + let (:params) {{ :manage_gunicorn => true }} + it { is_expected.to contain_package("gunicorn") } + end + end + describe "with manage_gunicorn" do + context "empty args" do + #let (:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package("gunicorn") } + end + end + + describe "without mange_gunicorn" do + context "false" do + let (:params) {{ :manage_gunicorn => false }} + it {is_expected.not_to contain_package("gunicorn")} + end + end + + end + + context "on a Redhat 5 OS" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :osfamily => 'RedHat', + :operatingsystem => 'RedHat', + :operatingsystemrelease => '5', + :concat_basedir => '/dne', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + } + end + it { is_expected.to contain_class("python::install") } + # Base debian packages. + it { is_expected.to contain_package("python") } + it { is_expected.to contain_package("python-devel") } + it { is_expected.to contain_package("python-pip") } + # Basic python packages (from pip) + it { is_expected.to contain_package("python-virtualenv")} + + end + +end diff --git a/spec_helper.rb b/spec_helper.rb new file mode 100644 index 00000000..65379ee3 --- /dev/null +++ b/spec_helper.rb @@ -0,0 +1,25 @@ +require 'puppetlabs_spec_helper/module_spec_helper' + +RSpec.configure do |c| + c.treat_symbols_as_metadata_keys_with_true_values = true + + c.before :each do + # Ensure that we don't accidentally cache facts and environment + # between test cases. + Facter::Util::Loader.any_instance.stubs(:load_all) + Facter.clear + Facter.clear_messages + + # Store any environment variables away to be restored later + @old_env = {} + ENV.each_key {|k| @old_env[k] = ENV[k]} + + if ENV['STRICT_VARIABLES'] == 'yes' + Puppet.settings[:strict_variables]=true + end + end +end + +shared_examples :compile, :compile => true do + it { should compile.with_all_deps } +end From d2270be7b845298bc2a4bd93af66953c0fdbd2f6 Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Sun, 27 Jul 2014 20:00:50 +1000 Subject: [PATCH 171/241] Support for travis-ci.org --- .travis.yml | 23 +++++++++++++++++++++++ Gemfile | 25 +++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 .travis.yml create mode 100644 Gemfile diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..f6cc0038 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,23 @@ +--- +language: ruby +bundler_args: --without development +script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'" +matrix: + fast_finish: true + include: + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 2.0.0 + env: PUPPET_GEM_VERSION="~> 3.0" + - rvm: 1.9.3 + env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes" + - rvm: 2.0.0 + env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes" + - rvm: 2.0.0 + env: PUPPET_GEM_VERSION="~> 3.6.2" STRICT_VARIABLES="yes" +notifications: + email: false \ No newline at end of file diff --git a/Gemfile b/Gemfile new file mode 100644 index 00000000..60f5f8d0 --- /dev/null +++ b/Gemfile @@ -0,0 +1,25 @@ +source ENV['GEM_SOURCE'] || "https://rubygems.org" + +group :development, :test do + gem 'rake', :require => false + gem 'rspec-puppet', :require => false + gem 'puppetlabs_spec_helper', :require => false + gem 'serverspec', :require => false + gem 'puppet-lint', :require => false + gem 'beaker', :require => false + gem 'beaker-rspec', :require => false + gem 'pry', :require => false + gem 'simplecov', :require => false +end + +if facterversion = ENV['FACTER_GEM_VERSION'] + gem 'facter', facterversion, :require => false +else + gem 'facter', :require => false +end + +if puppetversion = ENV['PUPPET_GEM_VERSION'] + gem 'puppet', puppetversion, :require => false +else + gem 'puppet', :require => false +end From 3f9c7dd32c500906a17a4729dc5418e354f19786 Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Sun, 27 Jul 2014 20:44:36 +1000 Subject: [PATCH 172/241] increase spec coverage of puppet::install --- spec/classes/python_spec.rb | 170 ++++++++++++++++++++++++++++++++++-- 1 file changed, 164 insertions(+), 6 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index af94b70e..9552ce41 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -22,27 +22,96 @@ it { is_expected.to contain_package("python-pip") } # Basic python packages (from pip) it { is_expected.to contain_package("python-virtualenv")} + + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => true }} + it { is_expected.to contain_package("python-dev").with( + "ensure" => "present") + } + end + context "empty/default" do + it { is_expected.to contain_package("python-dev").with( + "ensure" => "absent") + } + end + end + describe "with manage_gunicorn" do context "true" do let (:params) {{ :manage_gunicorn => true }} it { is_expected.to contain_package("gunicorn") } end - end - describe "with manage_gunicorn" do context "empty args" do #let (:params) {{ :manage_gunicorn => '' }} it { is_expected.to contain_package("gunicorn") } end - end - - describe "without mange_gunicorn" do context "false" do let (:params) {{ :manage_gunicorn => false }} it {is_expected.not_to contain_package("gunicorn")} end end + describe "with python::provider" do + context "pip" do + let (:params) {{ :provider => 'pip' }} + it { is_expected.to contain_package("virtualenv").with( + "provider" => "pip" + )} + it { is_expected.to contain_package("pip").with( + "provider" => "pip" + )} + end + + # python::provider + context "default" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("python-virtualenv")} + it { is_expected.to contain_package("python-pip")} + + describe "with python::virtualenv" do + context "true" do + let (:params) {{ + :provider => '', + :virtualenv => true + }} + it { is_expected.to contain_package("python-virtualenv").with( + "ensure" => "present" + )} + end + end + + describe "with python::virtualenv" do + context "default/empty" do + let (:params) {{ + :provider => '', + :virtualenv => '' + }} + it { is_expected.to contain_package("python-virtualenv").with( + "ensure" => "absent" + )} + end + end + + + end + end + + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => true }} + it { is_expected.to contain_package("python-dev").with( + "ensure" => "present") + } + end + context "default/empty" do + let (:params) {{ :dev => '' }} + it { is_expected.to contain_package("python-dev").with( + "ensure" => "absent") + } + end + end context "on a Redhat 5 OS" do @@ -64,7 +133,96 @@ it { is_expected.to contain_package("python-pip") } # Basic python packages (from pip) it { is_expected.to contain_package("python-virtualenv")} + + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => true }} + it { is_expected.to contain_package("python-devel").with( + "ensure" => "present") + } + end + context "empty/default" do + it { is_expected.to contain_package("python-devel").with( + "ensure" => "absent") + } + end + end + + + describe "with manage_gunicorn" do + context "true" do + let (:params) {{ :manage_gunicorn => true }} + it { is_expected.to contain_package("gunicorn") } + end + context "empty args" do + #let (:params) {{ :manage_gunicorn => '' }} + it { is_expected.to contain_package("gunicorn") } + end + context "false" do + let (:params) {{ :manage_gunicorn => false }} + it {is_expected.not_to contain_package("gunicorn")} + end + end - end + describe "with python::provider" do + context "pip" do + let (:params) {{ :provider => 'pip' }} + it { is_expected.to contain_package("virtualenv").with( + "provider" => "pip" + )} + it { is_expected.to contain_package("pip").with( + "provider" => "pip" + )} + end + + # python::provider + context "default" do + let (:params) {{ :provider => '' }} + it { is_expected.to contain_package("python-virtualenv")} + it { is_expected.to contain_package("python-pip")} + + describe "with python::virtualenv" do + context "true" do + let (:params) {{ + :provider => '', + :virtualenv => true + }} + it { is_expected.to contain_package("python-virtualenv").with( + "ensure" => "present" + )} + end + end + + describe "with python::virtualenv" do + context "default/empty" do + let (:params) {{ + :provider => '', + :virtualenv => '' + }} + it { is_expected.to contain_package("python-virtualenv").with( + "ensure" => "absent" + )} + end + end + + end + end + + describe "with python::dev" do + context "true" do + let (:params) {{ :dev => true }} + it { is_expected.to contain_package("python-devel").with( + "ensure" => "present") + } + end + context "default/empty" do + let (:params) {{ :dev => '' }} + it { is_expected.to contain_package("python-devel").with( + "ensure" => "absent") + } + end + end + end + end end From 58c24bfd724fd1146b40e0ec248b230d7b6389d8 Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Sun, 27 Jul 2014 21:09:08 +1000 Subject: [PATCH 173/241] started adding checks for python::requirements --- spec/defines/requirements_spec.rb | 53 +++++++++++++++++++++++++++++ spec/defines/requirements_spec.rb~ | 54 ++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 spec/defines/requirements_spec.rb create mode 100644 spec/defines/requirements_spec.rb~ diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb new file mode 100644 index 00000000..f8144f3d --- /dev/null +++ b/spec/defines/requirements_spec.rb @@ -0,0 +1,53 @@ +require_relative '../../spec_helper' + +describe 'python::requirements', :type => :define do + let (:title) { '/requirements.txt' } + context "on Debian OS" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :lsbdistcodename => 'squeeze', + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemrelease => '6', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :concat_basedir => '/dne', + } + end + + describe "requirements as" do + context "/requirements.txt" do + let (:params) {{ :requirements => "/requirements.txt" }} + it { is_expected.to contain_file("/requirements.txt").with( + "mode" => "0644" + + )} + end + + describe "with owner" do + context "bob:bob" do + let (:params) {{ + :owner => 'bob', + :group => 'bob' + }} + it do + expect { + should compile + }.to raise_error(Puppet::Error, /root user must be used when virtualenv is system/) + end + + end + end + + describe "with owner" do + context "default" do + it { is_expected.to contain_file("/requirements.txt").with( + "owner" => "root", + "group" => "root" + )} + end + end + end + end +end diff --git a/spec/defines/requirements_spec.rb~ b/spec/defines/requirements_spec.rb~ new file mode 100644 index 00000000..62a82549 --- /dev/null +++ b/spec/defines/requirements_spec.rb~ @@ -0,0 +1,54 @@ +require_relative '../../spec_helper' + +describe 'python::requirements', :type => :define do + context "on Debian OS" do + let :facts do + { + :id => 'root', + :kernel => 'Linux', + :lsbdistcodename => 'squeeze', + :osfamily => 'Debian', + :operatingsystem => 'Debian', + :operatingsystemrelease => '6', + :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', + :concat_basedir => '/dne', + } + end + + describe "requirements as" do + context "/requirements.txt" do + let (:params) {{ :requirements => "/requirements.txt" }} + it { is_expected.to contain_file("/requirements.txt").with( + "mode" => "0644" + + )} + end + + describe "with owner" do + context "bob:bob" do + let (:params) {{ + :owner => 'bob', + :group => 'bob' + }} + it { is_expected.to contain_file("/requirements.txt").with( + "owner" => "bob", + "group" => "bob" + )} + end + end + + describe "with owner" do + context "default" do + let (:params) {{ + :owner => '', + :group => '' + }} + it { is_expected.to contain_file("/requirements.txt").with( + "owner" => "root", + "group" => "root" + )} + end + end + end + end +end From 62be88b026e19e1750deaf5cf81b3f9519ff651a Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Sun, 27 Jul 2014 21:12:10 +1000 Subject: [PATCH 174/241] removed tmp files --- spec/defines/requirements_spec.rb~ | 54 ------------------------------ 1 file changed, 54 deletions(-) delete mode 100644 spec/defines/requirements_spec.rb~ diff --git a/spec/defines/requirements_spec.rb~ b/spec/defines/requirements_spec.rb~ deleted file mode 100644 index 62a82549..00000000 --- a/spec/defines/requirements_spec.rb~ +++ /dev/null @@ -1,54 +0,0 @@ -require_relative '../../spec_helper' - -describe 'python::requirements', :type => :define do - context "on Debian OS" do - let :facts do - { - :id => 'root', - :kernel => 'Linux', - :lsbdistcodename => 'squeeze', - :osfamily => 'Debian', - :operatingsystem => 'Debian', - :operatingsystemrelease => '6', - :path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin', - :concat_basedir => '/dne', - } - end - - describe "requirements as" do - context "/requirements.txt" do - let (:params) {{ :requirements => "/requirements.txt" }} - it { is_expected.to contain_file("/requirements.txt").with( - "mode" => "0644" - - )} - end - - describe "with owner" do - context "bob:bob" do - let (:params) {{ - :owner => 'bob', - :group => 'bob' - }} - it { is_expected.to contain_file("/requirements.txt").with( - "owner" => "bob", - "group" => "bob" - )} - end - end - - describe "with owner" do - context "default" do - let (:params) {{ - :owner => '', - :group => '' - }} - it { is_expected.to contain_file("/requirements.txt").with( - "owner" => "root", - "group" => "root" - )} - end - end - end - end -end From 8575883fe1cc90f5e3b5aa1e43e7c8a996ddbc35 Mon Sep 17 00:00:00 2001 From: Daniel Lawrence Date: Mon, 28 Jul 2014 07:59:26 +1000 Subject: [PATCH 175/241] Removed support for ruby 1.8.7 during tests. --- .travis.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index f6cc0038..bfe2d16c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,10 +5,6 @@ script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake matrix: fast_finish: true include: - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" - - rvm: 1.8.7 - env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 2.0.0 @@ -20,4 +16,4 @@ matrix: - rvm: 2.0.0 env: PUPPET_GEM_VERSION="~> 3.6.2" STRICT_VARIABLES="yes" notifications: - email: false \ No newline at end of file + email: false From b559134e30bfe8c02d01410644104b6cf1c1cfc3 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 31 Jul 2014 08:20:48 -0400 Subject: [PATCH 176/241] Release 1.7.8 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index af6843fa..99f6d789 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.7.7' +version '1.7.8' author 'Sergey Stankevich' license 'Apache License, Version 2.0' From 95baac803328a37367ffe1a1a124f887e0f5a2ef Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Thu, 7 Aug 2014 19:09:42 +0200 Subject: [PATCH 177/241] Update virtualenv.pp This class should use a file type to create the venv dir, otherwise the directory is not created (and thus the hole thing is failing). Example: you let run the exec as a "normal" user and want the dir to reside under /var/lib. Most certainly the provided user may not write there. With the file definition, the directory gets created by puppet user (usually root) and chown'ed afterwards. Maybe it would be a good idea to use "ensure_resource" from stdlib to have the provided user/group verified to exist. --- manifests/virtualenv.pp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index d3bc3b58..c93f43b0 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -131,14 +131,21 @@ # To check for this we test for wheel parameter using help and then using # version, this makes sure we only use wheels if they are supported + file { $venv_dir: + ensure => directory, + owner => $owner, + group => $group, + } + exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg} || ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg} ;}", + command => "true ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg} || ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg} ;}", user => $owner, creates => "${venv_dir}/bin/activate", path => $path, cwd => '/tmp', environment => $environment, unless => "grep '^[\\t ]*VIRTUAL_ENV=[\\\\'\\\"]*${venv_dir}[\\\"\\\\'][\\t ]*$' ${venv_dir}/bin/activate", #Unless activate exists and VIRTUAL_ENV is correct we re-create the virtualenv + require => File[$venv_dir], } if $requirements { From d5cf73148ef901c97fe339fa7d804ecd5ed520be Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Fri, 8 Aug 2014 19:39:53 +0545 Subject: [PATCH 178/241] Fix python usage snippet. --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cb0b712e..1f7ac33d 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ git clone git://github.com/stankevich/puppet-python.git python ### python -Installs and manages python, python-dev, python-virtualenv and Gunicorn. +Installs and manages python, python-pip, python-dev, python-virtualenv and Gunicorn. **version** - Python version to install. Default: system default @@ -42,10 +42,11 @@ Installs and manages python, python-dev, python-virtualenv and Gunicorn. ```puppet class { 'python': version => 'system', + pip => true, dev => true, virtualenv => true, gunicorn => true, - } } + } ``` ### python::pip From 7959474b1980c3e193fd3340faf2cc80ca39b257 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Fri, 8 Aug 2014 20:48:47 +0545 Subject: [PATCH 179/241] Since forge.puppetlabs.com has Project URL there is no necessary to promote via link in README.md This solves the issue that the Title of the Puppet Module displayed in unmanaged way in forge.puppetlabs.com --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1f7ac33d..b32b1a59 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -[puppet-python](https://github.com/stankevich/puppet-python) -====== +# Puppet Python # Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. @@ -25,7 +24,7 @@ git clone git://github.com/stankevich/puppet-python.git python ### python -Installs and manages python, python-pip, python-dev, python-virtualenv and Gunicorn. +Installs and manages python, python-dev, python-virtualenv and Gunicorn. **version** - Python version to install. Default: system default @@ -42,11 +41,10 @@ Installs and manages python, python-pip, python-dev, python-virtualenv and Gunic ```puppet class { 'python': version => 'system', - pip => true, dev => true, virtualenv => true, gunicorn => true, - } + } } ``` ### python::pip From 73e68d0618a43070ad3d8b21ad225f59b86cbe1c Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Fri, 8 Aug 2014 21:01:00 +0545 Subject: [PATCH 180/241] Fix PR #102 changes that are cause due to #103 --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b32b1a59..de997064 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ git clone git://github.com/stankevich/puppet-python.git python ### python -Installs and manages python, python-dev, python-virtualenv and Gunicorn. +Installs and manages python, python-pip, python-dev, python-virtualenv and Gunicorn. **version** - Python version to install. Default: system default @@ -41,10 +41,11 @@ Installs and manages python, python-dev, python-virtualenv and Gunicorn. ```puppet class { 'python': version => 'system', + pip => true, dev => true, virtualenv => true, gunicorn => true, - } } + } ``` ### python::pip From 7f7fd535d6a7123ee8e00b3840300dedd1eb5295 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Fri, 8 Aug 2014 21:09:16 +0545 Subject: [PATCH 181/241] Fixed the quotes issues in .fixtures.yaml --- .fixtures.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 6dcef97b..2094691f 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,6 +1,6 @@ - fixtures: - repositories: - stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" -# concat: "git://github.com/puppetlabs/puppetlabs-concat.git" - symlinks: - python: "#{source_dir}" \ No newline at end of file +fixtures: + repositories: + "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" + # "concat": "git://github.com/puppetlabs/puppetlabs-concat.git" + symlinks: + "python": "#{source_dir}" From 29d522ddd8e906d80921bd425c83b0cf2bbcae35 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Fri, 8 Aug 2014 21:39:37 +0545 Subject: [PATCH 182/241] This module is not depended on Puppet Labs Concat Thus removed comment text from fixtures.yml --- .fixtures.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.fixtures.yml b/.fixtures.yml index 2094691f..33c14915 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,6 +1,5 @@ fixtures: repositories: "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" - # "concat": "git://github.com/puppetlabs/puppetlabs-concat.git" symlinks: "python": "#{source_dir}" From c3ea482378fd862df0f2626056ec2933ec33366f Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 01:24:43 +0545 Subject: [PATCH 183/241] Licensed under the Apache License, Version 2.0 --- LICENSE.md => LICENSE | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename LICENSE.md => LICENSE (76%) diff --git a/LICENSE.md b/LICENSE similarity index 76% rename from LICENSE.md rename to LICENSE index 048a291d..6e622ad6 100644 --- a/LICENSE.md +++ b/LICENSE @@ -1,10 +1,10 @@ -Copyright © 2012 Sergey Stankevich +Copyright © 2012-2014 Sergey Stankevich Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at -    [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0) + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, From c3f674c70ba56b628250a6abe66db68ebb597bf9 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 01:50:09 +0545 Subject: [PATCH 184/241] Fix the depedency & other stuffs necessary for Modulefile --- Modulefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Modulefile b/Modulefile index 99f6d789..810f6553 100644 --- a/Modulefile +++ b/Modulefile @@ -1,9 +1,9 @@ -name 'stankevich-python' -version '1.7.8' - -author 'Sergey Stankevich' -license 'Apache License, Version 2.0' -project_page 'https://github.com/stankevich/puppet-python' -source 'git://github.com/stankevich/puppet-python' -summary 'Puppet module for Python' -description 'Installs and manages Python, pip, virtualenv, Gunicorn virtual hosts.' +name 'stankevich-python' +version '1.7.8' +source 'git://github.com/stankevich/puppet-python.git' +author 'Sergey Stankevich' +license 'Apache 2.0' +summary 'Python Module' +description 'Puppet module for Python' +project_page 'https://github.com/stankevich/puppet-python' +dependency 'puppetlabs/stdlib', '>= 4.3.2' From 6a329f54248a3f04fcdfd675584b085b67cad3be Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 02:04:10 +0545 Subject: [PATCH 185/241] Added axislab travis-ci badge but can revert back lately when axislab finishes travis-ci issues for this module...will be informed --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index de997064..04208b0a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,6 @@ -# Puppet Python # +# Puppet module: python + +[![Build Status](https://travis-ci.org/axislab/puppet-python.svg?branch=master)](https://travis-ci.org/axislab/puppet-python) Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. From 465216c78721815adac904930ccc514b8671ba67 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 02:20:00 +0545 Subject: [PATCH 186/241] Updated .gitignore with geppetto files ignorance --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.gitignore b/.gitignore index 56a7f81c..b99264ec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,10 @@ pkg/ +Gemfile.lock +vendor/ +spec/fixtures/ +.vagrant/ +.bundle/ +coverage/ # ignore rbvenv files used for puppet-lint, rspect etc. .ruby-version From e0bbea9a51e756fc054aa36f2873440445d06ded Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 12:47:58 +0545 Subject: [PATCH 187/241] Required Puppet Labs Standard Library(stdlib) module >=3.2.0 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 810f6553..17a6c75c 100644 --- a/Modulefile +++ b/Modulefile @@ -6,4 +6,4 @@ license 'Apache 2.0' summary 'Python Module' description 'Puppet module for Python' project_page 'https://github.com/stankevich/puppet-python' -dependency 'puppetlabs/stdlib', '>= 4.3.2' +dependency 'puppetlabs/stdlib', '>= 3.2.0' From 794a148d425aa7b87e299f41fe3d7df073ea0515 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 12:50:07 +0545 Subject: [PATCH 188/241] Updated .gitignore according to Puppet Labs standard --- .gitignore | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.gitignore b/.gitignore index b99264ec..b5b7a00d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,11 +5,3 @@ spec/fixtures/ .vagrant/ .bundle/ coverage/ - -# ignore rbvenv files used for puppet-lint, rspect etc. -.ruby-version -.rbenv-gemsets - -# ignore geppetto files -.project -metadata.json From 0c7c8d790ed073d84ced379765ce8356bf6a79fc Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 12:51:19 +0545 Subject: [PATCH 189/241] Added metadata.json file which is required by forge v3 --- metadata.json | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 metadata.json diff --git a/metadata.json b/metadata.json new file mode 100644 index 00000000..e1c2fb9b --- /dev/null +++ b/metadata.json @@ -0,0 +1,48 @@ +{ + "name": "stankevich-python", + "version": "1.7.8", + "source": "git://github.com/stankevich/puppet-python.git", + "author": "Sergey Stankevich", + "license": "Apache 2.0", + "summary": "Python Module", + "description": "Puppet module for Python", + "project_page": "https://github.com/stankevich/puppet-python", + "issues_url": "https://github.com/stankevich/puppet-python/issues", + "operatingsystem_support": [ + { + "operatingsystem": "CentOS", + "operatingsystemrelease": [ + "5", + "6", + "7" + ] + }, + { + "operatingsystem": "Debian", + "operatingsystemrelease": [ + "6", + "7" + ] + }, + { + "operatingsystem": "Ubuntu", + "operatingsystemrelease": [ + "10.04", + "12.04", + "14.04" + ] + } + ], + "requirements": [ + { + "name": "puppet", + "version_requirement": "3.x" + } + ], + "dependencies": [ + { + "name": "puppetlabs/stdlib", + "version_requirement": ">= 3.2.0" + } + ] +} From 393e01979abbfa662b477eb401a3e33cc31699b3 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 14:43:28 +0545 Subject: [PATCH 190/241] Fix some quotes which are unnecessary according to Puppet Labs --- .fixtures.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.fixtures.yml b/.fixtures.yml index 33c14915..7de60361 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,5 +1,5 @@ fixtures: repositories: - "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" + stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" symlinks: - "python": "#{source_dir}" + python: "#{source_dir}" From c62c62471dedb047a27b45378c3db26474a29ec2 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 15:07:09 +0545 Subject: [PATCH 191/241] Better author index in Modulefile and metadata.json --- Modulefile | 2 +- metadata.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modulefile b/Modulefile index 17a6c75c..3f990ed4 100644 --- a/Modulefile +++ b/Modulefile @@ -1,7 +1,7 @@ name 'stankevich-python' version '1.7.8' source 'git://github.com/stankevich/puppet-python.git' -author 'Sergey Stankevich' +author 'stankevich' license 'Apache 2.0' summary 'Python Module' description 'Puppet module for Python' diff --git a/metadata.json b/metadata.json index e1c2fb9b..43180ba4 100644 --- a/metadata.json +++ b/metadata.json @@ -2,7 +2,7 @@ "name": "stankevich-python", "version": "1.7.8", "source": "git://github.com/stankevich/puppet-python.git", - "author": "Sergey Stankevich", + "author": "stankevich", "license": "Apache 2.0", "summary": "Python Module", "description": "Puppet module for Python", From 3557772f9cca313e54f5ae24dafe03a7bb849198 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 15:59:54 +0545 Subject: [PATCH 192/241] Re-build using puppet module generate command --- Modulefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Modulefile b/Modulefile index 3f990ed4..c9b88f93 100644 --- a/Modulefile +++ b/Modulefile @@ -2,8 +2,10 @@ name 'stankevich-python' version '1.7.8' source 'git://github.com/stankevich/puppet-python.git' author 'stankevich' -license 'Apache 2.0' +license 'Apache License, Version 2.0' summary 'Python Module' description 'Puppet module for Python' project_page 'https://github.com/stankevich/puppet-python' -dependency 'puppetlabs/stdlib', '>= 3.2.0' + +# Add dependencies, if any: +dependency 'puppetlabs/stdlib', '>= 3.x' From 386b7171c6ba608122ddec0d92ad1489de69f965 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 16:03:12 +0545 Subject: [PATCH 193/241] Updated metadata.json stdlib version_requirement --- metadata.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 43180ba4..3cb69405 100644 --- a/metadata.json +++ b/metadata.json @@ -42,7 +42,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 3.2.0" + "version_requirement": ">= 3.x" } ] } From ebefcf3e7581fc6148d58c3b9ba0c842af2a7483 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 17:43:01 +0545 Subject: [PATCH 194/241] Moved spec_helper.rb inside /spec directory from root --- spec_helper.rb => spec/spec_helper.rb | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename spec_helper.rb => spec/spec_helper.rb (100%) diff --git a/spec_helper.rb b/spec/spec_helper.rb similarity index 100% rename from spec_helper.rb rename to spec/spec_helper.rb From 0f891b9c3402a8b6b8fd94ef1ecccc02d093e747 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:09:42 +0545 Subject: [PATCH 195/241] Update Gemfile with semantic coding and vim syntax highlighting --- Gemfile | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 60f5f8d0..e960f7c4 100644 --- a/Gemfile +++ b/Gemfile @@ -1,15 +1,15 @@ source ENV['GEM_SOURCE'] || "https://rubygems.org" group :development, :test do - gem 'rake', :require => false - gem 'rspec-puppet', :require => false - gem 'puppetlabs_spec_helper', :require => false - gem 'serverspec', :require => false - gem 'puppet-lint', :require => false - gem 'beaker', :require => false - gem 'beaker-rspec', :require => false - gem 'pry', :require => false - gem 'simplecov', :require => false + gem 'rake', :require => false + gem 'rspec-puppet', :require => false + gem 'puppetlabs_spec_helper', :require => false + gem 'serverspec', :require => false + gem 'puppet-lint', :require => false + gem 'beaker', :require => false + gem 'beaker-rspec', :require => false + gem 'pry', :require => false + gem 'simplecov', :require => false end if facterversion = ENV['FACTER_GEM_VERSION'] @@ -23,3 +23,5 @@ if puppetversion = ENV['PUPPET_GEM_VERSION'] else gem 'puppet', :require => false end + +# vim:ft=ruby From a8090d1c8db5d35456b9508d551ef742390082df Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:11:28 +0545 Subject: [PATCH 196/241] Updated Rakefile with additional support --- Rakefile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Rakefile b/Rakefile index b133dffd..5868545f 100644 --- a/Rakefile +++ b/Rakefile @@ -1,10 +1,10 @@ -# Rakefile for puppet-lint (https://github.com/rodjek/puppet-lint) -# Run: rake lint - +require 'puppetlabs_spec_helper/rake_tasks' require 'puppet-lint/tasks/puppet-lint' -PuppetLint.configuration.with_filename = true -PuppetLint.configuration.send('disable_documentation') -PuppetLint.configuration.send('disable_class_parameter_defaults') -PuppetLint.configuration.send('disable_80chars') -require 'puppetlabs_spec_helper/rake_tasks' +PuppetLint.configuration.fail_on_warnings +PuppetLint.configuration.send('disable_80chars') +PuppetLint.configuration.send('disable_class_inherits_from_params_class') +PuppetLint.configuration.send('disable_class_parameter_defaults') +PuppetLint.configuration.send('disable_documentation') +PuppetLint.configuration.send('disable_single_quote_string_with_variables') +PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"] From 15e84ea2926152d9f79738bac6156f7b1c09c2a7 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:13:19 +0545 Subject: [PATCH 197/241] Updated depedencies again..sorry for this --- Modulefile | 4 ++-- metadata.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Modulefile b/Modulefile index c9b88f93..f1ad2e88 100644 --- a/Modulefile +++ b/Modulefile @@ -7,5 +7,5 @@ summary 'Python Module' description 'Puppet module for Python' project_page 'https://github.com/stankevich/puppet-python' -# Add dependencies, if any: -dependency 'puppetlabs/stdlib', '>= 3.x' +## Add dependencies, if any: +dependency 'puppetlabs/stdlib', '>= 4.0.0' diff --git a/metadata.json b/metadata.json index 3cb69405..23768e2c 100644 --- a/metadata.json +++ b/metadata.json @@ -42,7 +42,7 @@ "dependencies": [ { "name": "puppetlabs/stdlib", - "version_requirement": ">= 3.x" + "version_requirement": ">= 4.0.0" } ] } From 857f48b5768cad0758a706b23d673556e4235c8b Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:15:42 +0545 Subject: [PATCH 198/241] Included Apache 2.0 content for easy License reading --- LICENSE | 208 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 198 insertions(+), 10 deletions(-) diff --git a/LICENSE b/LICENSE index 6e622ad6..404e08ab 100644 --- a/LICENSE +++ b/LICENSE @@ -1,13 +1,201 @@ -Copyright © 2012-2014 Sergey Stankevich + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - http://www.apache.org/licenses/LICENSE-2.0 + 1. Definitions. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright © [2012-2014] [Sergey Stankevich] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From 72a56053a005e9747c7bd6a971bb25c60ec19fe3 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:21:32 +0545 Subject: [PATCH 199/241] Updated .travis.yml for better CI result --- .travis.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index bfe2d16c..a40ae502 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,15 +5,13 @@ script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake matrix: fast_finish: true include: + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.6.0" + - rvm: 1.8.7 + env: PUPPET_GEM_VERSION="~> 2.7.0" FACTER_GEM_VERSION="~> 1.7.0" - rvm: 1.9.3 env: PUPPET_GEM_VERSION="~> 3.0" - rvm: 2.0.0 env: PUPPET_GEM_VERSION="~> 3.0" - - rvm: 1.9.3 - env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.5.0" STRICT_VARIABLES="yes" - - rvm: 2.0.0 - env: PUPPET_GEM_VERSION="~> 3.6.2" STRICT_VARIABLES="yes" notifications: email: false From 73dba76d95efdd8624c87c0c53994b1da3fb9d84 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:25:09 +0545 Subject: [PATCH 200/241] Added .sync.yml --- .fixtures.yml | 4 ++-- .sync.yml | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 .sync.yml diff --git a/.fixtures.yml b/.fixtures.yml index 7de60361..33c14915 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,5 +1,5 @@ fixtures: repositories: - stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git" + "stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git" symlinks: - python: "#{source_dir}" + "python": "#{source_dir}" diff --git a/.sync.yml b/.sync.yml new file mode 100644 index 00000000..ed97d539 --- /dev/null +++ b/.sync.yml @@ -0,0 +1 @@ +--- From d1f9d9c2aed835d9f706a22066a7b91bb984730f Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:27:40 +0545 Subject: [PATCH 201/241] Updated spec_helper.rb file --- spec/spec_helper.rb | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 65379ee3..2c6f5664 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,25 +1 @@ require 'puppetlabs_spec_helper/module_spec_helper' - -RSpec.configure do |c| - c.treat_symbols_as_metadata_keys_with_true_values = true - - c.before :each do - # Ensure that we don't accidentally cache facts and environment - # between test cases. - Facter::Util::Loader.any_instance.stubs(:load_all) - Facter.clear - Facter.clear_messages - - # Store any environment variables away to be restored later - @old_env = {} - ENV.each_key {|k| @old_env[k] = ENV[k]} - - if ENV['STRICT_VARIABLES'] == 'yes' - Puppet.settings[:strict_variables]=true - end - end -end - -shared_examples :compile, :compile => true do - it { should compile.with_all_deps } -end From 69c16eb9179c3bdae9afd7d99cca0e24f93623d4 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:29:47 +0545 Subject: [PATCH 202/241] Added spec.opts file --- spec/spec.opts | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 spec/spec.opts diff --git a/spec/spec.opts b/spec/spec.opts new file mode 100644 index 00000000..91cd6427 --- /dev/null +++ b/spec/spec.opts @@ -0,0 +1,6 @@ +--format +s +--colour +--loadby +mtime +--backtrace From 35f380017a9521d579bc934a8df82762380fd893 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:30:17 +0545 Subject: [PATCH 203/241] Added spec_helper_acceptance.rb file --- spec/spec_helper_acceptance.rb | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 spec/spec_helper_acceptance.rb diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb new file mode 100644 index 00000000..88bc3b03 --- /dev/null +++ b/spec/spec_helper_acceptance.rb @@ -0,0 +1,33 @@ +require 'beaker-rspec' + +UNSUPPORTED_PLATFORMS = [ 'windows' ] + +unless ENV['RS_PROVISION'] == 'no' or ENV['BEAKER_provision'] == 'no' + if hosts.first.is_pe? + install_pe + else + install_puppet({ :version => '3.6.2', + :facter_version => '2.1.0', + :hiera_version => '1.3.4', + :default_action => 'gem_install' }) + hosts.each {|h| on h, "/bin/echo '' > #{h['hieraconf']}" } + end + hosts.each do |host| + on host, "mkdir -p #{host['distmoduledir']}" + on host, 'puppet module install puppetlabs-stdlib', :acceptable_exit_codes => [0,1] + end +end + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + + # Readable test descriptions + c.formatter = :documentation + + # Configure all nodes in nodeset + c.before :suite do + # Install module + puppet_module_install(:source => proj_root, :module_name => 'ntp') + end +end From 94a415abaa3ee9f8ff6362a1fc515cbd0f4f4820 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:33:20 +0545 Subject: [PATCH 204/241] Updated module name to python --- spec/spec_helper_acceptance.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 88bc3b03..7f7575ca 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -28,6 +28,6 @@ # Configure all nodes in nodeset c.before :suite do # Install module - puppet_module_install(:source => proj_root, :module_name => 'ntp') + puppet_module_install(:source => proj_root, :module_name => 'python') end end From 63f6a4cf89dd706f11bc6c45cde44f4b1ce9ec9f Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 18:39:35 +0545 Subject: [PATCH 205/241] Updated require 'spec_helper' --- spec/classes/python_spec.rb | 2 +- spec/defines/requirements_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 9552ce41..0cc82085 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -1,4 +1,4 @@ -require_relative '../../spec_helper' +require 'spec_helper' describe 'python', :type => :class do context "on Debian OS" do diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index f8144f3d..24ec3845 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -1,4 +1,4 @@ -require_relative '../../spec_helper' +require 'spec_helper' describe 'python::requirements', :type => :define do let (:title) { '/requirements.txt' } From 67a47ccb7006d341d689b6d2741395bce8a58442 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 19:09:10 +0545 Subject: [PATCH 206/241] Adapted with_ensure('present/absent') --- spec/classes/python_spec.rb | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 0cc82085..97061945 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -26,18 +26,13 @@ describe "with python::dev" do context "true" do let (:params) {{ :dev => true }} - it { is_expected.to contain_package("python-dev").with( - "ensure" => "present") - } + it { is_expected.to contain_package("python-dev").with_ensure('present') } end context "empty/default" do - it { is_expected.to contain_package("python-dev").with( - "ensure" => "absent") - } + it { is_expected.to contain_package("python-dev").with_ensure('absent') } end end - - + describe "with manage_gunicorn" do context "true" do let (:params) {{ :manage_gunicorn => true }} From 5af980113cc517102e930be073e959c2412bd915 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 19:22:16 +0545 Subject: [PATCH 207/241] Updated with_{mode,owner,group} func in spec/requirements_spec.rb --- spec/defines/requirements_spec.rb | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index 24ec3845..b567bb9d 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -19,10 +19,7 @@ describe "requirements as" do context "/requirements.txt" do let (:params) {{ :requirements => "/requirements.txt" }} - it { is_expected.to contain_file("/requirements.txt").with( - "mode" => "0644" - - )} + it { is_expected.to contain_file("/requirements.txt").with_mode('0644') } end describe "with owner" do @@ -42,10 +39,7 @@ describe "with owner" do context "default" do - it { is_expected.to contain_file("/requirements.txt").with( - "owner" => "root", - "group" => "root" - )} + it { is_expected.to contain_file("/requirements.txt").with_owner('root').with_group('root') } end end end From 5f289d96254e78d9c65fce4d05b7496d325c4a9a Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 19:33:34 +0545 Subject: [PATCH 208/241] Fix some whitespaces in requirements_spec.rb file --- spec/defines/requirements_spec.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index b567bb9d..58d31384 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -33,7 +33,6 @@ should compile }.to raise_error(Puppet::Error, /root user must be used when virtualenv is system/) end - end end From aa48923abf4a0986c600315a0f8212fc19113f17 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 19:40:25 +0545 Subject: [PATCH 209/241] Updated python_spec.rb --- spec/classes/python_spec.rb | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 97061945..3a26a0d3 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -67,46 +67,30 @@ describe "with python::virtualenv" do context "true" do - let (:params) {{ - :provider => '', - :virtualenv => true - }} - it { is_expected.to contain_package("python-virtualenv").with( - "ensure" => "present" - )} + let (:params) {{ :provider => '', :virtualenv => true }} + it { is_expected.to contain_package("python-virtualenv").with_ensure('present') } end end describe "with python::virtualenv" do context "default/empty" do - let (:params) {{ - :provider => '', - :virtualenv => '' - }} - it { is_expected.to contain_package("python-virtualenv").with( - "ensure" => "absent" - )} + let (:params) {{ :provider => '', :virtualenv => '' }} + it { is_expected.to contain_package("python-virtualenv").with_ensure('absent') } end end - - end end describe "with python::dev" do context "true" do - let (:params) {{ :dev => true }} - it { is_expected.to contain_package("python-dev").with( - "ensure" => "present") - } + let (:params) {{ :dev => true }} + it { is_expected.to contain_package("python-dev").with_ensure('present') } end context "default/empty" do - let (:params) {{ :dev => '' }} - it { is_expected.to contain_package("python-dev").with( - "ensure" => "absent") - } + let (:params) {{ :dev => true }} + it { is_expected.to contain_package("python-dev").with_ensure('absent') } end - + end end context "on a Redhat 5 OS" do From ef24b4ba0546fdaafd16baba1f81fea5acee0efe Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 19:46:11 +0545 Subject: [PATCH 210/241] Fix syntax error --- spec/classes/python_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 3a26a0d3..d0a5d54f 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -90,7 +90,7 @@ let (:params) {{ :dev => true }} it { is_expected.to contain_package("python-dev").with_ensure('absent') } end - end + end context "on a Redhat 5 OS" do From 34e2f988d1623c9a8653ae80765bcb466b4fd6a8 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 20:01:51 +0545 Subject: [PATCH 211/241] Fix :dev syntax error --- spec/classes/python_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index d0a5d54f..fd916963 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -87,7 +87,7 @@ it { is_expected.to contain_package("python-dev").with_ensure('present') } end context "default/empty" do - let (:params) {{ :dev => true }} + let (:params) {{ :dev => '' }} it { is_expected.to contain_package("python-dev").with_ensure('absent') } end From 11ed61944643f3276d05245429eb7b2b9da28562 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 20:14:31 +0545 Subject: [PATCH 212/241] Semantic code performed --- spec/classes/python_spec.rb | 67 +++++++++++++------------------------ 1 file changed, 23 insertions(+), 44 deletions(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index fd916963..0388b764 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -50,13 +50,13 @@ describe "with python::provider" do context "pip" do - let (:params) {{ :provider => 'pip' }} + let (:params) {{ :provider => 'pip' }} it { is_expected.to contain_package("virtualenv").with( - "provider" => "pip" - )} + 'provider' => 'pip' + )} it { is_expected.to contain_package("pip").with( - "provider" => "pip" - )} + 'provider' => 'pip' + )} end # python::provider @@ -90,7 +90,7 @@ let (:params) {{ :dev => '' }} it { is_expected.to contain_package("python-dev").with_ensure('absent') } end - + end end context "on a Redhat 5 OS" do @@ -115,18 +115,13 @@ describe "with python::dev" do context "true" do - let (:params) {{ :dev => true }} - it { is_expected.to contain_package("python-devel").with( - "ensure" => "present") - } + let (:params) {{ :dev => true }} + it { is_expected.to contain_package("python-devel").with_ensure('present') } end context "empty/default" do - it { is_expected.to contain_package("python-devel").with( - "ensure" => "absent") - } + it { is_expected.to contain_package("python-devel").with_ensure('absent') } end end - describe "with manage_gunicorn" do context "true" do @@ -145,13 +140,14 @@ describe "with python::provider" do context "pip" do - let (:params) {{ :provider => 'pip' }} + let (:params) {{ :provider => 'pip' }} + it { is_expected.to contain_package("virtualenv").with( - "provider" => "pip" - )} + 'provider' => 'pip' + )} it { is_expected.to contain_package("pip").with( - "provider" => "pip" - )} + 'provider' => 'pip' + )} end # python::provider @@ -162,46 +158,29 @@ describe "with python::virtualenv" do context "true" do - let (:params) {{ - :provider => '', - :virtualenv => true - }} - it { is_expected.to contain_package("python-virtualenv").with( - "ensure" => "present" - )} + let (:params) {{ :provider => '', :virtualenv => true }} + it { is_expected.to contain_package("python-virtualenv").with_ensure('present') } end end describe "with python::virtualenv" do context "default/empty" do - let (:params) {{ - :provider => '', - :virtualenv => '' - }} - it { is_expected.to contain_package("python-virtualenv").with( - "ensure" => "absent" - )} + let (:params) {{ :provider => '', :virtualenv => '' }} + it { is_expected.to contain_package("python-virtualenv").with_ensure('present') } end end - - end end describe "with python::dev" do context "true" do let (:params) {{ :dev => true }} - it { is_expected.to contain_package("python-devel").with( - "ensure" => "present") - } + it { is_expected.to contain_package("python-devel").with_ensure('present') } end context "default/empty" do let (:params) {{ :dev => '' }} - it { is_expected.to contain_package("python-devel").with( - "ensure" => "absent") - } - end + it { is_expected.to contain_package("python-devel").with_ensure('absent') } end end - end -end + end +end From fd8326001a240510bd7cb85b1374b6cd8c0adf68 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 20:18:45 +0545 Subject: [PATCH 213/241] changed to absent which was mistakely present --- spec/classes/python_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index 0388b764..aa73d7c7 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -166,7 +166,7 @@ describe "with python::virtualenv" do context "default/empty" do let (:params) {{ :provider => '', :virtualenv => '' }} - it { is_expected.to contain_package("python-virtualenv").with_ensure('present') } + it { is_expected.to contain_package("python-virtualenv").with_ensure('absent') } end end end From dcaa26c1c173aa5f61897e97f43a2aa7481297b6 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 20:32:53 +0545 Subject: [PATCH 214/241] Updated the Travis-CI Badge to 'stankevich' instead of 'axislab'...Please turn on the repository settings for this repo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 04208b0a..d8290bbf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Puppet module: python -[![Build Status](https://travis-ci.org/axislab/puppet-python.svg?branch=master)](https://travis-ci.org/axislab/puppet-python) +[![Build Status](https://travis-ci.org/stankevich/puppet-python.svg?branch=master)](https://travis-ci.org/stankevich/puppet-python) Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. From a1f0e02f597309c3ed6fc979a7fdbfaf2539e657 Mon Sep 17 00:00:00 2001 From: shivapoudel Date: Sat, 9 Aug 2014 21:10:57 +0545 Subject: [PATCH 215/241] Updated with tags in metadata.json --- metadata.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/metadata.json b/metadata.json index 23768e2c..3baf4cef 100644 --- a/metadata.json +++ b/metadata.json @@ -3,11 +3,12 @@ "version": "1.7.8", "source": "git://github.com/stankevich/puppet-python.git", "author": "stankevich", - "license": "Apache 2.0", + "license": "Apache Version 2.0", "summary": "Python Module", "description": "Puppet module for Python", "project_page": "https://github.com/stankevich/puppet-python", "issues_url": "https://github.com/stankevich/puppet-python/issues", + "tags": ["python", "pip", "virtualenv", "gunicorn"], "operatingsystem_support": [ { "operatingsystem": "CentOS", From bc50e706d46b6ef1b1ba47cdbe2ef2e144848f92 Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Sun, 10 Aug 2014 05:29:59 +0300 Subject: [PATCH 216/241] Release 1.7.9 --- Modulefile | 2 +- metadata.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Modulefile b/Modulefile index f1ad2e88..39d55898 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.7.8' +version '1.7.9' source 'git://github.com/stankevich/puppet-python.git' author 'stankevich' license 'Apache License, Version 2.0' diff --git a/metadata.json b/metadata.json index 3baf4cef..b348db8f 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "stankevich-python", - "version": "1.7.8", + "version": "1.7.9", "source": "git://github.com/stankevich/puppet-python.git", "author": "stankevich", "license": "Apache Version 2.0", From ee91f93ab7a0675806eddcc53385084d5c3a147a Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Mon, 11 Aug 2014 18:11:50 +0545 Subject: [PATCH 217/241] By default pip is set to true --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d8290bbf..0236cff9 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Installs and manages python, python-pip, python-dev, python-virtualenv and Gunic **version** - Python version to install. Default: system default -**pip** - Install python-pip. Default: false +**pip** - Install python-pip. Default: true **dev** - Install python-dev. Default: false From 16c032566be89623a9dc11d865d0048bba867f8f Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Mon, 11 Aug 2014 18:13:21 +0545 Subject: [PATCH 218/241] pip is set to true by default --- manifests/init.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index 65a7e668..a48d5873 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,7 +8,7 @@ # Python version to install. Default: system default # # [*pip*] -# Install python-pip. Default: false +# Install python-pip. Default: true # # [*dev*] # Install python-dev. Default: false @@ -39,7 +39,7 @@ # class python ( $version = 'system', - $pip = false, + $pip = true, $dev = false, $virtualenv = false, $gunicorn = false, From 13fff84cf5eac46ddc787cc7b4ccbce2eac7461a Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Tue, 12 Aug 2014 13:45:24 +0545 Subject: [PATCH 219/241] Installation method Updated --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 0236cff9..697f55f4 100644 --- a/README.md +++ b/README.md @@ -17,9 +17,13 @@ Currently, the changes you need to make are as follows: ## Installation +```shell +git submodule add https://github.com/stankevich/puppet-python.git /path/to/python +``` +OR + ``` shell -cd /etc/puppet/modules -git clone git://github.com/stankevich/puppet-python.git python +puppet module install stankevich-python ``` ## Usage From 79c2b0efc4efa879159a5c7b501e159932c06530 Mon Sep 17 00:00:00 2001 From: Neil Katin Date: Tue, 12 Aug 2014 17:14:24 -0700 Subject: [PATCH 220/241] Proposed fix for ticket 66: allow extra arguments when using requirements Adds an extra argument "extra_pip_args" that can be set to any string; it will be included after the requirements file is specified to allow (for example) non pypi packages to be built. --- manifests/requirements.pp | 6 +++++- manifests/virtualenv.pp | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index d9b6242b..2f432877 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -35,6 +35,9 @@ # [*cwd*] # The directory from which to run the "pip install" command. Default: undef # +# [*extra_pip_args*] +# Extra arguments to pass to pip after the requirements file +# # === Examples # # python::requirements { '/var/www/project1/requirements.txt': @@ -58,6 +61,7 @@ $environment = [], $forceupdate = false, $cwd = undef, + $extra_pip_args = '', ) { if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { @@ -100,7 +104,7 @@ exec { "python_requirements${name}": provider => shell, - command => "${pip_env} --log ${rootdir}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements}", + command => "${pip_env} --log ${rootdir}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements} $extra_pip_args", refreshonly => !$forceupdate, timeout => 1800, cwd => $cwd, diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index c93f43b0..84b9c318 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -46,6 +46,9 @@ # [*timeout*] # The maximum time in seconds the "pip install" command should take. Default: 1800 # +# [*extra_pip_args*] +# Extra arguments to pass to pip after requirements file. Default: blank +# # === Examples # # python::virtualenv { '/var/www/project1': @@ -78,7 +81,8 @@ $environment = [], $path = [ '/bin', '/usr/bin', '/usr/sbin' ], $cwd = undef, - $timeout = 1800 + $timeout = 1800, + $extra_pip_args = '' ) { if $ensure == 'present' { @@ -137,6 +141,8 @@ group => $group, } + + exec { "python_virtualenv_${venv_dir}": command => "true ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg} || ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg} ;}", user => $owner, @@ -150,7 +156,7 @@ if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag -r ${requirements}", + command => "${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag -r ${requirements} $extra_pip_args", refreshonly => true, timeout => $timeout, user => $owner, @@ -167,6 +173,7 @@ group => $group, cwd => $cwd, require => Exec["python_virtualenv_${venv_dir}"], + extra_pip_args => $extra_pip_args, } } } elsif $ensure == 'absent' { From 5bc76fd1e4b5952fc9dcb195ba27f1f2e0812514 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Wed, 13 Aug 2014 08:19:28 +0545 Subject: [PATCH 221/241] Fix WARNING: variable not enclosed in {} on line 107 --- manifests/requirements.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 2f432877..40731efe 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -104,7 +104,7 @@ exec { "python_requirements${name}": provider => shell, - command => "${pip_env} --log ${rootdir}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements} $extra_pip_args", + command => "${pip_env} --log ${rootdir}/pip.log install ${proxy_flag} ${src_flag} -r ${requirements} ${extra_pip_args}", refreshonly => !$forceupdate, timeout => 1800, cwd => $cwd, From f6d4b3049e82a161dd3da5d6c80b8848ebf3aa58 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Wed, 13 Aug 2014 08:23:20 +0545 Subject: [PATCH 222/241] Fix Travis-CI Build failed WARNING: variable not enclosed in {} on line 159 ERROR: tab character found on line 176 ERROR: two-space soft tabs not used on line 176 WARNING: indentation of => is not properly aligned on line 176 rake aborted! --- manifests/virtualenv.pp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 84b9c318..16264085 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -156,7 +156,7 @@ if $requirements { exec { "python_requirements_initial_install_${requirements}_${venv_dir}": - command => "${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag -r ${requirements} $extra_pip_args", + command => "${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag -r ${requirements} ${extra_pip_args}", refreshonly => true, timeout => $timeout, user => $owner, @@ -166,14 +166,14 @@ } python::requirements { "${requirements}_${venv_dir}": - requirements => $requirements, - virtualenv => $venv_dir, - proxy => $proxy, - owner => $owner, - group => $group, - cwd => $cwd, - require => Exec["python_virtualenv_${venv_dir}"], - extra_pip_args => $extra_pip_args, + requirements => $requirements, + virtualen => $venv_dir, + proxy => $proxy, + owner => $owner, + group => $group, + cwd => $cwd, + require => Exec["python_virtualenv_${venv_dir}"], + extra_pip_args => $extra_pip_args, } } } elsif $ensure == 'absent' { From 2e02dbfec5eba0c8dfc981d3352c4bd98926bc7e Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Wed, 13 Aug 2014 08:28:26 +0545 Subject: [PATCH 223/241] Update virtualenv.pp --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 16264085..b9927366 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -173,7 +173,7 @@ group => $group, cwd => $cwd, require => Exec["python_virtualenv_${venv_dir}"], - extra_pip_args => $extra_pip_args, + extra_pip_args => $extra_pip_args, } } } elsif $ensure == 'absent' { From 15b645a7b48b4173e112e97e02ac2afc11863a01 Mon Sep 17 00:00:00 2001 From: Hogni Gylfason Date: Fri, 15 Aug 2014 10:28:26 +0000 Subject: [PATCH 224/241] Fixed typo in parameter list --- manifests/virtualenv.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index b9927366..4d85d267 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -167,7 +167,7 @@ python::requirements { "${requirements}_${venv_dir}": requirements => $requirements, - virtualen => $venv_dir, + virtualenv => $venv_dir, proxy => $proxy, owner => $owner, group => $group, From a4a7c9c4b418c11e2c817ed1c646bff862115acc Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Sat, 16 Aug 2014 00:37:21 +0200 Subject: [PATCH 225/241] adding validation and documentation to init and install, refactored the handling of python::version to be more precise. the code changes are not tested yet, have no spec testing, but need to be synced to my repo --- manifests/init.pp | 34 +++++++++++++++++++++++++++++++++- manifests/install.pp | 17 ++++++++++++++--- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index a48d5873..f59ddb9d 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,7 +5,16 @@ # === Parameters # # [*version*] -# Python version to install. Default: system default +# Python version to install. Beware that valid values for this differ a) by +# the provider you choose and b) by the osfamily/operatingsystem you are using. +# Default: system default +# Allowed values: +# - provider == pip: everything pip allows as a version after the 'python==' +# - else: 'system', 'pypy', 3/3.3/... +# - Be aware that 'system' usually means python 2.X. +# - 'pypy' actually lets us use pypy as python. +# - 3/3.3/... means you are going to install the python3/python3.3/... +# package, if available on your osfamily. # # [*pip*] # Install python-pip. Default: true @@ -23,6 +32,11 @@ # [*manage_gunicorn*] # Allow Installation / Removal of Gunicorn. Default: true # +# [*provider*] +# What provider to use for installation of the packages, except gunicorn. +# Default: system default provider +# Allowed values: 'pip' +# # === Examples # # class { 'python': @@ -47,6 +61,24 @@ $provider = undef ) { + # validate inputs + if $provider != undef { + validate_re($provider, ['^pip$'], 'Only "pip" is a valid provider besides the system default.') + } + + if $provider == 'pip' { + validate_re($version, '^(2\.[4-7]\.\d|3\.\d\.\d)$') + # this will only be checked if not pip, every other string would be rejected by provider check + } else { + validate_re($version, concat(['system', 'pypy'], $::python::install::valid_versions])) + } + + validate_bool($pip) + validate_bool($dev) + validate_bool($virtualenv) + validate_bool($gunicorn) + validate_bool($manage_gunicorn) + # Module compatibility check $compatible = [ 'Debian', 'RedHat'] if ! ($::osfamily in $compatible) { diff --git a/manifests/install.pp b/manifests/install.pp index a8d7d369..6e42c0a7 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -15,7 +15,12 @@ class python::install { - $python = $python::version ? { + $valid_version = $osfamily ? { + 'RedHat' => ['3'], + 'Debian' => ['3', '3.3'] + } + + $python = $::python::version ? { 'system' => 'python', 'pypy' => 'pypy', default => "python${python::version}", @@ -26,6 +31,13 @@ 'Debian' => "${python}-dev" } + # pip version: use only for installation via os package manager! + if $::python::version =~ '^3' { + $pip = 'python3-pip' + } else { + $pip = 'python-pip' + } + $dev_ensure = $python::dev ? { true => present, default => absent, @@ -46,12 +58,11 @@ pip: { package { 'virtualenv': ensure => latest, provider => pip } package { 'pip': ensure => latest, provider => pip } - package { $pythondev: ensure => latest } package { "python==${python::version}": ensure => latest, provider => pip } } default: { package { 'python-virtualenv': ensure => $venv_ensure } - package { 'python-pip': ensure => $pip_ensure } + package { $pip: ensure => $pip_ensure } package { $pythondev: ensure => $dev_ensure } package { $python: ensure => present } } From a71ee7c686dfb28d2c2205053274b7571fd68b23 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Sun, 17 Aug 2014 14:31:55 +0200 Subject: [PATCH 226/241] fixed some mistakes / lint warnings in modules, fixed the python class spec to reflect default params --- manifests/init.pp | 6 +++--- manifests/install.pp | 4 ++-- manifests/virtualenv.pp | 2 +- spec/classes/python_spec.rb | 8 +++----- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/manifests/init.pp b/manifests/init.pp index f59ddb9d..60e161da 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -67,10 +67,10 @@ } if $provider == 'pip' { - validate_re($version, '^(2\.[4-7]\.\d|3\.\d\.\d)$') - # this will only be checked if not pip, every other string would be rejected by provider check + validate_re($version, ['^(2\.[4-7]\.\d|3\.\d\.\d)$','^system$']) + # this will only be checked if not pip, every other string would be rejected by provider check } else { - validate_re($version, concat(['system', 'pypy'], $::python::install::valid_versions])) + validate_re($version, concat(['system', 'pypy'], $::python::install::valid_versions)) } validate_bool($pip) diff --git a/manifests/install.pp b/manifests/install.pp index 6e42c0a7..c0306956 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -15,7 +15,7 @@ class python::install { - $valid_version = $osfamily ? { + $valid_version = $::osfamily ? { 'RedHat' => ['3'], 'Debian' => ['3', '3.3'] } @@ -32,7 +32,7 @@ } # pip version: use only for installation via os package manager! - if $::python::version =~ '^3' { + if $::python::version =~ /^3/ { $pip = 'python3-pip' } else { $pip = 'python-pip' diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index 4d85d267..a5f6eac8 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -167,7 +167,7 @@ python::requirements { "${requirements}_${venv_dir}": requirements => $requirements, - virtualenv => $venv_dir, + virtualenv => $venv_dir, proxy => $proxy, owner => $owner, group => $group, diff --git a/spec/classes/python_spec.rb b/spec/classes/python_spec.rb index aa73d7c7..cc7ac9bd 100644 --- a/spec/classes/python_spec.rb +++ b/spec/classes/python_spec.rb @@ -72,9 +72,9 @@ end end - describe "with python::virtualenv" do + describe "without python::virtualenv" do context "default/empty" do - let (:params) {{ :provider => '', :virtualenv => '' }} + let (:params) {{ :provider => '' }} it { is_expected.to contain_package("python-virtualenv").with_ensure('absent') } end end @@ -87,7 +87,6 @@ it { is_expected.to contain_package("python-dev").with_ensure('present') } end context "default/empty" do - let (:params) {{ :dev => '' }} it { is_expected.to contain_package("python-dev").with_ensure('absent') } end end @@ -165,7 +164,7 @@ describe "with python::virtualenv" do context "default/empty" do - let (:params) {{ :provider => '', :virtualenv => '' }} + let (:params) {{ :provider => '' }} it { is_expected.to contain_package("python-virtualenv").with_ensure('absent') } end end @@ -178,7 +177,6 @@ it { is_expected.to contain_package("python-devel").with_ensure('present') } end context "default/empty" do - let (:params) {{ :dev => '' }} it { is_expected.to contain_package("python-devel").with_ensure('absent') } end end From f99ede518a331c1687ee89a1d44cd8bc6a390a04 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Thu, 21 Aug 2014 09:29:41 +0545 Subject: [PATCH 227/241] Better title for Markdown --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 697f55f4..e819f269 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Puppet module: python +# puppet-python # [![Build Status](https://travis-ci.org/stankevich/puppet-python.svg?branch=master)](https://travis-ci.org/stankevich/puppet-python) From 8f35bebb3780c3397b583b2f3f9cfc261e665d04 Mon Sep 17 00:00:00 2001 From: "Stuart, Joseph" Date: Mon, 25 Aug 2014 14:40:13 -0500 Subject: [PATCH 228/241] making virtualenv command a variable to support python2.7 --- manifests/virtualenv.pp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index a5f6eac8..32603809 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -93,6 +93,11 @@ default => "python${version}", } + $virtualenv = $version ? { + 'system' => 'virtualenv', + default => "virtualenv-${version}", + } + $proxy_flag = $proxy ? { false => '', default => "--proxy=${proxy}", @@ -144,7 +149,7 @@ exec { "python_virtualenv_${venv_dir}": - command => "true ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg} || ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg} ;}", + command => "true ${proxy_command} && ${virtualenv} ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip wheel --help > /dev/null 2>&1 && { ${venv_dir}/bin/pip wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} \$wheel_support_flag --upgrade pip ${distribute_pkg} || ${venv_dir}/bin/pip --log ${venv_dir}/pip.log install ${pypi_index} ${proxy_flag} --upgrade pip ${distribute_pkg} ;}", user => $owner, creates => "${venv_dir}/bin/activate", path => $path, From bd1e2cf705589448dc08f76ed080cae5efce99e4 Mon Sep 17 00:00:00 2001 From: Steffen Zieger Date: Wed, 3 Sep 2014 15:54:05 +0200 Subject: [PATCH 229/241] add parameter to disable changing of owner and group of requirements file --- manifests/requirements.pp | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 40731efe..76e172e4 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -38,6 +38,9 @@ # [*extra_pip_args*] # Extra arguments to pass to pip after the requirements file # +# [*fix_requirements_owner*] +# Change owner and group of requirements file. Default: true +# # === Examples # # python::requirements { '/var/www/project1/requirements.txt': @@ -52,22 +55,31 @@ # Fotis Gimian # define python::requirements ( - $requirements = $name, - $virtualenv = 'system', - $owner = 'root', - $group = 'root', - $proxy = false, - $src = false, - $environment = [], - $forceupdate = false, - $cwd = undef, - $extra_pip_args = '', + $requirements = $name, + $virtualenv = 'system', + $owner = 'root', + $group = 'root', + $proxy = false, + $src = false, + $environment = [], + $forceupdate = false, + $cwd = undef, + $extra_pip_args = '', + $fix_requirements_owner = true ) { if $virtualenv == 'system' and ($owner != 'root' or $group != 'root') { fail('python::pip: root user must be used when virtualenv is system') } + if $fix_requirements_owner { + $owner_real = $owner + $group_real = $group + } else { + $owner_real = undef + $group_real = undef + } + $rootdir = $virtualenv ? { 'system' => '/', default => $virtualenv, @@ -94,8 +106,8 @@ file { $requirements: ensure => present, mode => '0644', - owner => $owner, - group => $group, + owner => $owner_real, + group => $group_real, audit => content, replace => false, content => '# Puppet will install and/or update pip packages listed here', From 386dbdfd7529e6c428311c0de94be9bf947a1cc5 Mon Sep 17 00:00:00 2001 From: Mohammed Naser Date: Wed, 10 Sep 2014 23:04:02 -0400 Subject: [PATCH 230/241] Update pip.pp --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index dd2be0d9..c78562f7 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -173,7 +173,7 @@ latest: { # Latest version. exec { "pip_install_${name}": - command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${uninstall_args} ${install_editable} ${source} || ${pip_env} --log ${cwd}/pip.log install --upgrade ${proxy_flag} ${uninstall_args} ${install_editable} ${source} ;}", + command => "${pip_env} wheel --help > /dev/null 2>&1 && { ${pip_env} wheel --version > /dev/null 2>&1 || wheel_support_flag='--no-use-wheel'; } ; { ${pip_env} --log ${cwd}/pip.log install --upgrade \$wheel_support_flag ${proxy_flag} ${install_args} ${install_editable} ${source} || ${pip_env} --log ${cwd}/pip.log install --upgrade ${proxy_flag} ${install_args} ${install_editable} ${source} ;}", unless => "${pip_env} search ${source} | grep -i INSTALLED | grep -i latest", user => $owner, environment => $environment, From 3825cad8653454188ce7dfa00930dc5c60c17027 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Sat, 13 Sep 2014 02:28:01 +0545 Subject: [PATCH 231/241] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index e819f269..72ddb8cf 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,7 @@ Manages Gunicorn virtual hosts. ## Authors [Sergey Stankevich](https://github.com/stankevich) +[Shiva Poudel](https://github.com/shivapoudel) [Ashley Penney](https://github.com/apenney) [Marc Fournier](https://github.com/mfournier) [Fotis Gimian](https://github.com/fgimian) From 5d21358258671d75e8a7839ea35ada3e078af1e4 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Sun, 14 Sep 2014 00:57:27 +0545 Subject: [PATCH 232/241] Create .editorconfig --- .editorconfig | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..46ebced3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,26 @@ +# This file is for unifying the coding style for different editors and IDEs +# editorconfig.org + +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +tab_width = 4 +indent_style = tab +insert_final_newline = true +trim_trailing_whitespace = true + +[*.md] +trim_trailing_whitespace = false +indent_style = space +indent_size = 2 + +[*.txt] +trim_trailing_whitespace = false + +[*.json] +insert_final_newline = false +indent_style = space +indent_size = 2 From 1addbdb35bd73ccfab775c8f7c1a8214f6a60a42 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Sat, 20 Sep 2014 22:45:14 +0545 Subject: [PATCH 233/241] Ignorance arranged... :) --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b5b7a00d..6b2520f1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,6 @@ pkg/ Gemfile.lock vendor/ spec/fixtures/ -.vagrant/ .bundle/ +.vagrant/ coverage/ From e0968076d7e3342e0aa140bc5d2dc2a610e44c56 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Wed, 24 Sep 2014 00:07:35 +0545 Subject: [PATCH 234/241] Added *.yml in editorconfig --- .editorconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.editorconfig b/.editorconfig index 46ebced3..dbaa1eb2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -24,3 +24,8 @@ trim_trailing_whitespace = false insert_final_newline = false indent_style = space indent_size = 2 + +[*.yml] +insert_final_newline = false +indent_style = space +indent_size = 2 From 893361f35100dd922c8219ae2f41c5fb2b427d4e Mon Sep 17 00:00:00 2001 From: Sergey Stankevich Date: Thu, 25 Sep 2014 08:50:05 +0200 Subject: [PATCH 235/241] Release 1.7.10 --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 39d55898..475428ed 100644 --- a/Modulefile +++ b/Modulefile @@ -1,5 +1,5 @@ name 'stankevich-python' -version '1.7.9' +version '1.7.10' source 'git://github.com/stankevich/puppet-python.git' author 'stankevich' license 'Apache License, Version 2.0' From bfea7e24560040fcdd8f6f48a80d3127bf37fb78 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Sat, 27 Sep 2014 11:33:46 +0545 Subject: [PATCH 236/241] Delete .editorconfig --- .editorconfig | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dbaa1eb2..00000000 --- a/.editorconfig +++ /dev/null @@ -1,31 +0,0 @@ -# This file is for unifying the coding style for different editors and IDEs -# editorconfig.org - -root = true - -[*] -charset = utf-8 -end_of_line = lf -indent_size = 4 -tab_width = 4 -indent_style = tab -insert_final_newline = true -trim_trailing_whitespace = true - -[*.md] -trim_trailing_whitespace = false -indent_style = space -indent_size = 2 - -[*.txt] -trim_trailing_whitespace = false - -[*.json] -insert_final_newline = false -indent_style = space -indent_size = 2 - -[*.yml] -insert_final_newline = false -indent_style = space -indent_size = 2 From c378f7f64bad4dc311d9683ea7628a4ca65970c3 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Tue, 30 Sep 2014 06:37:06 +0545 Subject: [PATCH 237/241] Update README.md --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 72ddb8cf..55ca062f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,4 @@ -# puppet-python # - -[![Build Status](https://travis-ci.org/stankevich/puppet-python.svg?branch=master)](https://travis-ci.org/stankevich/puppet-python) +# puppet-python [![Build Status](https://travis-ci.org/stankevich/puppet-python.svg?branch=master)](https://travis-ci.org/stankevich/puppet-python) Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. From 5312fb2e765a7a59d99f69f37bf584c64f05f159 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Wed, 1 Oct 2014 14:11:44 +0545 Subject: [PATCH 238/241] Updated the readme for some info in italic --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 55ca062f..724efffc 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Currently, the changes you need to make are as follows: ```shell git submodule add https://github.com/stankevich/puppet-python.git /path/to/python ``` -OR +*OR* ``` shell puppet module install stankevich-python From c5f219631710d68da85735ad08fb05b27f6915a7 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Thu, 2 Oct 2014 20:09:22 +0545 Subject: [PATCH 239/241] Not necessary... :) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 724efffc..55ca062f 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ Currently, the changes you need to make are as follows: ```shell git submodule add https://github.com/stankevich/puppet-python.git /path/to/python ``` -*OR* +OR ``` shell puppet module install stankevich-python From 2984875a97705917462eedbfc2fe9a37d6812e90 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Fri, 3 Oct 2014 09:40:40 +0545 Subject: [PATCH 240/241] Updated with code highlight in bind :) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 55ca062f..c17e7cad 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,7 @@ Manages Gunicorn virtual hosts. **dir** - Application directory. -**bind** - Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. Default: unix:/tmp/gunicorn-$name.socket or unix:${virtualenv}/${name}.socket +**bind** - Bind on: 'HOST', 'HOST:PORT', 'unix:PATH'. Default: `unix:/tmp/gunicorn-$name.socket` or `unix:${virtualenv}/${name}.socket` **environment** - Set ENVIRONMENT variable. Default: none From e06089b14df7e7cb90fd23a70bcf3d6830b70707 Mon Sep 17 00:00:00 2001 From: Shiva Poudel Date: Sat, 4 Oct 2014 15:06:24 +0545 Subject: [PATCH 241/241] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c17e7cad..c4aa3a0c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Puppet module for installing and managing python, pip, virtualenvs and Gunicorn virtual hosts. -**Version 1.1.x Notes** +**==> 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.