module IDRAC::Utility
def download_tsr_from_location(location, output_file: nil)
-
(String, nil)
- Path to downloaded file or nil if failed
Parameters:
-
output_file
(String
) -- Path to save the TSR file (optional) -
location
(String
) -- URL location of the TSR file
def download_tsr_from_location(location, output_file: nil) debug "Downloading TSR from location: #{location}", 1 # Default output filename with timestamp output_file ||= "supportassist_#{@host}_#{Time.now.strftime('%Y%m%d_%H%M%S')}.zip" # Download the file from the location file_response = authenticated_request(:get, location) if file_response.status == 200 && file_response.body File.open(output_file, 'wb') do |f| f.write(file_response.body) end debug "TSR saved to: #{output_file} (#{File.size(output_file)} bytes)", 1, :green return output_file else debug "Failed to download file from location. Status: #{file_response.status}", 1, :red nil end rescue => e debug "Error downloading TSR: #{e.message}", 1, :red nil end