Class: Rubyipmi::Freeipmi::ChassisConfig

Inherits:
BaseCommand show all
Defined in:
lib/rubyipmi/freeipmi/commands/chassisconfig.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) ⇒ ChassisConfig

Returns a new instance of ChassisConfig.



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

def initialize(opts = ObservableHash.new)
  super("ipmi-chassis-config", opts)

end

Instance Method Details

#bootbios(persistent = true) ⇒ Object

shortcut to boot into bios setup



83
84
85
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 83

def bootbios(persistent=true)
  bootdevice("BIOS-SETUP",persistent)
end

#bootcdrom(persistent = true) ⇒ Object

shortcut to set boot device to cdrom



78
79
80
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 78

def bootcdrom(persistent=true)
  bootdevice("CD-DVD",persistent)
end

#bootdevice(device, persistent) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 33

def bootdevice
  value = checkout("Chassis_Boot_Flags")
  if value
    # TODO parse result to return current boot device
    #@result
  end
end

#bootdevicesObject



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

def bootdevices
  # freeipmi returns a list of supported devices
  # However, for now we will just assume the following
  ["PXE", "HARD-DRIVE", "CD-DVD", "BIOS-SETUP"]
  # TODO return array of possible boot devices
end

#bootdisk(persistent = true) ⇒ Object

shortcut to set boot device to disk



73
74
75
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 73

def bootdisk(persistent=true)
  bootdevice("HARD-DRIVE",persistent)
end

#bootpersistent(value) ⇒ Object



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

def bootpersistent(value)
  # TODO find out if we can specify multiple key-pair values
  if value == true
    flag = "Chassis_Boot_Flags:Boot_Flags_Persistent=Yes"
  else
    flag = "Chassis_Boot_Flags:Boot_Flags_Persistent=No"
  end
  @options["key-pair"] = "\"#{flag}\""
  value = commit
  @options.delete_notify("key-pair")
  return value
end

#bootpxe(persistent = true) ⇒ Object

shortcut to set boot device to pxe



68
69
70
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 68

def bootpxe(persistent=true)
  bootdevice("PXE",persistent)
end

#checkout(section = nil) ⇒ Object

This is the raw command to get the entire ipmi chassis configuration If you pass in a section you will get just the section



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

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

#commitObject

This is the raw command to send a new configuration to the ipmi device



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

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