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

Find more places where we report the file or line information and convert them to use error_location()

    Details

    • Type: Task
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: PUP 5.3.4
    • Component/s: None
    • Labels:
      None
    • Release Notes:
      Not Needed
    • QA Risk Assessment:
      No Action

      Description

      We need to grep the puppet code base and find more of the locations that we report the file and line location information for an error and use the Puppet::Util::Errors.error_location() method to create the string so we are consistent.

      For example:

      16:03 $ grep -nr 'at line' lib
      lib/puppet/settings/config_file.rb:86:        raise(Puppet::Error, _("Illegal section '%{name}' in config file %{file} at line %{line}. The only valid puppet.conf sections are: [%{allowed_sections}]. Please use the directory environments feature to specify environments. (See https://docs.puppet.com/puppet/latest/reference/environments.html)") % { name: section.name, file: file, line: section.line_number, allowed_sections: allowed_section_names.join(", ") })
      lib/puppet/pops/issues.rb:779:    fl ? _("%{msg}. First defined at line %{line}") % { msg: msg, line: fl } : msg
      lib/puppet/pops/issues.rb:789:    fl ? _("%{msg}. First defined at line %{line}") % { msg: msg, line: fl } : msg
      lib/puppet/util/network_device/config.rb:55:            raise Puppet::Error, _("Duplicate device found at line %{count}, already found at %{line}") % { count: count, line: device.line } if devices.include?(name)
      lib/puppet/util/network_device/config.rb:94:      raise Puppet::Error, _("Invalid argument '%{var}' at line %{count}") % { var: var, count: count }
      lib/puppet/network/auth_config_parser.rb:32:          raise Puppet::ConfigurationError, _("Missing or invalid 'path' before right directive at line %{count} of %{file}") % { count: count, file: @file }
      lib/puppet/network/auth_config_parser.rb:69:        _("Invalid argument '%{var}' at line %{count}") % { var: var, count: count }
      lib/puppet/network/auth_config_parser.rb:80:        raise Puppet::ConfigurationError, _("%{detail} at line %{count} of %{file}") % { detail: detail, count: count, file: @file }, detail.backtrace
      $
      

      More cases to consider:

      16:05 $ egrep -nr 'at .*file.*:.*line' lib
      lib/puppet/settings/config_file.rb:86:        raise(Puppet::Error, _("Illegal section '%{name}' in config file %{file} at line %{line}. The only valid puppet.conf sections are: [%{allowed_sections}]. Please use the directory environments feature to specify environments. (See https://docs.puppet.com/puppet/latest/reference/environments.html)") % { name: section.name, file: file, line: section.line_number, allowed_sections: allowed_section_names.join(", ") })
      lib/puppet/file_serving/configuration/parser.rb:43:          raise ArgumentError.new(_("Invalid line '%{line}' at %{file}, line %{line_num}") % { line: line.chomp, file: @file.filename, line_num: @count })
      lib/puppet/file_serving/configuration/parser.rb:89:    raise ArgumentError.new(_("%{mount} is already mounted at %{name} in %{file}, line %{line_num}") % { mount: @mounts[name], name: name, file: @file, line_num: @count }) if @mounts.include?(name)
      lib/puppet/util/logging.rb:184:          _("\n   (at %{file}:%{line})") % { file: file, line: line }
      lib/puppet/parser/scope.rb:643:                   " at #{position[:file]}:#{position[:line]}"
      

        Attachments

          Activity

            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