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

Constructor Details

#initialize(opts = ObservableHash.new) ⇒ ChassisConfig

Returns a new instance of ChassisConfig.



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

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

Instance Method Details

#bootbios(persistent = true) ⇒ Object

shortcut to boot into bios setup



66
67
68
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 66

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

#bootcdrom(persistent = true) ⇒ Object

shortcut to set boot device to cdrom



61
62
63
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 61

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

#bootdevice(device, persistent) ⇒ Object



26
27
28
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 26

def bootdevice(device, persistent)
  set_boot_flag("Boot_Device", device, persistent)
end

#bootdevicesObject



30
31
32
33
34
35
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 30

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



56
57
58
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 56

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

#bootpersistent(value) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 37

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")
  value
end

#bootpxe(persistent = true) ⇒ Object

shortcut to set boot device to pxe



51
52
53
# File 'lib/rubyipmi/freeipmi/commands/chassisconfig.rb', line 51

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



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

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

#commitObject

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



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

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