summaryrefslogtreecommitdiff
path: root/lib/facter
diff options
context:
space:
mode:
Diffstat (limited to 'lib/facter')
-rw-r--r--lib/facter/virtualenv_version.rb7
1 files changed, 7 insertions, 0 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