Move get_modules inside setcode

This commit is contained in:
Greg Dallavalle 2012-10-17 12:45:44 -05:00
parent ecdcfe6b8b
commit 48281cb8de

View File

@ -10,16 +10,13 @@ require "facter"
require "set"
def get_modules
if File.exists?("/proc/modules")
return File.readlines("/proc/modules").inject(Set.new){|s,l|s << l[/\w+\b/] }
end
return File.readlines("/proc/modules").inject(Set.new){|s,l|s << l[/\w+\b/]}
end
modules = get_modules
Facter.add("kernel_modules") do
confine :kernel => :linux
setcode do
modules = get_modules
modules.to_a.join(",")
end
end