Skip to content
This repository has been archived by the owner on Jun 11, 2019. It is now read-only.

Add apache_fact_version fact #89

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/facter/apache_fact_version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Facter.add(:apache_fact_version) do
setcode do

apache2_cmd_result = Facter::Util::Resolution.exec('[ "$( which apache2 2>/dev/null )" != "" ] && apache2 -v | head -n1 |cut -d"/" -f2|awk \'{ print $1 }\'')
httpd_cmd_result = Facter::Util::Resolution.exec('[ "$( which httpd 2>/dev/null )" != "" ] && httpd -v | head -n1 |cut -d"/" -f2|awk \'{ print $1 }\'')

if not apache2_cmd_result.empty?
apache2_cmd_result
elsif not httpd_cmd_result.empty?
httpd_cmd_result
else
""
end
end
end