class IDRAC::Firmware
def wait_for_job_completion(job_id, timeout)
def wait_for_job_completion(job_id, timeout) puts "Waiting for firmware update job #{job_id} to complete..." start_time = Time.now loop do status = get_job_status(job_id) case status when 'Completed' puts "Firmware update completed successfully" return true when 'Failed' raise Error, "Firmware update job failed" when 'Scheduled', 'Running', 'Downloading', 'Pending' # Job still in progress else puts "Unknown job status: #{status}" end if Time.now - start_time > timeout raise Error, "Firmware update timed out after #{timeout} seconds" end # Wait before checking again sleep 10 end end