blob: 46c50d94f2e18e08ab36292018ad170afafe5076 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# Make pip version available as a fact
# Works with pip loaded and without, pip installed using pip and package installed
require 'puppet'
pkg = Puppet::Type.type(:package).new(:name => "python-pip")
Facter.add("pip_version") do
has_weight 100
setcode do
/^pip (\d+\.\d+\.?\d*).*$/.match(Facter::Util::Resolution.exec('pip --version 2>/dev/null'))[1]
end
end
Facter.add("pip_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]
end
end
end
|