diff options
author | varac <varacanero@zeromail.org> | 2016-06-09 12:27:03 +0200 |
---|---|---|
committer | varac <varacanero@zeromail.org> | 2016-06-14 12:05:18 +0200 |
commit | 4c0ffdbd5d910131c139271761cb55272a2c5dc1 (patch) | |
tree | 80c368e1cfe4490be00d4dba7cc48cbfd83c942e /puppet/modules/apache/lib/facter | |
parent | c1e590b87141c8f1c71625a0317475c42043afbd (diff) |
git subrepo clone https://leap.se/git/puppet_apache puppet/modules/apache
subrepo:
subdir: "puppet/modules/apache"
merged: "415e950"
upstream:
origin: "https://leap.se/git/puppet_apache"
branch: "master"
commit: "415e950"
git-subrepo:
version: "0.3.0"
origin: "https://github.com/ingydotnet/git-subrepo.git"
commit: "cb2995b"
Diffstat (limited to 'puppet/modules/apache/lib/facter')
-rw-r--r-- | puppet/modules/apache/lib/facter/apache_version.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/puppet/modules/apache/lib/facter/apache_version.rb b/puppet/modules/apache/lib/facter/apache_version.rb new file mode 100644 index 00000000..f0521832 --- /dev/null +++ b/puppet/modules/apache/lib/facter/apache_version.rb @@ -0,0 +1,28 @@ +# determine the version of apache installed + +def parse_version(version_string) + version = "" + version_string.each_line do |line| + if line.match(/^Server version/) + version = line.scan(/Apache\/(.*) /)[0][0] + end + end + return version +end + +Facter.add('apache_version') do + setcode do + case Facter.value('osfamily') + when /RedHat/ + if File.exists?('/usr/sbin/httpd') + version = parse_version(%x(/usr/sbin/httpd -v)) + end + when /Debian/ + if File.exists?('/usr/sbin/apache2') + version = parse_version(%x(/usr/sbin/apache2 -v)) + end + else + version = 'undef' + end + end +end |