Class: Rubyipmi::Freeipmi::BmcConfig

Inherits:
BaseCommand show all
Defined in:
lib/rubyipmi/freeipmi/commands/bmcconfig.rb

Instance Attribute Summary

Attributes inherited from BaseCommand

#cmd, #lastcall, #max_retry_count, #options, #passfile, #result

Instance Method Summary collapse

Methods inherited from BaseCommand

#find_fix, #makecommand, #max_retry_count, #setpass, #validate_status

Methods inherited from BaseCommand

#dump_command, #find_fix, #locate_command, #makecommand, #removepass, #run, #runcmd, #setpass, #update, #validate_status

Constructor Details

#initialize(opts = ObservableHash.new) ⇒ BmcConfig

Returns a new instance of BmcConfig.



5
6
7
8
9
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 5

def initialize(opts = ObservableHash.new)
  super("bmc-config", opts)
  @sections = []

end

Instance Method Details

#configurationObject

returns the entire bmc-config configuration, can take a while to execute



35
36
37
38
39
40
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 35

def configuration
  @options["checkout"] = false
  value = runcmd
  @options.delete_notify("checkout")
  @result
end

#listsectionsObject

Returns a list of available sections to inspect



43
44
45
46
47
48
49
50
51
52
53
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 43

def listsections
  if @sections.length < 1
    @options["listsections"] = false
    value = runcmd
    @options.delete_notify("listsections")
    if value
      @sections = @result.split(/\n/)
    end
  end
  @sections
end

#section(section) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 11

def section(section)
  @options["checkout"] = false
  @options["section"] = section
  value = runcmd
  @options.delete_notify("checkout")
  @options.delete_notify("section")
  return @result
end

#setsection(section, key, value) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 20

def setsection(section, key, value)
  keypair = "#{section}:#{key}=#{value}"
  @options["commit"] = false
  if not keypair.empty?
    @options["key-pair"] = keypair
    value = runcmd
    @options.delete_notify("commit")
    @options.delete_notify("key-pair")
    return value
  end
  return false
end