summaryrefslogtreecommitdiff
path: root/lib/facter/virtualenv_version.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/facter/virtualenv_version.rb')
-rw-r--r--lib/facter/virtualenv_version.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/facter/virtualenv_version.rb b/lib/facter/virtualenv_version.rb
index 9a3b4b0..04736ed 100644
--- a/lib/facter/virtualenv_version.rb
+++ b/lib/facter/virtualenv_version.rb
@@ -5,15 +5,23 @@ pkg = Puppet::Type.type(:package).new(:name => "virtualenv")
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