[PUP-3054] Class inheritance behaving incorrectly in the future parser Created: 2014/08/13  Updated: 2019/04/04  Resolved: 2014/08/20

Status: Closed
Project: Puppet
Component/s: Compiler
Affects Version/s: None
Fix Version/s: PUP 3.7.0

Type: Bug Priority: Blocker
Reporter: Andrew Parker Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
relates to PUP-121 Remove relative namespacing Closed
relates to PUP-5877 acceptance: puppet class inheritance Closed
Epic Link: Puppet 4 Language
Story Points: 1
Sprint: 2014-08-20
QA Contact: Kurt Wall


Erik Dalén commented on PUP-121 with a problem that he uncovered. It looks like class inheritance is encountering problems in the future parser.

When I'm testing master atm with future parser:

class bar { notice("This is class $name") }
class foo::bar { notice("This is class $name") }
class foo inherits bar { notice("This is class $name") }
include foo
$ puppet apply --parser=future test.pp
Notice: Scope(Class[Foo::Bar]): This is class foo::bar
Notice: Scope(Class[Foo]): This is class foo
Error: Could not find class foo on node valentina.local
Error: Could not find class foo on node valentina.local

So, you get both two of the three classes and then it complains it couldn't find a third class (that it already included)

Comment by Andrew Parker [ 2014/08/15 ]

The fix was pretty simple. When the Puppet 4 AST information is adapted to use the Puppet 3 catalog resources, it needs to make sure that the reference to other classes are absolute. This just takes prefixing with :: when it isn't already there.

Comment by Henrik Lindberg [ 2014/08/18 ]

Merged (manually) to master at dbf30216dfa6656a75bc967c072f7182f3ae08fc after having fixed up one performance enhancement that altered semantics.

Comment by Hailee Kenney [ 2014/08/20 ]

Confirmed at 30e4febe85e24c278a2830530965871dc3c0eec1 that we're now getting the correct output:

> bundle exec puppet apply --parser=future test.pp                                                                          
Notice: Scope(Class[Bar]): This is class bar
Notice: Scope(Class[Foo]): This is class foo

Generated at Fri Aug 07 08:26:05 PDT 2020 using Jira 8.5.2#805002-sha1:a66f9354b9e12ac788984e5d84669c903a370049.