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

Parsedfile produces a undefined method each for nil:NilClass

    XMLWordPrintable

    Details

    • Template:
      PUP Bug Template
    • Team:
      Coremunity
    • Sprint:
      Platform Core KANBAN
    • Method Found:
      Customer Feedback
    • Zendesk Ticket IDs:
      33112
    • Zendesk Ticket Count:
      1
    • Release Notes:
      Bug Fix
    • Release Notes Summary:
      Puppet now prints a meaningful error if a parsedfile provider returns nil, such as can happen when using the nagios_core module.

      Description

      The parsedfile provider will output a difficult to identify error message undefined method `each' for nil:NilClass when prefetching targets.

      target_records can be set to nil in https://github.com/puppetlabs/puppet/blob/5.5.8/lib/puppet/provider/parsedfile.rb#L264-L276 when retrieve(targets) returns nil at https://github.com/puppetlabs/puppet/blob/5.5.8/lib/puppet/provider/parsedfile.rb#L291-L293. The nil target_records is not handled, so it throws the undefined method error nil does not have en each method.

      This error was seen in the nagios_service resource, where there was a line containing only ################################ in the /etc/nagios/nagios_service.cfg file. It was difficult to identify what the cause of the issue was and where it could be coming from. Removing the file and regenerating it resolved the issue, but we would like to see more coherent error messages to reduce troubleshooting effort when there is an issue in the parsed file.

        Attachments

          Activity

            People

            Assignee:
            josh Josh Cooper
            Reporter:
            jarret.lavallee Jarret Lavallee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support