Hi All, I have the following classes define: init.pp class { ''A'': } -> class { ''B'': } -> class { ''C'': } Supposedly, the execution order should A then B then C, but the actual execution order seems that C is being executed before B. Why is this happening? Isn''t -> will chain up the resources order? Anybody has any idea? Thanks, Chengkai -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Hi Chengkai, I have faced similar kind of problem for class ordering using ordering arrow (*->)*. You can try the stage resources for ordering classes. Refer following code snippet, #Declare stage resources stage {''first'':} stage {''second'':} stage {''third'':} #Define ordering of stages Stage[first] -> Stage[second] -> Stage[third] #use stages in each classes. class {''A'': stage => first, } class {''B'': stage => second, } class {''C'': stage => third, } Refer http://docs.puppetlabs.com/puppet/2.7/reference/lang_run_stages.html for stage resource for classes. Thanks and Regards, Rahul Khengare, NTT DATA OSS Center, Pune, India. On Sunday, September 15, 2013 10:44:17 AM UTC+5:30, chengkai liang wrote:> Hi All, > > I have the following classes define: > > init.pp > > class { ''A'': } -> > class { ''B'': } -> > class { ''C'': } > > Supposedly, the execution order should A then B then C, but the actual > execution order seems that C is being executed before B. Why is this > happening? Isn''t -> will chain up the resources order? > > Anybody has any idea? > > Thanks, > Chengkai >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
This could be related to a bug in puppet, even though the dependency is defined between classes, the resources within the classes float and get executed in a different order. Take a look at the "anchor" pattern in the puppetlabs documentation. Juan On Sunday, September 15, 2013 6:14:17 AM UTC+1, chengkai liang wrote:> > Hi All, > > I have the following classes define: > > init.pp > > class { ''A'': } -> > class { ''B'': } -> > class { ''C'': } > > Supposedly, the execution order should A then B then C, but the actual > execution order seems that C is being executed before B. Why is this > happening? Isn''t -> will chain up the resources order? > > Anybody has any idea? > > Thanks, > Chengkai >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
On Monday, September 16, 2013 12:19:50 AM UTC-5, Rahul Khengare wrote:> > Hi Chengkai, > I have faced similar kind of problem for class ordering using ordering > arrow (*->)*. You can try the stage resources for ordering classes. > >Run stages are indeed a mechanism for controlling application order of classes, but they are an awfully big and blunt hammer. Indiscriminate use of stages is likely to get you into trouble. Instead, you should fix the problem with your classes. On Sunday, September 15, 2013 10:44:17 AM UTC+5:30, chengkai liang wrote:> Hi All, >> >> I have the following classes define: >> >> init.pp >> >> class { ''A'': } -> >> class { ''B'': } -> >> class { ''C'': } >> >> Supposedly, the execution order should A then B then C, but the actual >> execution order seems that C is being executed before B. Why is this >> happening? Isn''t -> will chain up the resources order? >> >>Chances are that the chain operator works fine, but your expectation of what it means to apply (not execute) a class is flawed. Problems of this kind are usually containment issues: when one class declares another, that does not inherently place any ordering relationship between the declared and declaring classes, nor are relationships between the declaring class and any resources or other classes directly relevant to the declared class. This is quite different from the case of actual resources declared by a given class. The distinction is intentional and necessary, but that''s a separate topic. As JuanBrein suggested, you can find more information about the issue and the most common solution, the "anchor" pattern, in the language docs. Here''s a link: http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html . John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Thanks for this information. I''m now looking at the anchor pattern. On Sep 16, 2013, at 6:43 AM, jcbollinger <John.Bollinger@stJude.org> wrote:> > > On Monday, September 16, 2013 12:19:50 AM UTC-5, Rahul Khengare wrote: > Hi Chengkai, > I have faced similar kind of problem for class ordering using ordering arrow (->). You can try the stage resources for ordering classes. > > > > Run stages are indeed a mechanism for controlling application order of classes, but they are an awfully big and blunt hammer. Indiscriminate use of stages is likely to get you into trouble. Instead, you should fix the problem with your classes. > > On Sunday, September 15, 2013 10:44:17 AM UTC+5:30, chengkai liang wrote: > > Hi All, > > I have the following classes define: > > init.pp > > class { ''A'': } -> > class { ''B'': } -> > class { ''C'': } > > Supposedly, the execution order should A then B then C, but the actual execution order seems that C is being executed before B. Why is this happening? Isn''t -> will chain up the resources order? > > > > Chances are that the chain operator works fine, but your expectation of what it means to apply (not execute) a class is flawed. Problems of this kind are usually containment issues: when one class declares another, that does not inherently place any ordering relationship between the declared and declaring classes, nor are relationships between the declaring class and any resources or other classes directly relevant to the declared class. This is quite different from the case of actual resources declared by a given class. The distinction is intentional and necessary, but that''s a separate topic. > > As JuanBrein suggested, you can find more information about the issue and the most common solution, the "anchor" pattern, in the language docs. Here''s a link: http://docs.puppetlabs.com/puppet/3/reference/lang_containment.html . > > > John > > > -- > You received this message because you are subscribed to a topic in the Google Groups "Puppet Users" group. > To unsubscribe from this topic, visit https://groups.google.com/d/topic/puppet-users/OvTTmJm5QvA/unsubscribe. > To unsubscribe from this group and all its topics, send an email to puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users. > For more options, visit https://groups.google.com/groups/opt_out.-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.