That error means that the @server_roles variable is holding nil, as nil 
does not have an each method to call. Perhaps the new parser is evaluating 
things differently and not setting that variable.

On Tuesday, July 1, 2014 5:25:15 PM UTC-7, martin...@gmail.com wrote:
>
> Henrik, Tristan, thanks for your replies!
>
> I've added "parser = future" on both master and agent, inside [main], and 
> also I'm still using "--parser future", just in case.
> You both were right, and I'd use "notify" instead of "notice" in that 
> snippet.
>
> I think that parser option is working now, but it's breaking a template 
> that was working until now. So here I go again for your help, as I don't 
> think that the parser should be doing this.
>
> Here is the output of the new error:
>
> *Error: Could not retrieve catalog from remote server: Error 400 on 
> SERVER: Failed to parse template sudo/sudoers.erb:*
> *  Filepath: 
> /etc/puppet/environments/integration/modules/sudo/templates/sudoers.erb*
> *  Line: 42*
> *  Detail: undefined method `each' for nil:NilClass*
> * on node test01*
>
> Here is the line 42 of the template file:
>
> ....<snip>...
> DEPLOY ALL = NOPASSWD: /usr/bin/service apache2 restart
> DEPLOY ALL = NOPASSWD: /usr/bin/service php5-fpm restart
> *<% @server_roles.each do |role| -%>              <====== line 42*
> <% if role == "testuser" %>
> DEPLOY ALL = NOPASSWD: /usr/bin/service tomcat7 restart
> DEPLOY ALL = NOPASSWD: /usr/bin/service tomcat7 start
> DEPLOY ALL = NOPASSWD: /usr/bin/service tomcat7 stop
> <% end %>
> ...<snip>....
>
> I've tried with "each @server_roles" too, but still broken.
> May be enabling the extra features of the parser, puppet tries to do 
> something else with the word "each", but I'm totally lost here.
>
> Is this behavior expected? Is there any way that I can debug any deeper on 
> this?
>
> Again, thanks in advance for any help.
>
> Cheers,
>
> Martin
>
>
>
>
> El martes, 1 de julio de 2014 12:27:16 UTC-3, Henrik Lindberg escribió:
>>
>> On 2014-30-06 23:58, martin...@gmail.com wrote: 
>> > Hi Puppet users! 
>> > 
>> > I'm having an issue with "each loop" on puppet, and I just can't figure 
>> > out what am I doing wrong, so any help will be much appreciated. 
>> > 
>> > Here is my test.pp example: 
>> > 
>> > class mytestclass { 
>> >    $stuff = ["1", "2", "3"] 
>> > 
>> >    each($stuff) |$x| { 
>> >      notice { $x: } 
>>
>> You probably meant 
>>
>>         notify { $x: } 
>>
>> notice is a logging function, and you can do 
>>
>>         notice $x 
>>
>> >    } 
>> > } 
>>
>> For this snippet to work, you must also do 
>>
>>     include mytestclass 
>>
>> outside the scope of that class, otherwise nothing happens. 
>>
>> > 
>> > And here is the output when trying to apply it: /"Error: Could not 
>> parse 
>> > for environment production: Could not match |$x| at /tmp/test.pp:10"/ 
>> > 
>> Sounds like --parser future is not in effect. 
>>
>> > I've "parser = future" inside my puppet.conf, ruby-rgen is installed in 
>> > both client and server. I'm also running it with "--parser future" on 
>> > the client, but no joy. 
>> > I've  been playing with variants like "$stuff.each", using hashes, and 
>> a 
>> > few more desperate ideas. 
>> > 
>> > OS: Ubuntu 12.04 
>> > Puppet: 3.5.1-1puppetlabs1 
>> > ruby-rgen: 0.6.5-1puppetlabs1 
>> > 
>> > 
>> > I'm clearly missing something, but can't find what. 
>> > 
>>
>> As another poster suggested, maybe you have the parser=future setting in 
>> the wrong section. 
>>
>> Hope the above helps 
>>
>> - henrik 
>>
>> -- 
>>
>> Visit my Blog "Puppet on the Edge" 
>> http://puppet-on-the-edge.blogspot.se/ 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/6e72c1a9-e6d9-4f88-92e9-9fb4d1624e53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to