Rastio Hodul
2012-Jul-11 18:02 UTC
[Puppet Users] PROBLEM: Puppet functions execute during compile time...
Hi, I''m new to Puppet. I''m writing the script that installs LAMP+Drupal. At the end of the script I need to setup a cron. But for that I need to read certain key that has been generated during install. So I''m trying use generate() function, BUT it evaluates during compile time at which the key has not been generated yet. Is there any way to order the execution of functions (I guess not)? Or, is there any other way to read something from database in a controlled time and order? Thank you! -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/2L8aMfBKLJwJ. 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.
Felix Frank
2012-Jul-12 11:07 UTC
Re: [Puppet Users] PROBLEM: Puppet functions execute during compile time...
Hi, On 07/11/2012 08:02 PM, Rastio Hodul wrote:> Hi, > I''m new to Puppet. > > I''m writing the script that installs LAMP+Drupal. > > At the end of the script I need to setup a cron. But for that I need to > read certain key that has been generated during install. > So I''m trying use generate() function, BUT it evaluates during compile > time at which the key has not been generated yet.it also evaluates on the *master*, not the agent, so you won''t have any luck with that.> Is there any way to order the execution of functions (I guess not)? > Or, is there any other way to read something from database in a > controlled time and order?Tricky. I guess the canon approach would be to write a custom fact that retrieves the value for you after puppet has completed the setup on your agent. During the next agent run, the cron can be generated using the information from the fact. The manifest should look like this: if $myvalue { cron { "mycron": command => "/some/thing/with $myvalue ...", ... } } so that the cron will only be created once the fact is indeed available. HTH, Felix -- 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.