Trying to figure out if these would behave the same or not? Example 1: ----------------- class Foo { require Bar someresource { ''baz'': …. # This depends on A,B and C being already completed } } class Bar { include A include B include C } Example 2: ---------------- class Foo { include Bar someresource { ''baz'': …. require => Class[''Bar''] } } class Bar { include A include B include C } So will these behave the same? When I require Bar in the first example are the A,B and C resources guaranteed to be executed before the resource in Foo? Same question goes for example 2 Thanks for the clarification! -- 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.
I''m not a puppet expert, but your situation would probably fit more with an usage of stages. It would allow you to define stages and order or those. On Sunday, November 25, 2012 11:56:40 AM UTC-5, Smashed wrote:> > Trying to figure out if these would behave the same or not? > > Example 1: > ----------------- > > class Foo { > require Bar > someresource { ''baz'': > …. # This depends on A,B and C being already completed > } > } > > class Bar { > include A > include B > include C > } > > > Example 2: > ---------------- > > class Foo { > include Bar > someresource { ''baz'': > …. > require => Class[''Bar''] > } > } > > class Bar { > include A > include B > include C > } > > > So will these behave the same? When I require Bar in the first example are > the A,B and C resources guaranteed to be executed before the resource in > Foo? Same question goes for example 2 > > > Thanks for the clarification!-- 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/-/oP6xEACJKIwJ. 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.
Stages? Would you mind elaborating? Sent from my iPhone On Nov 25, 2012, at 11:37 AM, Ugo Bellavance <ugob@lubik.ca> wrote:> I''m not a puppet expert, but your situation would probably fit more with an usage of stages. > > It would allow you to define stages and order or those. > > On Sunday, November 25, 2012 11:56:40 AM UTC-5, Smashed wrote: >> >> Trying to figure out if these would behave the same or not? >> >> Example 1: >> ----------------- >> >> class Foo { >> require Bar >> someresource { ''baz'': >> …. # This depends on A,B and C being already completed >> } >> } >> >> class Bar { >> include A >> include B >> include C >> } >> >> >> Example 2: >> ---------------- >> >> class Foo { >> include Bar >> someresource { ''baz'': >> …. >> require => Class[''Bar''] >> } >> } >> >> class Bar { >> include A >> include B >> include C >> } >> >> >> So will these behave the same? When I require Bar in the first example are the A,B and C resources guaranteed to be executed before the resource in Foo? Same question goes for example 2 >> >> >> Thanks for the clarification! > > -- > 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/-/oP6xEACJKIwJ. > 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.
I read about that in the puppet 2.7 cookbook book that I bought a few days ago. On Sunday, November 25, 2012 3:26:41 PM UTC-5, Smashed wrote:> > Stages? Would you mind elaborating? > > Sent from my iPhone > > On Nov 25, 2012, at 11:37 AM, Ugo Bellavance <ug...@lubik.ca <javascript:>> > wrote: > > I''m not a puppet expert, but your situation would probably fit more with > an usage of stages. > > It would allow you to define stages and order or those. > > On Sunday, November 25, 2012 11:56:40 AM UTC-5, Smashed wrote: >> >> Trying to figure out if these would behave the same or not? >> >> Example 1: >> ----------------- >> >> class Foo { >> require Bar >> someresource { ''baz'': >> …. # This depends on A,B and C being already completed >> } >> } >> >> class Bar { >> include A >> include B >> include C >> } >> >> >> Example 2: >> ---------------- >> >> class Foo { >> include Bar >> someresource { ''baz'': >> …. >> require => Class[''Bar''] >> } >> } >> >> class Bar { >> include A >> include B >> include C >> } >> >> >> So will these behave the same? When I require Bar in the first example >> are the A,B and C resources guaranteed to be executed before the resource >> in Foo? Same question goes for example 2 >> >> >> Thanks for the clarification! > > -- > 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/-/oP6xEACJKIwJ. > To post to this group, send email to puppet...@googlegroups.com<javascript:> > . > To unsubscribe from this group, send email to > puppet-users...@googlegroups.com <javascript:>. > 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 view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/gm3H_Kr75YEJ. 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.
http://docs.puppetlabs.com/references/latest/type.html#stage On Sunday, November 25, 2012 4:05:40 PM UTC-5, Ugo Bellavance wrote:> > I read about that in the puppet 2.7 cookbook book that I bought a few days > ago. > > On Sunday, November 25, 2012 3:26:41 PM UTC-5, Smashed wrote: >> >> Stages? Would you mind elaborating? >> >> Sent from my iPhone >> >> On Nov 25, 2012, at 11:37 AM, Ugo Bellavance <ug...@lubik.ca> wrote: >> >> I''m not a puppet expert, but your situation would probably fit more with >> an usage of stages. >> >> It would allow you to define stages and order or those. >> >> On Sunday, November 25, 2012 11:56:40 AM UTC-5, Smashed wrote: >>> >>> Trying to figure out if these would behave the same or not? >>> >>> Example 1: >>> ----------------- >>> >>> class Foo { >>> require Bar >>> someresource { ''baz'': >>> …. # This depends on A,B and C being already completed >>> } >>> } >>> >>> class Bar { >>> include A >>> include B >>> include C >>> } >>> >>> >>> Example 2: >>> ---------------- >>> >>> class Foo { >>> include Bar >>> someresource { ''baz'': >>> …. >>> require => Class[''Bar''] >>> } >>> } >>> >>> class Bar { >>> include A >>> include B >>> include C >>> } >>> >>> >>> So will these behave the same? When I require Bar in the first example >>> are the A,B and C resources guaranteed to be executed before the resource >>> in Foo? Same question goes for example 2 >>> >>> >>> Thanks for the clarification! >> >> -- >> 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/-/oP6xEACJKIwJ. >> To post to this group, send email to puppet...@googlegroups.com. >> To unsubscribe from this group, send email to >> puppet-users...@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 view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/sc7dttdgAy0J. 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.
On Sun, Nov 25, 2012 at 8:56 AM, Mark <static.void.dev@gmail.com> wrote:> Trying to figure out if these would behave the same or not? > > Example 1: > ----------------- > > class Foo { > require Bar > someresource { ''baz'': > …. # This depends on A,B and C being already completed > } > } > > class Bar { > include A > include B > include C > } > > > Example 2: > ---------------- > > class Foo { > include Bar > someresource { ''baz'': > …. > require => Class[''Bar''] > } > } > > class Bar { > include A > include B > include C > } > > > So will these behave the same? When I require Bar in the first example are > the A,B and C resources guaranteed to be executed before the resource in > Foo? Same question goes for example 2 >They don''t work as expected. You need containment resources in class Bar. See documentation and ticket 8040 for more info and work around: http://docs.puppetlabs.com/puppet/2.7/reference/lang_containment.html http://projects.puppetlabs.com/issues/8040 HTH, Nan -- 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.
On Sunday, November 25, 2012 10:56:40 AM UTC-6, Smashed wrote:> > Trying to figure out if these would behave the same or not? > > Example 1: > ----------------- > > class Foo { > require Bar > someresource { ''baz'': > …. # This depends on A,B and C being already completed > } > } > > class Bar { > include A > include B > include C > } > > > Example 2: > ---------------- > > class Foo { > include Bar > someresource { ''baz'': > …. > require => Class[''Bar''] > } > } > > class Bar { > include A > include B > include C > } > > > So will these behave the same?Yes.> When I require Bar in the first example are the A,B and C resources > guaranteed to be executed before the resource in Foo?A, B, and C are classes, not resources. The resources they contain are not guaranteed to be applied before Someresource[''baz''], but if there were any resources declared directly by class Bar then they would all be applied before Someresource[''baz'']. Do not use run stages for this. They are way overkill for the problem. If you needed to add new stages every time you had to enforce resource ordering then you would quickly end up with an unmanageable mess. See my response to your other thread on this question (https://groups.google.com/forum/?fromgroups=#!topic/puppet-users/buREmDC8Py4) for more information. In the future, it will suffice to ask your question once. John -- 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/-/W1T-29xHsy0J. 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.
On 11/26/2012 07:59 PM, jcbollinger wrote:> Trying to figure out if these would behave the same or not? > > Example 1: > ----------------- > > class Foo { > require Bar > > Example 2: > ---------------- > > class Foo { > include Bar> > So will these behave the same? > > Yes.So include and require do pretty much the same? -- 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.
On 11/30/2012 09:01 PM, Jakov Sosic wrote:> On 11/26/2012 07:59 PM, jcbollinger wrote: > >> Trying to figure out if these would behave the same or not? >> >> Example 1: >> ----------------- >> >> class Foo { >> require Bar >> >> Example 2: >> ---------------- >> >> class Foo { >> include Bar >> So will these behave the same? >> >> Yes. > > So include and require do pretty much the same? > >http://docs.puppetlabs.com/references/stable/function.html#include and http://docs.puppetlabs.com/references/stable/function.html#require Thy both includes the class, but require adds a dependency to the included class. from the docs : This function is a superset of the ‘include’ function, adding a class relationship so that the requiring class depends on the required class. Grts Johan -- Johan De Wit Open Source Consultant Red Hat Certified Engineer (805008667232363) Puppet Certified Professional 2013 (PCP0000006) _________________________________________________________ Open-Future Phone +32 (0)2/255 70 70 Zavelstraat 72 Fax +32 (0)2/255 70 71 3071 KORTENBERG Mobile +32 (0)474/42 40 73 BELGIUM http://www.open-future.be _________________________________________________________ -- 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.
On 11/30/2012 11:48 PM, Johan De Wit wrote:> Thy both includes the class, but require adds a dependency to the > included class. > from the docs : > This function is a superset of the ‘include’ function, adding a class > relationship so that the requiring class depends on the required class. > GrtsWhat I was interested in is: Does the ''require'' enforce order of execution, so that the required class will be applied before the class that requires it? -- 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.
On 2012-01-12 24:25, Jakov Sosic wrote:> On 11/30/2012 11:48 PM, Johan De Wit wrote: > >> Thy both includes the class, but require adds a dependency to the >> included class. >> from the docs : >> This function is a superset of the ‘include’ function, adding a class >> relationship so that the requiring class depends on the required class. >> Grts > > What I was interested in is: Does the ''require'' enforce order of > execution, so that the required class will be applied before the class > that requires it? >Yes. require is basically shorthand for class a { include x Class[''x''] -> Class[''a''] # x before a } If the require function makes things difficult, you can manage the relationship using the ->, <-, <~, ~> operators, or as meta-parameters in resources (i.e. require => Class[''x'']). You can also look at Stages if you like to separate the concerns (some classes should be after some other classes, but you do not want to record the exact classes as you may want to change them). You can create additional stages (there is a main stage by default), and assign classes to stages. See more here: http://docs.puppetlabs.com/guides/language_guide.html - "Run Stages". Hope that helps. - henrik -- 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.