From 176915523acd5ddd88de187426966b0d9ffb5f4b Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 1 Nov 2013 18:20:01 -0400 Subject: 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 0000000..2ede3f9 --- /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 bdcfc6f..fc46c72 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 @@ define python::virtualenv ( 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 ? { -- cgit v1.2.3 From d38db335949c6f8abfb4247276492b1a5051e8f9 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 1 Nov 2013 18:32:16 -0400 Subject: 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 fc46c72..8b707c8 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -92,8 +92,8 @@ define python::virtualenv ( # 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 = '' } -- cgit v1.2.3 From b044b0b9fa03adb6897a20fdc5adbb56f97856e4 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Mon, 4 Nov 2013 15:39:02 -0500 Subject: 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 0000000..099104f --- /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 -- cgit v1.2.3 From 42e0f436f08778374bc44aa6a0b81d6fd48d6f43 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Mon, 4 Nov 2013 16:32:46 -0500 Subject: 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 2ede3f9..327b2ca 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 -- cgit v1.2.3 From 669e62ca668255b179d93644101fd4e534f02bcb Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 5 Nov 2013 10:44:38 -0500 Subject: 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 099104f..6df6ae4 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 327b2ca..c923b09 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 @@ Facter.add("virtualenv_version") do 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] -- cgit v1.2.3 From b4cf920545959bf6cbb5f438b59b2cba6c0ff492 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 5 Nov 2013 11:22:59 -0500 Subject: Fix facter for versions --- lib/facter/python_version.rb | 28 ++++++++++++++++++++++++++++ lib/facter/system_python_version.rb | 26 -------------------------- 2 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 lib/facter/python_version.rb delete mode 100644 lib/facter/system_python_version.rb diff --git a/lib/facter/python_version.rb b/lib/facter/python_version.rb new file mode 100644 index 0000000..a2bdb26 --- /dev/null +++ b/lib/facter/python_version.rb @@ -0,0 +1,28 @@ +# 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 + if pkg.retrieve[pkg.property(:ensure)] != 'purged' + /^(\d+\.\d+\.\d+).*$/.match(pkg.retrieve[pkg.property(:ensure)])[1] + end + 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/system_python_version.rb b/lib/facter/system_python_version.rb deleted file mode 100644 index 6df6ae4..0000000 --- a/lib/facter/system_python_version.rb +++ /dev/null @@ -1,26 +0,0 @@ -# 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 -- cgit v1.2.3 From f6709549671caa40be8dd477ec4abb94fab7e36a Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 5 Nov 2013 17:13:40 -0500 Subject: 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 2a9a44c..cc9336f 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 9306e3a..10331ff 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -28,9 +28,24 @@ class python::install { $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, -- cgit v1.2.3 From ec2b62a53479cbc8dea7adad69904ad1a430cc5d Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 5 Nov 2013 17:31:55 -0500 Subject: 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 10331ff..cf0f78a 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -31,7 +31,7 @@ class python::install { pip => absent, } - case $venv_ensure { + case $python::virtualenv { 'pip': { exec { "pip-virtualenv": command => "pip install --upgrade virtualenv", -- cgit v1.2.3 From 0a97baffaec11215137d49a5e2e7b905f7f681db Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 5 Nov 2013 18:36:27 -0500 Subject: 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 cf0f78a..e90ecfe 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -28,19 +28,12 @@ class python::install { $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 } -- cgit v1.2.3 From c5c61860a5261b0334781fd2875f248d96fc2aff Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 11:53:12 -0500 Subject: 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 cc9336f..889d9c6 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -39,7 +39,8 @@ class python ( $pip = false, $dev = false, $virtualenv = false, - $gunicorn = false + $gunicorn = false, + $provider = undef, ) { # Module compatibility check -- cgit v1.2.3 From e7997712ce3d4ee520a2a335171d41e79f867176 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 12:19:41 -0500 Subject: 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 e90ecfe..ba4ff87 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -33,7 +33,7 @@ class python::install { # 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 } -- cgit v1.2.3 From 56df14fb57b8583146b72560afa0a83e0ca63ef0 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 12:39:26 -0500 Subject: 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 8b707c8..06c342e 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -68,7 +68,7 @@ define python::virtualenv ( $group = 'root', $proxy = false, $environment = [], - $path = [ '/bin', '/usr/bin', '/usr/sbin' ] + $path = [ '/bin', '/usr/bin', '/usr/sbin','/usr/local/bin' ] ) { $venv_dir = $name -- cgit v1.2.3 From be335fa2048a60921b0896c770d87a60b53c4aea Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 16:36:28 -0500 Subject: 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 ddbcd6f..a6faea8 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -84,6 +84,7 @@ define python::pip ( unless => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, + path => [ '/usr/bin', '/usr/local/bin/' ], } } -- cgit v1.2.3 From 52dfd22110ab3fdf83edb11868c53803d9f82b45 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 17:24:53 -0500 Subject: Fix paths --- manifests/pip.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index a6faea8..6075c3a 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -84,7 +84,7 @@ define python::pip ( 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/' ], } } -- cgit v1.2.3 From a1fc8ab73c6c34413e2957bea1d3a6719e4612c4 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 18:01:16 -0500 Subject: 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 6075c3a..f64ea97 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -94,6 +94,7 @@ define python::pip ( onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, + path => [ '/bin', '/usr/bin', '/usr/local/bin/' ], } } } -- cgit v1.2.3 From 99a7bbbf8a0d4db3a2abba9f4a47ac65c223bbaa Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 18:05:06 -0500 Subject: Fix paths --- manifests/pip.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/pip.pp b/manifests/pip.pp index f64ea97..9589b1a 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -84,7 +84,7 @@ define python::pip ( 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 @@ define python::pip ( 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"], } } } -- cgit v1.2.3 From 2e3784ba2c93f8240648682ce0b3c14bcb8605a7 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 18:46:52 -0500 Subject: 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 0000000..48dd0bf --- /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 9589b1a..0bed6dc 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -80,7 +80,7 @@ define python::pip ( 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 @@ define python::pip ( } } + 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}", -- cgit v1.2.3 From 2a6f96857f44c5781733be314b92c0053ba0e9a6 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 7 Nov 2013 19:03:13 -0500 Subject: 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 67906fc..af84707 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -79,7 +79,7 @@ define python::requirements ( 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, -- cgit v1.2.3 From 56b98bc177f34fbafa292e8a339fcce3abdd939b Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 8 Nov 2013 11:34:54 -0500 Subject: 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 06c342e..96d48ee 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -92,8 +92,12 @@ define python::virtualenv ( # 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 = '' } -- cgit v1.2.3 From 5f38429dbb30a119c8e7e4b646012075c862fa38 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 8 Nov 2013 11:48:06 -0500 Subject: 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 96d48ee..e5397da 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -96,7 +96,7 @@ define python::virtualenv ( # 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 = '' -- cgit v1.2.3 From df103dd55f719de52b17f059557593bf6e383cb1 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 8 Nov 2013 11:54:07 -0500 Subject: 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 e5397da..282742b 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -96,7 +96,7 @@ define python::virtualenv ( # 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 = '' -- cgit v1.2.3 From 0f83afd92aeea4af35795f881f9eaa408d4082c3 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 8 Nov 2013 11:56:04 -0500 Subject: 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 282742b..95fe1f7 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -96,7 +96,7 @@ define python::virtualenv ( # 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 = '' -- cgit v1.2.3 From 69d2a1447cb3b72fc25ebf19f6f82a35ef4aeb1f Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 8 Nov 2013 18:32:32 -0500 Subject: 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 ba4ff87..8bc1b49 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -10,8 +10,6 @@ class python::install { /(?i:Debian|Ubuntu)/ => "${python}-dev" } - package { $python: ensure => present } - $dev_ensure = $python::dev ? { true => present, default => absent, @@ -22,9 +20,6 @@ class python::install { 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 @@ class python::install { # 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 } } } -- cgit v1.2.3 From f7801a4b0d9ae58187891d124c21d269eae19ba5 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Thu, 12 Dec 2013 14:00:03 -0500 Subject: 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 95fe1f7..1a2b093 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -114,10 +114,10 @@ define python::virtualenv ( exec { "python_virtualenv_${venv_dir}": command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip --log-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 { -- cgit v1.2.3 From 37363c422b7525006abafd824493324868a5cd1a Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Fri, 13 Dec 2013 16:27:34 -0500 Subject: 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 1fb55d6..d8e3915 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -74,7 +74,7 @@ define python::virtualenv ( $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 ) { -- cgit v1.2.3 From 607b527a11657ddd24545ebc33f0c0984d4c0093 Mon Sep 17 00:00:00 2001 From: Jarl Stefansson Date: Tue, 17 Dec 2013 16:05:05 -0500 Subject: 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 60c5b6c..ee44fa4 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -90,7 +90,7 @@ define python::requirements ( 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 d8e3915..bc7141c 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -120,7 +120,7 @@ define python::virtualenv ( } exec { "python_virtualenv_${venv_dir}": - command => "mkdir -p ${venv_dir} ${proxy_command} && virtualenv ${system_pkgs_flag} -p ${python} ${venv_dir} && ${venv_dir}/bin/pip --log-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 @@ define python::virtualenv ( 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, -- cgit v1.2.3