Jira (PUP-9369) Parsedfile produces a undefined method each for nil:NilClass

28 views
Skip to first unread message

Jarret Lavallee (JIRA)

unread,
Dec 19, 2018, 4:25:07 PM12/19/18
to puppe...@googlegroups.com
Jarret Lavallee created an issue
 
Puppet / Bug PUP-9369
Parsedfile produces a undefined method each for nil:NilClass
Issue Type: Bug Bug
Affects Versions: PUP 5.5.8
Assignee: Unassigned
Created: 2018/12/19 1:24 PM
Priority: Normal Normal
Reporter: Jarret Lavallee

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.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Jarret Lavallee (JIRA)

unread,
Dec 19, 2018, 4:25:08 PM12/19/18
to puppe...@googlegroups.com

Josh Cooper (JIRA)

unread,
Oct 1, 2019, 12:12:04 AM10/1/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Platform Core Coremunity

Josh Cooper (JIRA)

unread,
Oct 7, 2019, 12:28:06 PM10/7/19
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Platform Core Coremunity Grooming

Austin Boyd (JIRA)

unread,
Dec 12, 2019, 9:02:13 AM12/12/19
to puppe...@googlegroups.com
Austin Boyd updated an issue
Change By: Austin Boyd
Zendesk Ticket IDs: 33112
Zendesk Ticket Count: 1

Josh Cooper (Jira)

unread,
Aug 18, 2020, 1:35:04 AM8/18/20
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Coremunity Grooming
This message was sent by Atlassian Jira (v8.5.2#805002-sha1:a66f935)
Atlassian logo

Josh Cooper (Jira)

unread,
May 3, 2021, 1:13:03 PM5/3/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Coremunity Night's Watch
This message was sent by Atlassian Jira (v8.13.2#813002-sha1:c495a97)
Atlassian logo

Josh Cooper (Jira)

unread,
Jun 14, 2021, 8:10:02 PM6/14/21
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-9369
 
Re: Parsedfile produces a undefined method each for nil:NilClass

The parse method of ParsedFile provider correctly returns an empty array if there are no matches, but the Nagios module overrides the parse method. One simple change here is to guard against subclasses returning nil.

Josh Cooper (Jira)

unread,
Jun 14, 2021, 8:38:02 PM6/14/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 14, 2021, 8:38:02 PM6/14/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Team: Night's Watch Coremunity

Josh Cooper (Jira)

unread,
Jun 14, 2021, 8:38:03 PM6/14/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Sprint: Platform Core KANBAN

Josh Cooper (Jira)

unread,
Jun 15, 2021, 11:54:02 AM6/15/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Fix Version/s: PUP 7.9.0
Fix Version/s: PUP 6.24.0

Josh Cooper (Jira)

unread,
Jun 15, 2021, 11:56:02 AM6/15/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
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.

Jarret Lavallee (Jira)

unread,
Jun 15, 2021, 12:01:02 PM6/15/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 16, 2021, 11:28:02 AM6/16/21
to puppe...@googlegroups.com

Josh Cooper (Jira)

unread,
Jun 16, 2021, 11:35:01 AM6/16/21
to puppe...@googlegroups.com
Josh Cooper updated an issue
Change By: Josh Cooper
Comment: Passed CI in 22699d4a48

Josh Cooper (Jira)

unread,
Jun 21, 2021, 1:29:02 PM6/21/21
to puppe...@googlegroups.com

Claire Cadman (Jira)

unread,
Jul 13, 2021, 6:36:04 AM7/13/21
to puppe...@googlegroups.com
Claire Cadman updated an issue
 
Change By: Claire Cadman
Labels: cspapercuts doc-reviewed
Reply all
Reply to author
Forward
0 new messages