module IDRAC::Storage

def controller

Get storage controllers information
def controller
  # Use the controllers method to get all controllers
  controller_list = controllers
  
  puts "Controllers".green
  controller_list.each { |c| puts "#{c["name"]} > #{c["drives_count"]}" }
  
  puts "Drives".green
  controller_list.each do |c|
    puts "Storage: #{c["name"]} > #{c["status"]} > #{c["drives_count"]}"
  end
  
  # Find the controller with the most drives (usually the PERC)
  controller_info = controller_list.max_by { |c| c["drives_count"] }
  
  if controller_info["name"] =~ /PERC/
    puts "Found #{controller_info["name"]}".green
  else
    puts "Found #{controller_info["name"]} but continuing...".yellow
  end
  
  # Return the raw controller data
  controller_info["raw"]
end