Issue #22219 has been updated by Henrik Lindberg.

Subject changed from Class Scope Gotcha to Issue warning when class includes 
itself
Status changed from Unreviewed to Accepted

Since it is meaningless for a class to include itself and an indication that 
something is not right, it should at least lead to a warning. (Or even an 
error).
Why it even tries to resolve "zamboni" against itself ("role::zamboni") is a 
mystery since the name space it is in is really "role::zamboni" and it would 
have made sense to find "role::zamboni::zamboni" (if that existed), but not 
itself).

----------------------------------------
Bug #22219: Issue warning when class includes itself
https://projects.puppetlabs.com/issues/22219#change-96508

* Author: Dirk Elmendorf
* Status: Accepted
* Priority: Normal
* Assignee: 
* Category: parser
* Target version: 
* Affected Puppet version: 3.2.4
* Keywords: 
* Branch: 
----------------------------------------
Summary:  When you include a class inside a class and they have similar names 
then the new class does not get included.

Steps to Reproduce:
<pre>
class zamboni {
 notice("Class zamboni included")
}
class role::zamboni {
 notice("Class role::zamboni included")
 include zamboni
}

class role::server {
 notice("Class role::server included")
 include role::zamboni
}
</pre>
Expected Results:

Should include role::server,role::zamboni,:zamboni


Actual Results:
role::server and role::zamboni are included.  role::zamboni believes that the 
include zamboni is referring to itself so it does not include the class 
zamboni.  It still seems like there should be a warning since it doesn't really 
make sense that I would include a class in itself.

Workaround:

If I include ::zamboni in role::zamboni it doesn't get confused. 

Notes: I used zamboni to make it clear what is going on. I discovered the issue 
when I was working with the role::database::mysql & mysql

The mysql module is from the Puppet forge.




-- 
You have received this notification because you have either subscribed to it, 
or are involved in it.
To change your notification preferences, please click here: 
http://projects.puppetlabs.com/my/account

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Bugs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to