Hi. Say you have a definition to make a series of resources configured with parameters. Later on, on a class, node or definition, you want to ensure the first definition is done before/after you. How do you do it? You cant use the definition "type" as you use resources, like define x() { } ... require => X["name"] right? What can you do to ensure the proper order? Best regards, -- ------------------------------ Jesús Couto F. -- 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.
To show I''m a complete clueless newbie, let me add the more fundamental question "resources on a class/definitions get done on the order it is specifed, right? No need to require/before them inside, right?" to the other one. -- ------------------------------ Jesús Couto F. -- 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.
Silviu Paragina
2010-Jan-18 11:48 UTC
Re: [Puppet Users] Re: Using require/before & definitions?
Resources are not guaranteed to run in any order. If you use puppet often and you forget some requires you will notice that the resources don''t get run in the same order, use require and before, if you need a resource ensured before another. If I remember right, and nothing changed from the moment I read this, definitions allow require. But be warned it''s not quite the require you would expect. It''s more of a resources in the define inherit this require. So all resources in the define get the require *except* those that have a require in the definition. Check the second example from http://docs.reductivelabs.com/guides/language_tutorial.html#definitions for the smart way to do this, this one should be right and up to date. Silviu On 01/18/2010 01:07 PM, Jesús Couto wrote:> To show I''m a complete clueless newbie, let me add the more > fundamental question "resources on a class/definitions get done on the > order it is specifed, right? No need to require/before them inside, > right?" to the other one. > > > > > -- > ------------------------------ > > Jesús Couto F. > > > -- > 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.
Silviu Paragina
2010-Jan-18 11:54 UTC
Re: [Puppet Users] Re: Using require/before & definitions?
Oh I forgot to add. Usually you can avoid depending on resources in a define, and most of the times you should stay away. The only useful way to use this is either in another define or a specific class that does something. Otherwise you might want to include the resource that requires the definition to be applied in the definition. Also note the difference between classes and definition, and where should you use one or another (as a newbie you usually get the two mixed up) http://docs.reductivelabs.com/guides/language_tutorial.html#classes_vs_definitions (here it is explained) Silviu On 01/18/2010 01:07 PM, Jesús Couto wrote:> To show I''m a complete clueless newbie, let me add the more > fundamental question "resources on a class/definitions get done on the > order it is specifed, right? No need to require/before them inside, > right?" to the other one. > > > > > -- > ------------------------------ > > Jesús Couto F. > > > -- > 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.
Thomas Bellman
2010-Jan-18 15:32 UTC
Re: [Puppet Users] Using require/before & definitions?
Jesús Couto wrote:> How do you do it? You cant use the definition "type" as you use > resources, like > > define x() { > } > > ... > > require => X["name"] > > right? What can you do to ensure the proper order?You haven''t tried that, I assume? Because if you had, you would likely have found that it *does* work. Definitions work like any other resource types, so you can have them in all the dependency metaparameters. /Bellman --00148520fcc7fdfe46047d72107a Content-Type: text/plain; charset=ISO-8859-1 -- 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. --00148520fcc7fdfe46047d72107a--
> > How do you do it? You cant use the definition "type" as you use resources, >> like >> >> define x() { >> } >> >> ... >> >> require => X["name"] >> >> right? What can you do to ensure the proper order? >> > > You haven''t tried that, I assume? Because if you had, you would > likely have found that it *does* work. Definitions work like any > other resource types, so you can have them in all the dependency > metaparameters. > >Funny thing, I tried it, thought it was ok, tried it later, didnt get it to work, assumed first try was a mistake on my part, then rechecked and not, the mistake was in the second try using modules :-/ ------------------------------ Jesús Couto F. -- 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.