From 750d3538929316df9e18481a01acc0c7dc4de2dd Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 8 Apr 2014 13:45:09 +0100 Subject: 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 bdcfc6f..d18fbdf 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 ? { -- cgit v1.2.3 From 9c1bc0825f3ebbe8473d3691bdc8c18f31fae12b Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 8 Apr 2014 13:45:33 +0100 Subject: 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 8bd21d3..98b6fac 100644 --- a/manifests/pip.pp +++ b/manifests/pip.pp @@ -57,7 +57,7 @@ define python::pip ( $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}", + default => $virtualenv, } $pip_env = $virtualenv ? { @@ -88,8 +88,8 @@ define python::pip ( 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 @@ define python::pip ( default: { exec { "pip_uninstall_${name}": - command => "echo y | $pip_env uninstall $uninstall_args ${proxy_flag} ${name}", - onlyif => "$pip_env freeze | grep -i -e ${grep_regex}", + command => "echo y | ${pip_env} uninstall ${uninstall_args} ${proxy_flag} ${name}", + onlyif => "${pip_env} freeze | grep -i -e ${grep_regex}", user => $owner, environment => $environment, } diff --git a/manifests/requirements.pp b/manifests/requirements.pp index 60c5b6c..010a199 100644 --- a/manifests/requirements.pp +++ b/manifests/requirements.pp @@ -56,7 +56,7 @@ define python::requirements ( $cwd = $virtualenv ? { 'system' => '/', - default => "${virtualenv}", + default => $virtualenv, } $pip_env = $virtualenv ? { diff --git a/manifests/virtualenv.pp b/manifests/virtualenv.pp index d18fbdf..ebc75be 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -105,11 +105,11 @@ 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", + 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, } -- cgit v1.2.3 From 275cd8672ac5a0144f4d96ba39f0db6705786fc4 Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 8 Apr 2014 14:06:26 +0100 Subject: Bump module version --- Modulefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modulefile b/Modulefile index 6bfbe7a..af82867 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' -- cgit v1.2.3 From c3aa0cf84cdbc5ddb85de5d3fc9c2636d1eb633f Mon Sep 17 00:00:00 2001 From: Vik Bhatti Date: Tue, 8 Apr 2014 15:01:59 +0100 Subject: 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 a88042b..419e2ae 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -76,9 +76,9 @@ define python::virtualenv ( $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' { -- cgit v1.2.3