Commit 3fccbcc3 authored by Jonathan's avatar Jonathan
Browse files

Merge pull request #30 from djjudas21/combined_fact

Combine two facts into one, to share the same exec
parents 8c7e6214 a2e1f94c
# Grab the FreeRADIUS version from the output of radiusd -v
Facter.add(:freeradius_maj_version) do
setcode do
version = Facter::Core::Execution.exec('radiusd -v')
if version.nil?
version = Facter::Core::Execution.exec('freeradius -v')
end
if !version.nil?
version = version.split(/\n/)[0].match(/FreeRADIUS Version (\d)\.\d\.\d/)[1].to_s
end
version
end
end
# Grab the FreeRADIUS version from the output of radiusd -v # Grab the FreeRADIUS version from the output of radiusd -v
version = Facter::Core::Execution.exec('radiusd -v')
if version.nil?
version = Facter::Core::Execution.exec('freeradius -v')
end
Facter.add(:freeradius_version) do Facter.add(:freeradius_version) do
setcode do setcode do
version = Facter::Core::Execution.exec('radiusd -v')
if version.nil?
version = Facter::Core::Execution.exec('freeradius -v')
end
if !version.nil? if !version.nil?
version = version.split(/\n/)[0].match(/FreeRADIUS Version (\d\.\d\.\d)/)[1].to_s minver = version.split(/\n/)[0].match(/FreeRADIUS Version (\d\.\d\.\d)/)[1].to_s
end end
version minver
end end
end end
Facter.add(:freeradius_maj_version) do
setcode do
if !version.nil?
majver = version.split(/\n/)[0].match(/FreeRADIUS Version (\d)\.\d\.\d/)[1].to_s
end
majver
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment