hi,

solved by switching to a custom fact function:

classes_file  = '/var/lib/puppet/state/classes.txt'
classes_hash  = {}
modules_array = []
File.foreach(classes_file) do |l|
  modules_array << l.chomp.gsub(/::.*/, '')
end
modules_array = modules_array.sort.uniq
modules_array.each do |i|
  classes_array = []
  classes_array << i
  File.foreach(classes_file) do |l|
    classes_array << l.chomp if l =~ /^#{i}/
    classes_array = classes_array.sort.uniq
  end
  classes_hash[i] = classes_array
end

Facter.add(:puppet_modules, :timeout => 10) do
  confine :kernel => 'Linux'
  setcode do
    modules_array.sort.uniq.join(', ').to_s
  end
end
Facter.add(:puppet_classes, :timeout => 10) do
  confine :kernel => 'Linux'
  setcode do
    classes_hash.map { |_k, v| v }.sort.uniq.join(', ').to_s
  end
end


from 
https://www.netways.de/fileadmin/images/Events_Trainings/Events/OSMC/2015/Slides_2015/The_Road_to_lazy_Monitoring_with_Icinga2_and_Puppet-Tom_De_Vylder.pdf

which gives me a hash back, instead of an array.

cu denny

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/90e3c2a5-e78b-4ebe-b32c-c67216a1a2ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to