Hello, I'm new to puppet and facter. Initially we are planning on using facter/puppet to inventory machines (Mac, Ubuntu, and RHEL). We plan on writing a number of custom facts. Obviouly some of the facts will only be specific to some OSs. I know there is a "confine" method, but it confuses me. It seems the confine statement in some of the recipes and in the Turnbull book is checked after most of the work is done. Take for example:
if FileTest.exists?("/usr/sbin/dmidecode") # Add remove things to query here query = { 'BIOS Information' => 'Vendor:', 'System Information' => [ 'Manufacturer:', 'Product Name:' , 'Serial Number:', 'Version:' ], 'Chassis Information' => 'Type:', 'Processor Information' => ['Version:', 'Max Speed:'], 'Memory Controller Information' => [ 'Maximum Memory Module Size:', 'Maximum Total Memory Size:' ] } # Run dmidecode only once output=%x{/usr/sbin/dmidecode 2>/dev/null} query.each_pair do |key,v| v.each do |value| output.split("Handle").each do |line| if line =~ /#{key}/ and line =~ /#{value} (\w.*)\n*./ result = $1 Facter.add(value.chomp(':')) do confine :kernel => :linux setcode do result end end end end end end end Does this code get executed in the kernel is not Linux, or is the fact just not added is the kernel is not linux? Also, should I bundle the facts into one document, say by platform, or should each fact be in its own file? Thanks, Allan Marcus --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com To unsubscribe from this group, send email to puppet-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---