Martin Alfke
2011-Nov-17 08:18 UTC
[Puppet Users] Puppet throws error when evaluating block after statement
Hi, using the following manifests inside a module: define base_users::usermanagement($gid='''', $uid='''', $groups='''', $comment='''', $home='''', $ensure=present) { if ($comment == '''' ) { fail(''need full username'') } } when running a test: tests/init.pp base_users::usermanagement { ''alfke'': gid => 1024, uid => 1024, comment => ''Martin Alfke'', } The following error shows up: Could not parse for environment production: Could not match { at /Users/mea/Documents/Work/puppet/modules/base_users/manifests/usermanagement2.pp:3 on node martin-alfkes-macbook.local Note: I am not using environments. facter puppetversion 2.7.6 The error occurs on Debian Squeeze and Lenny and on my MacBook. This is the debug and trace output: puppet apply -v --noop --modulepath=/Users/mea/Documents/Work/puppet/modules/ --debug --trace test/init.pp debug: importing ''/Users/mea/Documents/Work/puppet/modules/base_users/manifests/init.pp'' in environment production debug: importing ''/Users/mea/Documents/Work/puppet/modules/base_users/manifests/usermanagement.pp'' in environment production /Library/Ruby/Site/1.8/puppet/parser/lexer.rb:19:in `lex_error'' /Library/Ruby/Site/1.8/puppet/parser/lexer.rb:453:in `scan'' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:152:in `_racc_yyparse_c'' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:152:in `__send__'' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:152:in `yyparse'' /Library/Ruby/Site/1.8/puppet/parser/parser_support.rb:153:in `parse'' /Library/Ruby/Site/1.8/puppet/node/environment.rb:159:in `perform_initial_import'' /Library/Ruby/Site/1.8/puppet/node/environment.rb:84:in `known_resource_types'' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'' /Library/Ruby/Site/1.8/puppet/node/environment.rb:81:in `known_resource_types'' /Library/Ruby/Site/1.8/puppet/resource/type_collection_helper.rb:5:in `known_resource_types'' /Library/Ruby/Site/1.8/puppet/parser/compiler.rb:428:in `initvars'' /Library/Ruby/Site/1.8/puppet/parser/compiler.rb:186:in `initialize'' /Library/Ruby/Site/1.8/puppet/parser/compiler.rb:24:in `new'' /Library/Ruby/Site/1.8/puppet/parser/compiler.rb:24:in `compile'' /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:77:in `compile'' /Library/Ruby/Site/1.8/puppet/util.rb:185:in `benchmark'' /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:75:in `compile'' /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:35:in `find'' /Library/Ruby/Site/1.8/puppet/indirector/indirection.rb:189:in `find'' /Library/Ruby/Site/1.8/puppet/application/apply.rb:204:in `main'' /Library/Ruby/Site/1.8/puppet/application/apply.rb:135:in `run_command'' /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' /Library/Ruby/Site/1.8/puppet/application.rb:410:in `hook'' /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' /Library/Ruby/Site/1.8/puppet/application.rb:401:in `exit_on_fail'' /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' /Library/Ruby/Site/1.8/puppet/util/command_line.rb:69:in `execute'' /usr/bin/puppet:4 /Library/Ruby/Site/1.8/puppet/parser/compiler.rb:27:in `compile'' /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:77:in `compile'' /Library/Ruby/Site/1.8/puppet/util.rb:185:in `benchmark'' /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:75:in `compile'' /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:35:in `find'' /Library/Ruby/Site/1.8/puppet/indirector/indirection.rb:189:in `find'' /Library/Ruby/Site/1.8/puppet/application/apply.rb:204:in `main'' /Library/Ruby/Site/1.8/puppet/application/apply.rb:135:in `run_command'' /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' /Library/Ruby/Site/1.8/puppet/application.rb:410:in `hook'' /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' /Library/Ruby/Site/1.8/puppet/application.rb:401:in `exit_on_fail'' /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' /Library/Ruby/Site/1.8/puppet/util/command_line.rb:69:in `execute'' /usr/bin/puppet:4 Could not parse for environment production: Could not match { at /Users/mea/Documents/Work/puppet/modules/base_users/manifests/usermanagement2.pp:3 on node martin-alfkes-macbook.local Any hints?? Thank you, Martin -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2011-Nov-17 13:49 UTC
[Puppet Users] Re: Puppet throws error when evaluating block after statement
On Nov 17, 2:18 am, Martin Alfke <tux...@gmail.com> wrote:> Hi, > > using the following manifests inside a module: > > define base_users::usermanagement($gid='''', $uid='''', $groups='''', $comment='''', $home='''', $ensure=present) { > > if ($comment == '''' ) { > fail(''need full username'') > } > > } > > when running a test: > > tests/init.pp > base_users::usermanagement { > ''alfke'': > gid => 1024, > uid => 1024, > comment => ''Martin Alfke'', > > } > > The following error shows up: > > Could not parse for environment production: Could not match { at /Users/mea/Documents/Work/puppet/modules/base_users/manifests/usermanagement2.pp:3 on node martin-alfkes-macbook.local > > Note: I am not using environments. > > facter puppetversion > 2.7.6 > > The error occurs on Debian Squeeze and Lenny and on my MacBook. > > This is the debug and trace output: > > puppet apply -v --noop --modulepath=/Users/mea/Documents/Work/puppet/modules/ --debug --trace test/init.pp > debug: importing ''/Users/mea/Documents/Work/puppet/modules/base_users/manifests/init.pp'' in environment production > debug: importing ''/Users/mea/Documents/Work/puppet/modules/base_users/manifests/usermanagement.pp'' in environment production > /Library/Ruby/Site/1.8/puppet/parser/lexer.rb:19:in `lex_error'' > /Library/Ruby/Site/1.8/puppet/parser/lexer.rb:453:in `scan'' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:152:in `_racc_yyparse_c'' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:152:in `__send__'' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/racc/parser.rb:152:in `yyparse'' > /Library/Ruby/Site/1.8/puppet/parser/parser_support.rb:153:in `parse'' > /Library/Ruby/Site/1.8/puppet/node/environment.rb:159:in `perform_initial_import'' > /Library/Ruby/Site/1.8/puppet/node/environment.rb:84:in `known_resource_types'' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'' > /Library/Ruby/Site/1.8/puppet/node/environment.rb:81:in `known_resource_types'' > /Library/Ruby/Site/1.8/puppet/resource/type_collection_helper.rb:5:in `known_resource_types'' > /Library/Ruby/Site/1.8/puppet/parser/compiler.rb:428:in `initvars'' > /Library/Ruby/Site/1.8/puppet/parser/compiler.rb:186:in `initialize'' > /Library/Ruby/Site/1.8/puppet/parser/compiler.rb:24:in `new'' > /Library/Ruby/Site/1.8/puppet/parser/compiler.rb:24:in `compile'' > /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:77:in `compile'' > /Library/Ruby/Site/1.8/puppet/util.rb:185:in `benchmark'' > /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:75:in `compile'' > /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:35:in `find'' > /Library/Ruby/Site/1.8/puppet/indirector/indirection.rb:189:in `find'' > /Library/Ruby/Site/1.8/puppet/application/apply.rb:204:in `main'' > /Library/Ruby/Site/1.8/puppet/application/apply.rb:135:in `run_command'' > /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' > /Library/Ruby/Site/1.8/puppet/application.rb:410:in `hook'' > /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' > /Library/Ruby/Site/1.8/puppet/application.rb:401:in `exit_on_fail'' > /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' > /Library/Ruby/Site/1.8/puppet/util/command_line.rb:69:in `execute'' > /usr/bin/puppet:4 > /Library/Ruby/Site/1.8/puppet/parser/compiler.rb:27:in `compile'' > /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:77:in `compile'' > /Library/Ruby/Site/1.8/puppet/util.rb:185:in `benchmark'' > /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:75:in `compile'' > /Library/Ruby/Site/1.8/puppet/indirector/catalog/compiler.rb:35:in `find'' > /Library/Ruby/Site/1.8/puppet/indirector/indirection.rb:189:in `find'' > /Library/Ruby/Site/1.8/puppet/application/apply.rb:204:in `main'' > /Library/Ruby/Site/1.8/puppet/application/apply.rb:135:in `run_command'' > /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' > /Library/Ruby/Site/1.8/puppet/application.rb:410:in `hook'' > /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' > /Library/Ruby/Site/1.8/puppet/application.rb:401:in `exit_on_fail'' > /Library/Ruby/Site/1.8/puppet/application.rb:306:in `run'' > /Library/Ruby/Site/1.8/puppet/util/command_line.rb:69:in `execute'' > /usr/bin/puppet:4 > Could not parse for environment production: Could not match { at /Users/mea/Documents/Work/puppet/modules/base_users/manifests/usermanagement2.pp:3 on node martin-alfkes-macbook.local > > Any hints?? > > Thank you, > > MartinPuppet does not require parentheses around the condition of an ''if'' statement. Try removing those. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Martin Alfke
2011-Nov-17 14:16 UTC
[Solved] [Puppet Users] Puppet throws error when evaluating block after statement
On 17.11.2011, at 14:49, jcbollinger wrote:> > > On Nov 17, 2:18 am, Martin Alfke <tux...@gmail.com> wrote: >> Hi, >> >> using the following manifests inside a module: >> >> define base_users::usermanagement($gid='''', $uid='''', $groups='''', $comment='''', $home='''', $ensure=present) { >> >> if ($comment == '''' ) { >> fail(''need full username'') >> } >> >> } >> >> when running a test: >> >> tests/init.pp >> base_users::usermanagement { >> ''alfke'': >> gid => 1024, >> uid => 1024, >> comment => ''Martin Alfke'', >> >> } >> >> The following error shows up: >> >> Could not parse for environment production: Could not match { at /Users/mea/Documents/Work/puppet/modules/base_users/manifests/usermanagement2.pp:3 on node martin-alfkes-macbook.local >> >> Note: I am not using environments. >> >> facter puppetversion >> 2.7.6 >> >> [...] >> >> Any hints?? >> >> Thank you, >> >> Martin > > > Puppet does not require parentheses around the condition of an ''if'' > statement. Try removing those.We found, that we had some hidden, invisible characters in that line. Neither vim nor nano showed those characters. Problem is solved by removing and retyping the affected lines. Kind regards, Martin -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Evan Hisey
2011-Nov-21 18:16 UTC
Re: [Solved] [Puppet Users] Puppet throws error when evaluating block after statement
> > We found, that we had some hidden, invisible characters in that line. > Neither vim nor nano showed those characters. > > Problem is solved by removing and retyping the affected lines. > > Kind regards, > > Martin > >Not a completely uncommon issue for some reason. I have encountered it a few times myself. evan -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.