Yushu Yao
2010-Nov-16 19:21 UTC
[Puppet Users] Can one definition require another definition?
Hi Experts, I am in a situation that need one definition to require another (to enforce execution order). E.g. define a(x,y,z) { do task 1 } define b(u,v,w) { so task 2 } To use them: Below won''t make sure task 1 is executed before task 2 (or does it?): a { inst_a: x=>"x", ... } b { inst_b: u=>"u", ... } What I am doing now is to wrap them with classes, since definition can require a class: class cls_a { a { inst_a: x=>"x", ... } } b { inst_b: u=>"u", ... *require=>Class["cls_a"], *} *The question is: Won''t it help if Puppet support require=>Definition["inst_a"] directly?* Or am I missing some important issues? Thanks a lot! -Yushu -- 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.
Russell Jackson
2010-Nov-16 19:28 UTC
Re: [Puppet Users] Can one definition require another definition?
On 11/16/2010 11:21 AM, Yushu Yao wrote:> Hi Experts, > > *The question is: > > Won''t it help if Puppet support require=>Definition["inst_a"] directly?* > > Or am I missing some important issues? >Defines are macros. The macro itself doesn''t exist in the catalog; only the generated resources do. -- Russell A Jackson <raj@csub.edu> Network Analyst California State University, Bakersfield -- 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.
Nan Liu
2010-Nov-16 19:33 UTC
Re: [Puppet Users] Can one definition require another definition?
On Tue, Nov 16, 2010 at 11:21 AM, Yushu Yao <yyao@lbl.gov> wrote:> Hi Experts, > > I am in a situation that need one definition to require another (to enforce > execution order). E.g. > > define a(x,y,z) { > do task 1 > } > > define b(u,v,w) { > so task 2 > } > > To use them: > Below won''t make sure task 1 is executed before task 2 (or does it?): > The question is: > > Won''t it help if Puppet support require=>Definition["inst_a"] directly?Yes it supports it. a { inst_a: x=>"x", ... } b { inst_b: u=>"u", ... require=>A["inst_a"], } Just capitalize the first letter: define foo:bar ... require => Foo:Bar[".."] Thanks, 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.
Russell Jackson
2010-Nov-16 20:06 UTC
Re: [Puppet Users] Can one definition require another definition?
On 11/16/2010 11:33 AM, Nan Liu wrote:> On Tue, Nov 16, 2010 at 11:21 AM, Yushu Yao<yyao@lbl.gov> wrote: >> Hi Experts, >> >> I am in a situation that need one definition to require another (to enforce >> execution order). E.g. >> >> define a(x,y,z) { >> do task 1 >> } >> >> define b(u,v,w) { >> so task 2 >> } >> >> To use them: >> Below won''t make sure task 1 is executed before task 2 (or does it?): >> The question is: >> >> Won''t it help if Puppet support require=>Definition["inst_a"] directly? > > Yes it supports it. > > a { inst_a: > x=>"x", ... > } > > b { inst_b: > u=>"u", ... > require=>A["inst_a"], > } > > Just capitalize the first letter: > define foo:bar ... > > require => Foo:Bar[".."] >I stand corrected. It does work. I''ve always thought of defines as macros, but apparently they are objects themselves. I''m still confused why they don''t appear in my catalogs. Would nesting them inside of classes have anything to do with that? -- Russell A Jackson <raj@csub.edu> Network Analyst California State University, Bakersfield -- 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.
Jeff McCune
2010-Nov-17 01:27 UTC
Re: [Puppet Users] Can one definition require another definition?
On Nov 16, 2010, at 12:15 PM, Russell Jackson <raj@csub.edu> wrote:> I stand corrected. It does work. > > I''ve always thought of defines as macros, but apparently they are objects themselves. I''m still confused why they don''t appear in my catalogs. Would nesting them inside of classes have anything to do with that?What actually happens in the catalog is that a relationship is established with every resource in the collection created by the defined resource type. The trend seems to be moving in the direction of making defined resource types more like native types in the catalog, but I don''t have easy access to the tickets on my phone. The same thing happens when establishing a relationship to a class. In the catalog this is actually a relationship to all resources in the collection of resources created by the class. Hope this helps, -Jeff -- 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.
Scott Smith
2010-Nov-17 01:32 UTC
Re: [Puppet Users] Can one definition require another definition?
defines are neither macros nor objects, they are resources On Nov 16, 2010 12:16 PM, "Russell Jackson" <raj@csub.edu> wrote:> On 11/16/2010 11:33 AM, Nan Liu wrote: >> On Tue, Nov 16, 2010 at 11:21 AM, Yushu Yao<yyao@lbl.gov> wrote: >>> Hi Experts, >>> >>> I am in a situation that need one definition to require another (toenforce>>> execution order). E.g. >>> >>> define a(x,y,z) { >>> do task 1 >>> } >>> >>> define b(u,v,w) { >>> so task 2 >>> } >>> >>> To use them: >>> Below won''t make sure task 1 is executed before task 2 (or does it?): >>> The question is: >>> >>> Won''t it help if Puppet support require=>Definition["inst_a"] directly? >> >> Yes it supports it. >> >> a { inst_a: >> x=>"x", ... >> } >> >> b { inst_b: >> u=>"u", ... >> require=>A["inst_a"], >> } >> >> Just capitalize the first letter: >> define foo:bar ... >> >> require => Foo:Bar[".."] >> > > I stand corrected. It does work. > > I''ve always thought of defines as macros, but apparently they are > objects themselves. I''m still confused why they don''t appear in my > catalogs. Would nesting them inside of classes have anything to do with > that? > > -- > Russell A Jackson <raj@csub.edu> > Network Analyst > California State University, Bakersfield > > -- > 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 topuppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> .> For more options, visit this group athttp://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.