Bug #1372
Class names that match the node name are not evaluated
| Status: | Accepted | Start date: | 06/16/2008 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | - | % Done: | 0% |
|
| Category: | language | |||
| Target version: | 2.7.x | |||
| Affected Puppet version: | 0.24.4 | Branch: | ||
| Keywords: | devtriage | |||
| Votes: | 1 |
Description
If I setup:
class subversion { warning(“I am class subversion”) }
and in my nodes.pp I have
node subversion { include subversion }
When i run puppet in verbose mode on subversion, I never see that warning.
History
Updated by AJ Christensen almost 4 years ago
- Category set to language
- Status changed from Unreviewed to Needs More Information
- Assignee set to Luke Kanies
I can reproduce this with the current 0.24.x HEAD:
aj@junglist /tmp$ cat test.pp
#!/usr/bin/env puppet
class junglist {
notify { "I am class junglist": }
}
node junglist {
include junglist
}
aj@junglist /tmp$ ./test.pp --debug
debug: Creating default schedules
debug: Finishing transaction -609513118 with 0 changes
Luke, can you please clarify if this is desired behaviour? Should we at least be throwing a top-level duplicate class error?
Updated by Luke Kanies almost 4 years ago
- Status changed from Needs More Information to Accepted
There should actually be an exception there, I’m pretty sure. I know my intention was that this throw an exception, because I haven’t been all that careful to make sure naming collisions don’t cause problems, so I knew an exception was important.
Probably the right move, at this point, is to make the ASTSet in parser/parser_support.rb into a class, which can then do validation as nodes et al are added.
Updated by Digant Kasundra almost 4 years ago
Some thoughts on this…
I think it shouldn’t be an exception. I know eventually, this is probably solved by an external node tool, but as it stands now, we often have classes that have the same name as nodes and I’d really hate to rename classes/modules to something else just to avoid that name collision. Isn’t there any other way to handle this such that a node is a node and can be the same name as a class? I know the direction that was discussed was to eventuall treat nodes as classes (or perhaps that’s what’s happening now), but this is somewhat limiting.
Updated by Luke Kanies over 3 years ago
- Target version set to 0.24.6
I think this is actually going to be straightforward, so I’m going to try to fit it into 0.24.6.
Updated by Luke Kanies over 3 years ago
The problem here is that I’ve got a single @class_scope hash for the entire compile, and it stores both node and class scopes, with no typing (i.e., the node and class scopes aren’t separated in any way).
This looks pretty unnecessary, so it should be straightforward to just add a node_scope hash to go with the class_scope hash.
Updated by Luke Kanies over 3 years ago
- Target version changed from 0.24.6 to 4
This is harder than I thought, so I’m bumping it.
Updated by Luke Kanies about 2 years ago
- Assignee changed from Luke Kanies to Markus Roberts
- Target version changed from 4 to 2.7.x
Updated by Joshua Lifton 5 months ago
- Assignee deleted (
Markus Roberts)
This issue was assigned to a former Puppet Labs employee. Adding back to the pool of unreviewed issues.
Updated by Joshua Lifton 5 months ago
This issue was assigned to a former Puppet Labs employee. Adding back to the pool of unreviewed issues.
Updated by Ben Hughes 4 months ago
- Description updated (diff)
- Status changed from Accepted to Unreviewed
Updated by Michael Stahnke 4 months ago
- Description updated (diff)
- Status changed from Unreviewed to Accepted
- Keywords set to devtriage
[root@centos tests]# cat test.pp
class centos {
notice ("Class centos")
}
node centos {
include centos
notice ("Node centos")
}
[root@centos tests]# !pup
puppet apply --verbose test.pp
dnsdomainname: Unknown host
notice: Scope(Node[centos]): Node centos
info: Applying configuration version '1327167310'
notice: Finished catalog run in 0.02 seconds
[root@centos tests]#
Still an issue in 2.7.9.