def warn_once(kind, key, message, file = nil, line = nil, level = :warning)
    return if Puppet[:disable_warnings].include?(kind)
    $unique_warnings ||= {}
    if $unique_warnings.length < 100 then
      if (! $unique_warnings.has_key?(key)) then
        $unique_warnings[key] = message
        call_trace = if file == :default and line == :default
                       # Suppress the file and line number output
                       ''
                     else
                       error_location_str = Puppet::Util::Errors.error_location(file, line)
                       if error_location_str.empty?
                         "\n   " + _('(file & line not available)')
                       else
                         "\n   %{error_location}" % { error_location: error_location_str }
                       end
                     end
        send_log(level, "#{message}#{call_trace}")
      end
    end
  end
def warn_once(kind, key, message, file = nil, line = nil, level = :warning)
    return if Puppet[:disable_warnings].include?(kind)
    $unique_warnings ||= {}
    if $unique_warnings.length < 100 then
      if (! $unique_warnings.has_key?(key)) then
        $unique_warnings[key] = message
        call_trace = if file == :default and line == :default
                       # Suppress the file and line number output
                       ''
                     else
                       error_location_str = Puppet::Util::Errors.error_location(file, line)
                       if error_location_str.empty?
                         "\n   " + _('(file & line not available)')
                       else
                         "\n   %{error_location}" % { error_location: error_location_str }
                       end
                     end
        send_log(level, "#{message}#{call_trace}")
      end
    end
  end
Logs a (non deprecation) warning once for a given key.

 @param kind [String] The kind of warning. The
   kind must be one of the defined kinds for the Puppet[:disable_warnings] setting.
 @param message [String] The message to log (logs via warning)
 @param key [String] Key used to make this warning unique
 @param file [String,:default,nil] the File related to the warning
 @param line [Integer,:default,nil] the Line number related to the warning
   warning as unique
 @param level [Symbol] log level to use, defaults to :warning

 Either :file and :line and/or :key must be passed.