make fact work on old nginx as well

CentOS 7 (default fact works): nginx version: nginx/1.10.0
CentOS 6: nginx: nginx version: nginx/1.0.0
This commit is contained in:
Tim Meusel 2016-06-08 12:01:17 +02:00
parent b58a3f4e0c
commit 189cf0725c
No known key found for this signature in database
GPG key ID: 04D659E6BF1C4CC0

View file

@ -2,7 +2,7 @@ Facter.add(:nginx_version) do
setcode do
if Facter::Util::Resolution.which('nginx')
nginx_version = Facter::Util::Resolution.exec('nginx -v 2>&1')
%r{^nginx version: nginx\/([\w\.]+)}.match(nginx_version)[1]
%r{nginx version: nginx\/([\w\.]+)}.match(nginx_version)[1]
end
end
end