How do I make sure the fact only runs in case a specific command exists?
Please consider the questions as it is laid down and ignore the fact I used bash in the example.
Facter.add("bash_ver") do
# only run fact if command exists
confine :true.which("bash")
setcode do
%x{bash --version | grep -E 'bash.*version' | cut -d ' ' -f 4 | cut -d '-' -f 1}.chomp
end
end
↧