Module: OmfRc::Util::Mod
- Extended by:
- ResourceProxyDSL::ClassMethods
- Includes:
- Cocaine, Hashie, ResourceProxyDSL
- Included in:
- ResourceProxy::Node, ResourceProxy::Wlan
- Defined in:
- omf_rc/lib/omf_rc/util/mod.rb
Overview
Manage Linux modules
Constant Summary
Constant Summary
Constants included from ResourceProxyDSL
ResourceProxyDSL::DEFAULT_PROP_ACCESS, ResourceProxyDSL::PROXY_DIR, ResourceProxyDSL::UTIL_DIR
FRCP Request Methods (collapse)
FRCP Configure Methods (collapse)
- 
  
    
      - (Object) configure_load_module 
    
    
  
  
  
  
  
  
  
  
  
    Load additional modules. 
Methods included from ResourceProxyDSL::ClassMethods
call_hook, configure, configure_all, extend_configure, extend_hook, extend_request, extend_work, hook, namespace, property, register_proxy, request, utility, work
Methods included from ResourceProxyDSL
#call_hook, #hook_defined?, included
Instance Method Details
- (Object) configure_load_module
    Note:
    
  
Method 'configure_load_module' generated by DSL method 'configure'
Load additional modules
| 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # File 'omf_rc/lib/omf_rc/util/mod.rb', line 35 configure :load_module, if: proc { cmd_exists?('modprobe') } do |resource, value| raise ArgumentError, "Please provide at least module name" if value.name.nil? flags_string = nil if !value.flags.nil? if value.flags.kind_of?(Hash) flags_string = value.flags.keys.map do |k| "--#{k} #{value.flags[k]}" end.join(" ") else raise ArgumentError, "Please provide modprobe flags as a hash" end end if value.unload c=CommandLine.new("modprobe", "-r :mod_names") c.run({ :mod_names => [value.unload].flatten.join(' ') }) end c=CommandLine.new("modprobe", ":flags :mod_name :module_parameters") c.run({ :mod_name => value.name.to_s, :flags => flags_string, :module_parameters => value.mod_params.to_s }) "#{value.name} loaded" end | 
- (Object) request_modules
    Note:
    
  
  Method 'request_modules' generated by DSL method 'request'
| 21 22 23 24 25 | # File 'omf_rc/lib/omf_rc/util/mod.rb', line 21 request :modules, if: proc { cmd_exists?('lsmod') } do CommandLine.new('lsmod').run.split("\n").map do |v| v.match(/^(\w+).+$/) && $1 end.compact.tap { |ary| ary.shift } end |