Details
-
Bug
-
Status: Resolved
-
Normal
-
Resolution: Fixed
-
PUP 5.5.8
-
None
-
Coremunity
-
Platform Core KANBAN
-
Customer Feedback
-
33112
-
1
-
Bug Fix
-
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.