Is it possible to make a module a dependency? We have a "base" module that contains packages, configurations, etc, that should be processed before other modules, and I''m looking for a way of enforcing a dependency on everything in the base module without having to explicitly list each package, etc. Thanks, Keith --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Is this what you are looking for? class foo { ... } class bar { package { "test": require => Class["foo"], } } On Mar 10, 2009, at 8:25 AM, Keith Edmunds wrote:> > Is it possible to make a module a dependency? >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Keith Edmunds wrote:> Is it possible to make a module a dependency? > > We have a "base" module that contains packages, configurations, etc, that > should be processed before other modules, and I''m looking for a way of > enforcing a dependency on everything in the base module without having to > explicitly list each package, etc.You can depend on a class: require => Class[thatclass], before => Class[thatotherclass] Not *exactly* a module, but probably close enough. /Bellman --~--~---------~--~----~------------~-------~--~----~ 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 Tue, Mar 10, 2009 at 01:39:36PM +0100, Thomas Bellman wrote:> > Keith Edmunds wrote: > > > Is it possible to make a module a dependency? > > > > We have a "base" module that contains packages, configurations, etc, that > > should be processed before other modules, and I''m looking for a way of > > enforcing a dependency on everything in the base module without having to > > explicitly list each package, etc. > > You can depend on a class: > > require => Class[thatclass], > before => Class[thatotherclass] > > Not *exactly* a module, but probably close enough. >If the class is the one that would be autoloaded from $modulepath/$module/manifests/init.pp, then I''d say it''s exactly enough :) Thomas, just make sure that init.pp contains a class that matches the module name. It''s safest to put everything you want to run inside the class declaration and include it at the right point. If you put code in init.pp but outside the class declaration, I think it will be evaluated at the moment the class is autoloaded, which might not do predictable things. -- Bruce If the universe were simple enough to be understood, we would be too simple to understand 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 -~----------~----~----~----~------~----~------~--~---
> You can depend on a class: > > require => Class[thatclass], > before => Class[thatotherclass]But can I cause a module (or class) to depend on a class? If so, I can''t find the correct syntax. Thanks, Keith --~--~---------~--~----~------------~-------~--~----~ 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 Thu, Mar 12, 2009 at 11:36:23AM +0000, Keith Edmunds wrote:> > > You can depend on a class: > > > > require => Class[thatclass], > > before => Class[thatotherclass] > > But can I cause a module (or class) to depend on a class? If so, I can''t > find the correct syntax.If you want a class to be evaluated, all you need to is include it. What more do you need? I''m still banging my head against puppet''s idea of what a class is (as opposed to the OO concept) but one thing puppet has no problem with is making sure that one thing is evaluated before another. Whatever you are trying to do with inclusion, importing or inheritance or some combination of those. -- Bruce I object to intellect without discipline. I object to power without constructive purpose. -- Spock --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Keith Edmunds wrote:>> You can depend on a class: >> >> require => Class[thatclass], >> before => Class[thatotherclass] > > But can I cause a module (or class) to depend on a class? If so, I can''t > find the correct syntax.No. You need to let individual resources within that class or module depend on the other class. Luckily, one often already has a dependency chain within that class, so you only need to add dependencies to a few of those resources. If you, e.g, have: class x { ... } class y { t1 { r1: ...; } t2 { r2: ..., require => T1[r1]; } t3 { r3: ..., require => T2[r2]; } ... t17 { r17: ..., require => T16[r16]; } } and want all of the resources in class y to depend on class x, you only need to add a ''require => Class[x]'' to the r1 resource, since all of r2..r17 already require r1. /Bellman --~--~---------~--~----~------------~-------~--~----~ 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 Thu, 12 Mar 2009 14:37:40 +0100, bellman@nsc.liu.se said:> No. You need to let individual resources within that class or module > depend on the other class.Thanks Thomas, I suspected as much. Would it be appropriate to create a wishlist item that a module depends on another (module|class)? Keith --~--~---------~--~----~------------~-------~--~----~ 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 Mar 12, 2009, at 10:14 AM, Keith Edmunds wrote:> > On Thu, 12 Mar 2009 14:37:40 +0100, bellman@nsc.liu.se said: > >> No. You need to let individual resources within that class or module >> depend on the other class. > > Thanks Thomas, I suspected as much. > > Would it be appropriate to create a wishlist item that a module > depends on > another (module|class)?A bug/feature request. -L --~--~---------~--~----~------------~-------~--~----~ 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 Thu, Mar 12, 2009 at 02:14:34PM +0000, Keith Edmunds wrote:> > Would it be appropriate to create a wishlist item that a module depends on > another (module|class)?I''m not entirely sure what you mean by this. A module has no real existence of it''s own, within puppet; it''s just a convenient way of bundling manifests and files together. What do you expect this dependency to *do*? Custom-build functions aside, the code within module manifests will take effect when the relevant class is included, for code within class definitions, or loaded/imported (for code without). Unless you have some extra mechanism in mind, I''m not sure what dependencies could achieve. -- Bruce A problem shared brings the consolation that someone else is now feeling as miserable as you. --~--~---------~--~----~------------~-------~--~----~ 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 entirely sure what you mean by this. A module has no real > existence of it''s own, within puppet; it''s just a convenient way of > bundling manifests and files together.A better way of expressing myself would be to say that I''d like to make class X depend on class Y. Keith --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi>> I''m not entirely sure what you mean by this. A module has no real >> existence of it''s own, within puppet; it''s just a convenient way of >> bundling manifests and files together. > > A better way of expressing myself would be to say that I''d like to make > class X depend on class Y.sounds like the feature discussed in #1907 [1]. Its implementation is currently discussed on puppet-dev [2]. cheers pete [1] http://projects.reductivelabs.com/issues/1907 [2] http://groups.google.com/group/puppet-dev/browse_thread/thread/13d5f75fc0e81f2e --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Keith Edmunds wrote:>> I''m not entirely sure what you mean by this. A module has no real >> existence of it''s own, within puppet; it''s just a convenient way of >> bundling manifests and files together. > > A better way of expressing myself would be to say that I''d like to make > class X depend on class Y. >I''m coming late to this but: require => Class[Y] Works fine for me. Regards James Turnbull -- Author of: * Pulling Strings with Puppet (http://www.amazon.com/gp/product/1590599780/) * Pro Nagios 2.0 (http://www.amazon.com/gp/product/1590596099/) * Hardening Linux (http://www.amazon.com/gp/product/1590594444/)
On Sat, 14 Mar 2009 08:24:21 +1100, james@lovedthanlost.net said:> require => Class[Y] > > Works fine for me.Unless I''m mistaken, I can''t apply that statement to a the current class (to ensure that all of class Y is executed before this class starts). I have to add that to one of the elements of this class, and the only way to ensure that all of class Y is executed before any of the current class is to have every element of the current class ultimately depend on class Y, either directly or indirectly. Or am I wrong? Keith --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---