Issue #5260 has been updated by Brice Figureau.
Brice Figureau wrote:
> Namespaces are contants and are not evaluated, hence you can't use a variable
> in them.
> Like you wrote, the workaround is to embed those in a string.
> I don't think this is a bug per se, it's more like a new feature to me.
I forgot to say that it's not specific to case statement:
<pre>
lass foo::bar {
}
$bar = "bar"
include foo::$bar
</pre>
also fails.
----------------------------------------
Bug #5260: including namespaced classes (with a variable) is a parser error in
a case statement
https://projects.puppetlabs.com/issues/5260
Author: Jordan Sissel
Status: Unreviewed
Priority: Normal
Assignee:
Category:
Target version:
Affected Puppet version: 2.6.2
Keywords: grammar case variable
Branch:
Reported in #puppet on freenode tonight. Here's a simple reproduce case:
<pre>
class foo::bar {
}
$bar = "bar"
case "hello" {
"hello": { include foo::$bar }
}
</pre>
This results in a parser error: err: Could not parse for environment
production: Syntax error at ':'; expected '}' at /home/jls/test.pp:6
Seems like the grammar for case is too greedy about looking for ':' symbols
when variables are in consideration.
To clarify, here is what I know:
* works: <pre> "hello": { include foo::bar } </pre>
* fails, but should work: <pre> "hello": { include foo::$something } </pre>
* works, workaround for above: <pre> "hello": { include "foo::$something" }
</pre>
--
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/puppet-bugs?hl=en.