[PUP-9190] Puppet should ignore empty init.pp Created: 2018/10/01  Updated: 2018/10/24  Resolved: 2018/10/23

Status: Closed
Project: Puppet
Component/s: None
Affects Version/s: None
Fix Version/s: PUP 5.5.7, PUP 6.0.3

Type: Bug Priority: Normal
Reporter: Josh Cooper Assignee: Kris Bosland
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File empty_init-pp.csv    
Issue Links:
Relates
relates to PUP-4242 Add errors for manifests declaring th... Closed
Template:
Team: Coremunity
Sprint: Platform Core KANBAN
Method Found: Needs Assessment
Release Notes: Bug Fix
Release Notes Summary: Empty or comments only files will no longer emit a deprecation warning or error about illegal top level construct.
QA Risk Assessment: Needs Assessment

 Description   

Puppet6 will error if a module contains an empty init.pp. The module documentation says, "init.pp: Contains a class definition. The init.pp class, if used, is the main class of the module. This class's name must match the module's name."

So the init.pp file is optional, but we don't specify whether the file can exist, but be empty or if it only contains a defined type.

We discovered in MODULES-7854 that some people may have empty init.pp and puppet should be more lenient. For now, we removed the empty init.pp from the rspec-puppet's module fixtures.

/cc Henrik Lindberg, Kris Bosland, Ben Ford, Charlie Sharpsteen, Eric Sorenson



 Comments   
Comment by Henrik Lindberg [ 2018/10/01 ]

Uh oh, that sounds as a bug in the checker - if it is empty it should not find a class in that file and should have nothing at all to verify, seems like it goes off the road with a strange error message.

Comment by Kris Bosland [ 2018/10/08 ]

Should any file be allowed to be empty, or just the special init.pp?  /cc Henrik Lindberg, Josh Cooper, Charlie Sharpsteen, Ben Ford

Comment by Charlie Sharpsteen [ 2018/10/08 ]

Allowing any .pp file to be empty seems less complicated all around to me.

Comment by Henrik Lindberg [ 2018/10/09 ]

Well, some files cannot really be empty, but those are checked by the loaders (functions and data types in .pp files for example). Validation should just accept "empty" files ("empty" here meaning no resulting AST as there could example be comments etc. so file may not be exactly void of content to be considered empty).

Comment by Josh Cooper [ 2018/10/11 ]

Merged to 5.5.x in https://github.com/puppetlabs/puppet/commit/f1f7b2322dc2f9b58b3315f3833d484a09981348

Generated at Thu Dec 13 18:37:11 PST 2018 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.