in cookbooks/fb_modprobe/resources/module.rb [26:73]
def modprobe_module(new_resource, unload)
module_name = new_resource.module_name
params = [new_resource.module_params].flatten.compact
timeout = new_resource.timeout
verbose = new_resource.verbose
fallback = new_resource.fallback
flags = []
flags << '-v' if verbose
flags << '-r' if unload
if ::File.exist?("/sys/module/#{module_name}") &&
!::File.exist?("/sys/module/#{module_name}/initstate")
::Chef::Log.warn(
"fb_modprobe called on built-in module '#{module_name}'",
)
unless params.empty?
fail <<-FAIL
Cannot set parameters for built-in module '#{module_name}'!
Parameters for built-in modules must be passed on the kernel cmdline.
Prefix the parameter with the module name and a dot.
Examples: "ipv6.autoconf=1", "mlx4_en.udp_rss=1"
FAIL
end
return true
end
command = ['/sbin/modprobe'] + flags + [module_name] + params
if fallback && unload
command << '||'
command << 'rmmod'
command << '-v' if verbose
command << module_name
end
execute command.join(' ') do
action :run
notifies :reload, 'ohai[reload kernel]', :immediately
timeout timeout
end
end