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, #logger, #makecommand, #removepass, #run, #runcmd, #setpass, #update, #validate_status

Constructor Details

#initialize(opts = ObservableHash.new) ⇒ BmcConfig

Returns a new instance of BmcConfig.



3
4
5
6
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 3

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



39
40
41
42
43
44
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 39

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

#listsectionsObject

Returns a list of available sections to inspect



47
48
49
50
51
52
53
54
55
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 47

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

#section(section) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 16

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

#setsection(section, key, value) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 25

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

#verbose(on = false) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 8

def verbose(on = false)
  if on
    @options['verbose'] = false
  else
    @options.delete_notify('verbose')
  end
end