Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-8321

Update how warn_once and deprecation warnings print their location and i18n messages

    Details

    • Type: Task
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: PUP 5.3.3
    • Fix Version/s: PUP 5.3.4, PUP 5.4.0
    • Component/s: None
    • Labels:
      None
    • Template:
    • Acceptance Criteria:
      Hide
      • Update warn_once() to use error_location()
      • Update issue_deprecation_warning() to use error_location()
      • Update warn_once calls with i18n strings
      • Update deprecation_warning() calls with i18n strings
      • Changes pass unit and acceptance tests
      Show
      Update warn_once() to use error_location() Update issue_deprecation_warning() to use error_location() Update warn_once calls with i18n strings Update deprecation_warning() calls with i18n strings Changes pass unit and acceptance tests
    • Sub-team:
    • Team:
      Platform Core
    • Sprint:
      Platform Core KANBAN
    • Release Notes:
      Not Needed
    • QA Risk Assessment:
      No Action

      Description

      Need to update the how the warn_once() method and issue_deprecation_warning() method prints the file and line location information by using Puppet::Util::Errors.error_location and its i18n friendly output format.

      Need to update strings passed to these methods.

        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 =
              case MM.new(file, line)
              when SUPPRESS_FILE_LINE
                ''
              when FILE_AND_LINE
                _("\n   (at %{file}:%{line})") % { file: file, line: line }
              when FILE_NO_LINE
                _("\n   (in %{file})") % { file: file }
              when NO_FILE_LINE
                _("\n   (in unknown file, line %{line})") % { line: line }
              else
                _("\n   (file & line not available)")
              end
              send_log(level, "#{message}#{call_trace}")
            end
          end
        end
      

        Attachments

          Activity

            jsd-sla-details-panel

              People

              • Assignee:
                eric.delaney Eric Delaney
                Reporter:
                eric.delaney Eric Delaney
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Zendesk Support