Allan Marcus wrote:
> OK, so in the samples you link to above, they all have the confine as
> the first line, then a setcode do block after the confine. Does the
> setcode do block get executed if the confine test fails? that would
> make sense to me, but I just want to be sure.
I'm pretty sure that's correct. Looking at Facter 1.5.1's
operatinsystemrelease.rb, there are several stanzas like:
Facter.add(:operatingsystemrelease) do
confine :operatingsystem => :fedora
setcode do
File::open("/etc/fedora-release", "r") do |f|
line = f.readline.chomp
if line =~ /\(Rawhide\)$/
"Rawhide"
elsif line =~ /release (\d+)/
$1
end
end
end
end
Given that I'd to find a /etc/fedora-release only on Fedora, and I see
no other obvious error handling if that file doesn't exist, I'm going to
assume that the confine ensures that the setcode block only runs if the
confine passes.
--
Mike Renfro / R&D Engineer, Center for Manufacturing Research,
931 372-3601 / Tennessee Technological University -- [email protected]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---