[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
relates to PUP-121 Remove relative namespacing Closed
relates to PUP-5877 acceptance: puppet class inheritance Closed
Template:
Epic Link: Puppet 4 Language
Story Points: 1
Sprint: 2014-08-20
QA Contact: Kurt Wall

 Description   

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)



 Comments   
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 Thu Nov 14 00:32:57 PST 2019 using JIRA 7.7.1#77002-sha1:e75ca93d5574d9409c0630b81c894d9065296414.