1a0f3c0a6d
UP link: https://github.com/puppetlabs/puppetlabs-haproxy UP commit sha: 4c94112afbb143f54caae0967e29261b41179017 Implements: blueprint ssl-endpoints Change-Id: Icb96703ad50b111af463cb6c4094091a251ca680
23 lines
563 B
Ruby
23 lines
563 B
Ruby
# Fact: haproxy_version
|
|
#
|
|
# Purpose: get haproxy's current version
|
|
#
|
|
# Resolution:
|
|
# Uses haproxy's -v flag and parses the result from 'version'
|
|
#
|
|
# Caveats:
|
|
# none
|
|
#
|
|
# Notes:
|
|
# None
|
|
if Facter::Util::Resolution.which('haproxy')
|
|
Facter.add('haproxy_version') do
|
|
haproxy_version_cmd = 'haproxy -v 2>&1'
|
|
haproxy_version_result = Facter::Util::Resolution.exec(haproxy_version_cmd)
|
|
setcode do
|
|
haproxy_version_result.to_s.lines.first.strip.split(/HA-Proxy/)[1].strip.split(/version/)[1].strip.split(/((\d+\.){2,}\d+).*/)[1]
|
|
end
|
|
end
|
|
end
|
|
|