class IDRAC::Session

def delete

Delete the Redfish session
def delete
  return false unless @x_auth_token || @session_location
  
  begin
    debug "Deleting Redfish session...", 1
    
    # Try to delete via session location first
    if @session_location && delete_via_location
      return true
    end
    
    # Try to delete via session ID
    if @x_auth_token && delete_via_session_id
      return true
    end
    
    # Clear token variables even if deletion failed
    debug "Clearing session token internally", 1, :yellow
    @x_auth_token = nil
    @session_location = nil
    return false
  rescue => e
    debug "Error during Redfish session deletion: #{e.message}", 1, :red
    # Clear token variables anyway
    @x_auth_token = nil
    @session_location = nil
    return false
  end
end