Class: Radfish::BootInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/radfish/boot_info.rb

Overview

Boot configuration facade. Reached as client.boot.

The vendor-neutral entry point for the boot mechanics that used to be hand-rolled in raw Redfish by callers (reading BootSources, disabling stale UEFI placeholders, scheduling the config job). The heavy lifting lives in the adapter; this object just exposes it cleanly and keeps to_h pointing at the underlying boot configuration for backward compatibility.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ BootInfo

Returns a new instance of BootInfo.



13
14
15
# File 'lib/radfish/boot_info.rb', line 13

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



11
12
13
# File 'lib/radfish/boot_info.rb', line 11

def client
  @client
end

Instance Method Details

#disable_entries(match: nil, **opts) ⇒ Object

Disable the matched UEFI boot entries via a config job and return the names disabled. With no match: the adapter's default (the stale placeholders) applies. The adapter drains any pending LC config job first, so this never trips LC068.



27
28
29
30
# File 'lib/radfish/boot_info.rb', line 27

def disable_entries(match: nil, **opts)
  require_adapter!(:disable_boot_entries)
  match ? adapter.disable_boot_entries(match: match, **opts) : adapter.disable_boot_entries(**opts)
end

#drain_config_jobsObject

Drain every pending (non-Completed) config job so scheduling a new one does not trip LC068. Returns the ids drained.



49
50
51
52
# File 'lib/radfish/boot_info.rb', line 49

def drain_config_jobs
  require_adapter!(:drain_pending_config_jobs!)
  adapter.drain_pending_config_jobs!
end

#set_one_time_cd_boot(**opts) ⇒ Object

One-time boot to the virtual CD via the vendor's reliable path (Dell: an SCP import that drains any pending config job first, then sets ServerBoot BootOnce + FirstBootDevice=VCD-DVD). Returns the vendor result; raises NotImplementedError on an adapter with no SCP one-time-boot path.



35
36
37
38
# File 'lib/radfish/boot_info.rb', line 35

def set_one_time_cd_boot(**opts)
  require_adapter!(:set_one_time_cd_boot)
  adapter.set_one_time_cd_boot(**opts)
end

#stale_uefi_entries(match: nil) ⇒ Object

The still-enabled stale UEFI boot placeholders (Dell: "Unknown.Unknown.*"). [] when the adapter has nothing to report. Pass match: to target a different set of entries.



19
20
21
22
# File 'lib/radfish/boot_info.rb', line 19

def stale_uefi_entries(match: nil)
  require_adapter!(:stale_uefi_boot_entries)
  match ? adapter.stale_uefi_boot_entries(match: match) : adapter.stale_uefi_boot_entries
end

#to_hObject Also known as: config

Underlying boot configuration hash (BootSourceOverride*, boot order, ...).



55
56
57
# File 'lib/radfish/boot_info.rb', line 55

def to_h
  adapter.boot_config
end

#wait_config_job(jid, **opts) ⇒ Object

Poll the config job jid (e.g. the BIOS config job a boot-source change schedules) to a terminal state. Returns the state string, or nil on timeout (never raises).



42
43
44
45
# File 'lib/radfish/boot_info.rb', line 42

def wait_config_job(jid, **opts)
  require_adapter!(:wait_config_job)
  adapter.wait_config_job(jid, **opts)
end