diff options
author | James Shubin <james@shubin.ca> | 2013-09-23 16:10:56 -0400 |
---|---|---|
committer | James Shubin <james@shubin.ca> | 2013-09-23 16:10:56 -0400 |
commit | 2aa4163f52eb55cdd376946ad05c5d74a45c14f8 (patch) | |
tree | 39dba26f2fab0809bde43b4813f307ce14c77697 /lib | |
parent | 17aff1a33a001cbb56735ff9f61a9bbcaa40cb04 (diff) | |
download | puppet-gluster-2aa4163f52eb55cdd376946ad05c5d74a45c14f8.tar.gz puppet-gluster-2aa4163f52eb55cdd376946ad05c5d74a45c14f8.tar.xz puppet-gluster-2aa4163f52eb55cdd376946ad05c5d74a45c14f8.zip |
Add gluster version fact and operating-version templating.
Puppet-gluster now correctly picks the operating-version value from a
table of known version -> value correspondences. Future value additions
should be added to this table.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/facter/gluster_version.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/facter/gluster_version.rb b/lib/facter/gluster_version.rb new file mode 100644 index 0000000..4a84b25 --- /dev/null +++ b/lib/facter/gluster_version.rb @@ -0,0 +1,32 @@ +# Simple? gluster module by James +# Copyright (C) 2010-2013+ James Shubin +# Written by James Shubin <james@shubin.ca> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +require 'facter' + +gluster = '/usr/sbin/gluster' + +# create the fact if the gluster executable exists +if File.exist?(gluster) + Facter.add('gluster_version') do + #confine :operatingsystem => %w{CentOS, RedHat, Fedora} + setcode { + Facter::Util::Resolution.exec(gluster+' --version | /usr/bin/head -1 | /bin/cut -d " " -f 2').chomp + } + end +end + +# vim: ts=8 |