diff options
author | Jarl Stefansson <jarl@sdelements.com> | 2013-11-01 18:20:01 -0400 |
---|---|---|
committer | Jarl Stefansson <jarl@sdelements.com> | 2013-11-01 18:20:01 -0400 |
commit | 176915523acd5ddd88de187426966b0d9ffb5f4b (patch) | |
tree | 2a0302dea68a74536d8c9c37976a903288b1cd93 | |
parent | a017bd325e677159e37d22d5b2ef65377846b23e (diff) |
Disable system package flag on older virtualenv
-rw-r--r-- | lib/facter/virtualenv_version.rb | 7 | ||||
-rw-r--r-- | manifests/virtualenv.pp | 11 |
2 files changed, 15 insertions, 3 deletions
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 ? { |