Ivo van der Meer
2009-Mar-18 08:09 UTC
[Puppet Users] Howto depend on a package from another class?
Hi, I have a class and want to depend on a Package from another class, how do I solve this ?? I have 2 classes one is called openldap-client and the other is called pam-ldap. I want pam-ldap to depend on the openldap-client class which has a Package called openldap-client. I''ve tried the following: - openldap-client::Package["openldap-client"] - Class[openldap-client]::Package["openldap-client"] Has anyone got a good solution to this or is it a bad idea to make such a dependency? Kind regards, Ivo --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bruce Richardson
2009-Mar-18 09:23 UTC
[Puppet Users] Re: Howto depend on a package from another class?
On Wed, Mar 18, 2009 at 09:09:47AM +0100, Ivo van der Meer wrote:> > Hi, > > I have a class and want to depend on a Package from another class, how do I > solve this ??Just depend on the package. Then you don''t have to care who provides it. Is is that you want to the dependency on the package to trigger the inclusion of the class which manages it? That would be a different story. -- 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 -~----------~----~----~----~------~----~------~--~---
paul matthews
2009-Mar-18 09:29 UTC
[Puppet Users] Re: Howto depend on a package from another class?
Have you tried within the Package instruction for pam-ldap:- require => Package["openldap-client"] or if the openldap-client package is wrapped up in a class require => Class["openldap-client"] Cheers Paul 2009/3/18 Ivo van der Meer <ivo@crewtty.ath.cx>> > Hi, > > I have a class and want to depend on a Package from another class, how do I > solve this ?? > I have 2 classes one is called openldap-client and the other is called > pam-ldap. I want pam-ldap to depend on the openldap-client class which has > a Package called openldap-client. > > I''ve tried the following: > > - openldap-client::Package["openldap-client"] > - Class[openldap-client]::Package["openldap-client"] > > Has anyone got a good solution to this or is it a bad idea to make such a > dependency? > > > Kind regards, > > Ivo > > > >-- Paul Matthews ---------------------------------------------------------------------- --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Trevor Vaughan
2009-Mar-18 10:31 UTC
[Puppet Users] Re: Howto depend on a package from another class?
Hmm...that''s interesting. As far as I know, there are no adverse side effects to just including the other class in the dependent class. I.e. class pam-ldap { include "openldap-client" } If anyone does know of a problem with this, could you shed some light on it? It may increase compile time due to multiple includes, but I''m not sure about that since, in theory, it should just be a noop if it''s already been included (haven''t checked the code). Trevor On Wed, Mar 18, 2009 at 05:29, paul matthews <paulsmatthews@googlemail.com> wrote:> Have you tried within the Package instruction for pam-ldap:- > > require => Package["openldap-client"] > > or if the openldap-client package is wrapped up in a class > > require => Class["openldap-client"] > > Cheers > Paul > > 2009/3/18 Ivo van der Meer <ivo@crewtty.ath.cx> >> >> Hi, >> >> I have a class and want to depend on a Package from another class, how do >> I >> solve this ?? >> I have 2 classes one is called openldap-client and the other is called >> pam-ldap. I want pam-ldap to depend on the openldap-client class which has >> a Package called openldap-client. >> >> I''ve tried the following: >> >> - openldap-client::Package["openldap-client"] >> - Class[openldap-client]::Package["openldap-client"] >> >> Has anyone got a good solution to this or is it a bad idea to make such a >> dependency? >> >> >> Kind regards, >> >> Ivo >> >> > > > > -- > Paul Matthews > ---------------------------------------------------------------------- > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Ivo van der Meer
2009-Mar-18 11:00 UTC
[Puppet Users] Re: Howto depend on a package from another class?
Hi, Thanks for all the replys, it really helped! Here is my pam-ldap class, which depends on the openldap-client class and works fine with the help I got from you guys. It thought it was harder than it is.. Just add require => Package["openldap-client"] and it works since it''s coming from openldap-client class which my node included. ------- class pam-ldap { case $operatingsystem { FreeBSD: { $packagelist = ["pam_ldap", "pam_mkhomedir"] } } package { $packagelist: ensure => installed, require => Package["openldap-client"] } case $operatingsystem { FreeBSD: { file { "/etc/pam.d/system": source => "puppet:///configuration/ldapauth/pam.d/freebsd/system", owner => root, group => wheel, mode => 644, require => Package["pam_ldap", "pam_mkhomedir"]; "/etc/pam.d/sshd": source => "puppet:///configuration/ldapauth/pam.d/freebsd/sshd", owner => root, group => wheel, mode => 644, require => Package["pam_ldap", "pam_mkhomedir"]; } } } } ------- On Wed, 18 Mar 2009 09:29:44 +0000, paul matthews <paulsmatthews@googlemail.com> wrote:> Have you tried within the Package instruction for pam-ldap:- > > require => Package["openldap-client"] > > or if the openldap-client package is wrapped up in a class > > require => Class["openldap-client"] > > Cheers > Paul > > 2009/3/18 Ivo van der Meer <ivo@crewtty.ath.cx> > >> >> Hi, >> >> I have a class and want to depend on a Package from another class, howdo>> I >> solve this ?? >> I have 2 classes one is called openldap-client and the other is called >> pam-ldap. I want pam-ldap to depend on the openldap-client class which >> has >> a Package called openldap-client. >> >> I''ve tried the following: >> >> - openldap-client::Package["openldap-client"] >> - Class[openldap-client]::Package["openldap-client"] >> >> Has anyone got a good solution to this or is it a bad idea to make sucha>> dependency? >> >> >> Kind regards, >> >> Ivo >> >> > >>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bruce Richardson
2009-Mar-18 14:07 UTC
[Puppet Users] Re: Howto depend on a package from another class?
On Wed, Mar 18, 2009 at 06:31:36AM -0400, Trevor Vaughan wrote:> > I.e. > > class pam-ldap { > include "openldap-client" > } > > If anyone does know of a problem with this, could you shed some light on it?There are several potential problems with it; the way puppet works, the point at which a class is included can be very important. For example, if the openldap-client class is sensitive to global variables, which might be set differently in different contexts, then this might include the class early, before those have been set. It also forces the inclusion of that specific class, rather than any class that might inherit from it. So it all hangs on the way the OP uses these classes, but I do find it very important in puppet to avoid unnecessary dependences. -- Bruce Hierophant: someone who remembers, when you are on the way down, everything you did to them on the way up. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---