Andree Jacobson
2011-Jan-14 16:23 UTC
[Puppet Users] Puppet''s generate conflicts with generate in ruby rails
My puppetmaster is running on a machine were we also want ruby rails installed (partially for running a separate apache server to serve puppet''s files). However, using puppet''s generate function, doesn''t work as expected with rails installed: err: Could not retrieve catalog from remote server: Error 400 on SERVER: Function ''generate'' does not return a value at /etc/puppet/ modules-development/kerberos/manifests/client.pp:45 on node pico The source of the problem seems to be: [root@puppet ~]# locate generate.rb /usr/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/commands/generate.rb /usr/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/rails_generator/scripts/ generate.rb /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/generate.rb I.e., rails installs two generate functions of it''s own and they seem to take precedence over puppet''s generate. Is there a way that I can further qualify the generate function name in a puppet manifest to make it choose puppet''s over rails'' (something like Puppet::Parser::Functions.generate)? Thanks, Andree -- 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.
James Turnbull
2011-Jan-14 16:49 UTC
Re: [Puppet Users] Puppet''s generate conflicts with generate in ruby rails
Andree Jacobson wrote:> My puppetmaster is running on a machine were we also want ruby rails > installed (partially for running a separate apache server to serve > puppet''s files). However, using puppet''s generate function, doesn''t > work as expected with rails installed: > > err: Could not retrieve catalog from remote server: Error 400 on > SERVER: Function ''generate'' does not return a value at /etc/puppet/ > modules-development/kerberos/manifests/client.pp:45 on node pico > > The source of the problem seems to be: > > [root@puppet ~]# locate generate.rb > /usr/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/commands/generate.rb > /usr/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/rails_generator/scripts/ > generate.rb > /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/generate.rbAh. I don''t think that''s your problem. Just having three files named generate.rb won''t mean there is an overlap. Perhaps if the Ruby namespaces overlapped but even then... I think your problem is exactly what Puppet is telling you ... The generate function in that manifest isn''t returning a value. Can you show us your manifest and that generate function? Regards James -- Puppet Labs - http://www.puppetlabs.com C: 503-734-8571 -- 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.
Andree Jacobson
2011-Jan-14 18:06 UTC
Re: [Puppet Users] Puppet''s generate conflicts with generate in ruby rails
Here''s the manifest: class test { file { "/tmp/test2": ensure => present, content => generate(''/usr/bin/env'', ''sh'', ''-c'', ''date''); } } This is the generate.rb from the 2.6.4 source. # Runs an external command and returns the results Puppet::Parser::Functions::newfunction(:generate, :type => :rvalue, :doc => "Calls an external command on the Puppet master and returns the results of the command. Any arguments are passed to the external command as arguments. If the generator does not exit with return code of 0, the generator is considered to have failed and a parse error is thrown. Generators can only have file separators, alphanumerics, dashes, and periods in them. This function will attempt to protect you from malicious generator calls (e.g., those with ''..'' in them), but it can never be entirely safe. No subshell is used to execute generators, so all shell metacharacters are passed directly to the generator.") do |args| raise Puppet::ParseError, "Generators must be fully qualified" unless args[0] =~ /^#{File::SEPARATOR}/ unless args[0] =~ /^[-#{File::SEPARATOR}\w.]+$/ raise Puppet::ParseError, "Generators can only contain alphanumerics, file separators, and dashes" end if args[0] =~ /\.\./ raise Puppet::ParseError, "Can not use generators with ''..'' in them." end begin Dir.chdir(File.dirname(args[0])) { Puppet::Util.execute(args) } rescue Puppet::ExecutionFailure => detail raise Puppet::ParseError, "Failed to execute generator #{args[0]}: #{detail}" end end On 01/14/2011 09:49 AM, James Turnbull wrote:> Andree Jacobson wrote: >> My puppetmaster is running on a machine were we also want ruby rails >> installed (partially for running a separate apache server to serve >> puppet''s files). However, using puppet''s generate function, doesn''t >> work as expected with rails installed: >> >> err: Could not retrieve catalog from remote server: Error 400 on >> SERVER: Function ''generate'' does not return a value at /etc/puppet/ >> modules-development/kerberos/manifests/client.pp:45 on node pico >> >> The source of the problem seems to be: >> >> [root@puppet ~]# locate generate.rb >> /usr/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/commands/generate.rb >> /usr/lib/ruby/gems/1.8/gems/rails-2.1.1/lib/rails_generator/scripts/ >> generate.rb >> /usr/lib/ruby/site_ruby/1.8/puppet/parser/functions/generate.rb > Ah. I don''t think that''s your problem. Just having three files named > generate.rb won''t mean there is an overlap. Perhaps if the Ruby > namespaces overlapped but even then... > > I think your problem is exactly what Puppet is telling you ... The > generate function in that manifest isn''t returning a value. Can you > show us your manifest and that generate function? > > Regards > > James >-- 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.
James Turnbull
2011-Jan-14 19:13 UTC
Re: [Puppet Users] Puppet''s generate conflicts with generate in ruby rails
Andree Jacobson wrote:> file { "/tmp/test2": > ensure => present, > content => generate(''/usr/bin/env'', ''sh'', ''-c'', ''date''); > }When I run your manifest I get: $ puppet gen.pp notice: /Stage[main]//File[/tmp/test2]/ensure: created $ cat /tmp/test2 Sat Jan 15 06:10:23 EST 2011 What platform are you using? And Puppet version? Regards James Turnbull -- Puppet Labs - http://www.puppetlabs.com C: 503-734-8571 -- 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.
Andree Jacobson
2011-Jan-14 20:06 UTC
Re: [Puppet Users] Puppet''s generate conflicts with generate in ruby rails
When I uninstall the rubygem-rails package, I get the expected result as well. I''m on CentOS 5.5, Puppet 2.6.4 - rpm built from source. It does not matter what client version it''s running on. Here are the relevant packages installed: puppet.x86_64 2.6.4-1.NMC installed puppet-server.x86_64 2.6.4-1.NMC installed facter.x86_64 1.5.8-1.NMC installed rubygem-rails.noarch 2.1.1-2.el5 installed From facter: puppetversion => 2.6.4 rubysitedir => /usr/lib/ruby/site_ruby/1.8 rubyversion => 1.8.5 As soon as I uninstall ruby rails, and restart the puppetmaster. Everything works the way it should. Reinstall rails, restart puppet master, this error starts occurring again. It only behaves this way for the generate function, everything else I have tried seems to work. /Andree On 01/14/2011 12:13 PM, James Turnbull wrote:> Andree Jacobson wrote: >> file { "/tmp/test2": >> ensure => present, >> content => generate(''/usr/bin/env'', ''sh'', ''-c'', ''date''); >> } > When I run your manifest I get: > > $ puppet gen.pp > notice: /Stage[main]//File[/tmp/test2]/ensure: created > $ cat /tmp/test2 > Sat Jan 15 06:10:23 EST 2011 > > What platform are you using? And Puppet version? > > Regards > > James Turnbull >-- 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.
Andree Jacobson
2011-Jan-14 23:56 UTC
Re: [Puppet Users] Puppet''s generate conflicts with generate in ruby rails
The problem seems to have resolved itself after we fixed a known bug in ruby rails / rack that also prevented us from getting the apache web server integrated. Thanks for all your useful comments. /Andree On 01/14/2011 01:06 PM, Andree Jacobson wrote:> When I uninstall the rubygem-rails package, I get the expected result > as well. > > I''m on CentOS 5.5, Puppet 2.6.4 - rpm built from source. > It does not matter what client version it''s running on. > > Here are the relevant packages installed: > puppet.x86_64 2.6.4-1.NMC > installed > puppet-server.x86_64 2.6.4-1.NMC > installed > facter.x86_64 1.5.8-1.NMC > installed > rubygem-rails.noarch 2.1.1-2.el5 > installed > > From facter: > puppetversion => 2.6.4 > rubysitedir => /usr/lib/ruby/site_ruby/1.8 > rubyversion => 1.8.5 > > As soon as I uninstall ruby rails, and restart the puppetmaster. > Everything works the way it should. > Reinstall rails, restart puppet master, this error starts occurring again. > > It only behaves this way for the generate function, everything else I > have tried seems to work. > > /Andree > > On 01/14/2011 12:13 PM, James Turnbull wrote: >> Andree Jacobson wrote: >>> file { "/tmp/test2": >>> ensure => present, >>> content => generate(''/usr/bin/env'', ''sh'', ''-c'', ''date''); >>> } >> When I run your manifest I get: >> >> $ puppet gen.pp >> notice: /Stage[main]//File[/tmp/test2]/ensure: created >> $ cat /tmp/test2 >> Sat Jan 15 06:10:23 EST 2011 >> >> What platform are you using? And Puppet version? >> >> Regards >> >> James Turnbull >>-- 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.
Daniel Pittman
2011-Jan-15 00:10 UTC
Re: [Puppet Users] Puppet''s generate conflicts with generate in ruby rails
Hey, good news that you got it fixed. Could you post a link to the bug so that we can add it to the FAQ or whatever and save the next person who hits it the same round of trouble? Thanks, Daniel On Fri, Jan 14, 2011 at 15:56, Andree Jacobson <andree@newmexicoconsortium.org> wrote:> The problem seems to have resolved itself after we fixed a known bug in ruby > rails / rack that also prevented us from getting the apache web server > integrated. Thanks for all your useful comments. > > /Andree > > On 01/14/2011 01:06 PM, Andree Jacobson wrote: > > When I uninstall the rubygem-rails package, I get the expected result as > well. > > I''m on CentOS 5.5, Puppet 2.6.4 - rpm built from source. > It does not matter what client version it''s running on. > > Here are the relevant packages installed: > puppet.x86_64 2.6.4-1.NMC > installed > puppet-server.x86_64 2.6.4-1.NMC > installed > facter.x86_64 1.5.8-1.NMC > installed > rubygem-rails.noarch 2.1.1-2.el5 > installed > > From facter: > puppetversion => 2.6.4 > rubysitedir => /usr/lib/ruby/site_ruby/1.8 > rubyversion => 1.8.5 > > As soon as I uninstall ruby rails, and restart the puppetmaster. Everything > works the way it should. > Reinstall rails, restart puppet master, this error starts occurring again. > > It only behaves this way for the generate function, everything else I have > tried seems to work. > > /Andree > > On 01/14/2011 12:13 PM, James Turnbull wrote: > > Andree Jacobson wrote: > > file { "/tmp/test2": > ensure => present, > content => generate(''/usr/bin/env'', ''sh'', ''-c'', ''date''); > } > > When I run your manifest I get: > > $ puppet gen.pp > notice: /Stage[main]//File[/tmp/test2]/ensure: created > $ cat /tmp/test2 > Sat Jan 15 06:10:23 EST 2011 > > What platform are you using? And Puppet version? > > Regards > > James Turnbull > > -- > 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. >-- ✉ Daniel Pittman <daniel@rimspace.net> ⌨ daniel@rimspace.net (XMPP) ☎ +1 503 893 2285 ♻ made with 100 percent post-consumer electrons -- 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.
Andree Jacobson
2011-Jan-16 23:32 UTC
Re: [Puppet Users] Puppet''s generate conflicts with generate in ruby rails
The issue will probably go away as CentOS get more updated packages of Ruby, but for now it still exists. Issue on GitHub: https://github.com/rack/rack/issues/issue/29 Link to patch for fix: https://gist.github.com/441238 While I can''t say for sure that we tracked the puppet issue to this. After the patch was applied, the issue with puppet disappeared. /Andree On 1/14/11 5:10 PM, Daniel Pittman wrote:> Hey, good news that you got it fixed. Could you post a link to the > bug so that we can add it to the FAQ or whatever and save the next > person who hits it the same round of trouble? > > Thanks, > Daniel > > On Fri, Jan 14, 2011 at 15:56, Andree Jacobson > <andree@newmexicoconsortium.org> wrote: >> The problem seems to have resolved itself after we fixed a known bug in ruby >> rails / rack that also prevented us from getting the apache web server >> integrated. Thanks for all your useful comments. >> >> /Andree >> >> On 01/14/2011 01:06 PM, Andree Jacobson wrote: >> >> When I uninstall the rubygem-rails package, I get the expected result as >> well. >> >> I''m on CentOS 5.5, Puppet 2.6.4 - rpm built from source. >> It does not matter what client version it''s running on. >> >> Here are the relevant packages installed: >> puppet.x86_64 2.6.4-1.NMC >> installed >> puppet-server.x86_64 2.6.4-1.NMC >> installed >> facter.x86_64 1.5.8-1.NMC >> installed >> rubygem-rails.noarch 2.1.1-2.el5 >> installed >> >> From facter: >> puppetversion => 2.6.4 >> rubysitedir => /usr/lib/ruby/site_ruby/1.8 >> rubyversion => 1.8.5 >> >> As soon as I uninstall ruby rails, and restart the puppetmaster. Everything >> works the way it should. >> Reinstall rails, restart puppet master, this error starts occurring again. >> >> It only behaves this way for the generate function, everything else I have >> tried seems to work. >> >> /Andree >> >> On 01/14/2011 12:13 PM, James Turnbull wrote: >> >> Andree Jacobson wrote: >> >> file { "/tmp/test2": >> ensure => present, >> content => generate(''/usr/bin/env'', ''sh'', ''-c'', ''date''); >> } >> >> When I run your manifest I get: >> >> $ puppet gen.pp >> notice: /Stage[main]//File[/tmp/test2]/ensure: created >> $ cat /tmp/test2 >> Sat Jan 15 06:10:23 EST 2011 >> >> What platform are you using? And Puppet version? >> >> Regards >> >> James Turnbull >> >> -- >> 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. >> > >-- 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.
Andree Jacobson
2011-Jan-17 18:34 UTC
Re: [Puppet Users] Puppet''s generate conflicts with generate in ruby rails
Spoke too soon. Problem still exists. Will investigate further. Any insights on how to control ruby''s import order, or how to further qualify a function like generate might be helpful. Thanks, Andree On 01/16/2011 04:32 PM, Andree Jacobson wrote:> The issue will probably go away as CentOS get more updated packages of > Ruby, but for now it still exists. > > Issue on GitHub: > https://github.com/rack/rack/issues/issue/29 > > Link to patch for fix: > https://gist.github.com/441238 > > While I can''t say for sure that we tracked the puppet issue to this. > After the patch was applied, the issue with puppet disappeared. > > /Andree-- 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.