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.



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



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

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

#listsectionsObject

Returns a list of available sections to inspect



53
54
55
56
57
58
59
60
61
62
63
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 53

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



19
20
21
22
23
24
25
26
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 19

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



28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/rubyipmi/freeipmi/commands/bmcconfig.rb', line 28

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

#verbose(on = false) ⇒ Object



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

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