From 2fc900dbf8d98dcf48677112ae33951347e216ed Mon Sep 17 00:00:00 2001 From: Remi Ferrand Date: Wed, 23 Jul 2014 17:25:18 +0200 Subject: 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 769c5a8..d3bc3b5 100644 --- a/manifests/virtualenv.pp +++ b/manifests/virtualenv.pp @@ -108,7 +108,11 @@ define python::virtualenv ( } 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 ? { -- cgit v1.2.3