Bug #5571
closedPuppet "each" function makes Foreman not show a class
Description
I have a Puppet class that contains :
$listen.each |$port|{
apache::listen{"$port": }
}
If the class has this, it won't appear in the importer.
If the class does not have this, class appears.
I've just installed Foreman and this is the first thing I tried to do and this is not working...
Updated by Stephen Benjamin over 10 years ago
.each requires `parser = future` configured, is that enabled in the puppet.conf?
Updated by Stephen Benjamin over 10 years ago
Also `parser = future` needs to be in the [master] section not [main] for Foreman, that's due to #5522.
Updated by Vincent Miszczak over 10 years ago
I had this option enabled before installing Foreman on my test Puppet. Foreman replaced Puppet configuration and the value was not there anymore.
But if I put `parser = future` in [main], my class won't appear but worst, Foreman wants to remove all my classes !
production Remove: apache, ...
Updated by Vincent Miszczak over 10 years ago
Vincent Miszczak wrote:
I had this option enabled before installing Foreman on my test Puppet. Foreman replaced Puppet configuration and the value was not there anymore.
But if I put `parser = future` in [main], my class won't appear but worst, Foreman wants to remove all my classes !
production Remove: apache, ...
You should have read `parser = future` in [*master*] ofc.
Updated by Dominic Cleal over 10 years ago
- Project changed from Foreman to Smart Proxy
- Category deleted (
Puppet integration)
If you're using Puppet 3.5 then there's also bug #5239 where our future parser support's currently broken.
Updated by Jason Knudsen over 10 years ago
I'm also seeing an issue whereby the foreman_proxy fails to import classes if they have 'future parser' code within.
ENV: CentOS 6.5
Puppet: 3.6.2
Foreman: 1.5.1
Error:
Error while parsing /path/to/init.pp: Could not match |$key, at line 404
Line 404 in init.pp:
each($foreman_api::servers) |$key, $value| {
My current workaround is to create a blank module, run the foreman classes import, then update the module to contain my future parsed code.
Updated by Jason Knudsen over 10 years ago
Oh and yes, I have parser = future in the main and master sections of puppet.conf
Updated by Jason Knudsen over 10 years ago
Upon further investigation, it seems to be a problem with determining which parser to use when it reads from puppet.conf, it doesn't discover that I'm using parser = future and continues to use the old parser. It may be something specific to my environment, but if I set eparser = true in the ruby code, it succeeds to import the class correctly.
Updated by Anonymous over 9 years ago
I can't replicate the issue with Puppet 3.8.1: if the "parser" setting in puppet.conf is set to "future", modules containing future-parser compatible syntax get loaded and parsed as expected.