On Tue, Dec 29, 2009 at 5:30 PM, Ben <ben.dovas...@gmail.com> wrote:

> ok so just to confirm, if I understand correctly classes will not be
> evaluted unless they are used within an include.
>
> I've restored my site.pp so now it's go two classes, "files1" and
> "files2" both managing file resources.
>
> I've also specified all nodes using the default node function, all
> nodes should include the "appserver" class (which requires files1 and
> files2 classes)
>
> (I've upgraded my puppet version 24.8 which supports multiple class
> relationships)
>
> [r...@xldn1564vdap manifests]# cat /etc/puppet/manifests/site.pp
> node default {
>        include appserver
> }
>
> class appserver {
>        service { "appserver":
>        require => Class ["files1", "files2"]
>         }
> }
>
> class files1 {
>        file { "/etc/motd":
>        group => "puppet",
>        }
> }
>
> class files2 {
>        file { "/etc/puppet/facts.conf":
>        group => "puppet",
>        }
> }
>
> But on testing it fails to find the classes files1 or files2
>
>
the classes cannot be find in the scope of the appserver class and need to
be included.

in .24.8, you need to include then in the appserver class

class appserver{
  include files1, file1
  service { "appserver":
    require => Class ["files1", "files2"]
   }
}

starting in .25.0, there is a require function that will include classes
from another class and specify dependencies on those classes

class appserver{
  require(files1)
  require(files2)
  service{'appserver':}
}

require is slightly different than what you defined here, since it will
create dependencies from all resources in the calling class to all resources
in the referred classes.

class appserver{
  service{'appserver':
    require => [Class1]
}


> [r...@xldn1564vdap manifests]# puppetd  --test --verbose --debug
> debug: Creating default schedules
> debug: Failed to load library 'ldap' for feature 'ldap'
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/lib/
> puppet/ssl]: Autorequiring File[/var/lib/puppet]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> puppet/ssl/private_keys/xldn1564vdap.ldn.swissbank.com.pem]:
> Autorequiring File[/var/lib/puppet/ssl/private_keys]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> puppet/ssl/csr_xldn1564vdap.ldn.swissbank.com.pem]: Autorequiring File
> [/var/lib/puppet/ssl]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/lib/
> puppet/lib]: Autorequiring File[/var/lib/puppet]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/var/
> lib/puppet/classes.txt]: Autorequiring File[/var/lib/puppet]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/var/
> lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/
> state]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> puppet/ssl/public_keys/xldn1564vdap.ldn.swissbank.com.pem]:
> Autorequiring File[/var/lib/puppet/ssl/public_keys]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> puppet/ssl/certs/xldn1564vdap.ldn.swissbank.com.pem]: Autorequiring
> File[/var/lib/puppet/ssl/certs]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/etc/
> puppet/puppet.conf]: Autorequiring File[/etc/puppet]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/lib/
> puppet/state]: Autorequiring File[/var/lib/puppet]
> debug: /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/
> certs]
> debug: Finishing transaction 23570713179760 with 0 changes
> debug: Loaded state in 0.00 seconds
> debug: Retrieved facts in 0.70 seconds
> debug: Retrieving catalog
> debug: Calling puppetmaster.getconfig
> debug: Retrieved catalog in 0.17 seconds
> debug: Puppet::Type::Service::ProviderGentoo: file /sbin/rc-update
> does not exist
> debug: Puppet::Type::Service::ProviderDebian: file /usr/sbin/update-
> rc.d does not exist
> debug: Puppet::Type::Service::ProviderRunit: file /usr/bin/sv does not
> exist
> debug: Puppet::Type::Service::ProviderLaunchd: file /bin/launchctl
> does not exist
> debug: Puppet::Type::Service::ProviderDaemontools: file /usr/bin/svc
> does not exist
> debug: Creating default schedules
> warning: Not using cache on failed catalog
> warning: Configuration could not be instantiated: Could not find
> dependency Class[files1] for Service[appserver] at /etc/puppet/
> manifests/site.pp:8
>
> Thoughts welcomed...thanks
>
> Ben
>
>
>
> On 29 Dec, 16:10, Ben <ben.dovas...@gmail.com> wrote:
> > The behaviour I'm expecting is that if there are no node definitions
> > then all resources and classes would be applied to all nodes but it's
> > not.
> >
> > As for you're question, yes when I define a node (or use the default
> > node function) and with a include class  then it works.
> >
> > On 29 Dec, 15:59, Julian Simpson <simpsonjul...@gmail.com> wrote:
> >
> >
> >
> > > Have you declared any nodes and included that class?
> >
> > > node default {
> >
> > >   include files1
> >
> > > }
> >
> > > 2009/12/29 Ben <ben.dovas...@gmail.com>:
> >
> > > > Just to add some addtional detal about which versions I'm using
> >
> > > > [r...@xldn1784dis puppet]# puppetmasterd --version
> > > > 0.24.5
> > > > [r...@xldn1784dis puppet]# puppetd --version
> > > > 0.24.5
> > > > [r...@xldn1784dis puppet]# ruby --version
> > > > ruby 1.8.5 (2006-08-25) [x86_64-linux]
> > > > [r...@xldn1784dis puppet]# facter --version
> > > > 1.5.0
> >
> > > > puppet.conf
> >
> > > > [r...@xldn1784dis puppet]# grep -v "#" /etc/puppet/puppet.conf
> > > > [main]
> > > >    vardir = /var/lib/puppet
> >
> > > >    logdir = /var/log/puppet
> >
> > > >    rundir = /var/run/puppet
> >
> > > >    ssldir = $vardir/ssl
> >
> > > > [puppetd]
> > > >    classfile = $vardir/classes.txt
> >
> > > >    localconfig = $vardir/localconfig
> > > >        server = puppetmaster
> >
> > > > [puppetmasterd]
> > > >   certname = puppetmaster
> >
> > > > On 29 Dec, 15:50, Ben <ben.dovas...@gmail.com> wrote:
> > > >> Hi
> >
> > > >> I've been scrathing my head at this for days, to point where I've
> > > >> stripped down my site manifest, so it consists purely of a single
> > > >> class called files1 managed a sinlge file resource.
> >
> > > >> class files1 {
> > > >>         file { "/etc/motd":
> > > >>         group => "puppet",
> > > >>         }
> >
> > > >> }
> >
> > > >> The problem is that it's not picking up the class when it compiles
> the
> > > >> catalogue.
> >
> > > >> Failed run.....
> >
> > > >> [r...@xldn1784dis puppet]# puppetd --verbose --test --debug
> > > >> debug: Creating default schedules
> > > >> debug: Failed to load library 'ldap' for feature 'ldap'
> > > >> debug: Failed to load library 'shadow' for feature 'libshadow'
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/lib/
> > > >> puppet/lib]: Autorequiring File[/var/lib/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/
> > > >> certs]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/csr_xldn1784dis.ldn.swissbank.com.pem]: Autorequiring
> File[/
> > > >> var/lib/puppet/ssl]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/certs/xldn1784dis.ldn.swissbank.com.pem]: Autorequiring
> File
> > > >> [/var/lib/puppet/ssl/certs]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/public_keys/xldn1784dis.ldn.swissbank.com.pem]:
> > > >> Autorequiring File[/var/lib/puppet/ssl/public_keys]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/lib/
> > > >> puppet/ssl]: Autorequiring File[/var/lib/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/private_keys/xldn1784dis.ldn.swissbank.com.pem]:
> > > >> Autorequiring File[/var/lib/puppet/ssl/private_keys]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/etc/
> > > >> puppet/puppet.conf]: Autorequiring File[/etc/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/var/
> > > >> lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/
> > > >> state]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/lib/
> > > >> puppet/state]: Autorequiring File[/var/lib/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/var/
> > > >> lib/puppet/classes.txt]: Autorequiring File[/var/lib/puppet]
> > > >> debug: Finishing transaction 23456253626720 with 0 changes
> > > >> debug: Loaded state in 0.00 seconds
> > > >> debug: Retrieved facts in 0.40 seconds
> > > >> debug: Retrieving catalog
> > > >> debug: Calling puppetmaster.getconfig
> > > >> debug: Retrieved catalog in 0.17 seconds
> > > >> info: No classes to store
> > > >> debug: Creating default schedules
> > > >> info: Caching catalog at /var/lib/puppet/localconfig.yaml
> > > >> notice: Starting catalog run
> > > >> debug: Loaded state in 0.00 seconds
> > > >> debug: Finishing transaction 23456249387740 with 0 changes
> > > >> debug: Storing state
> > > >> debug: Stored state in 0.01 seconds
> > > >> notice: Finished catalog run in 0.02 seconds
> >
> > > >> Please could someone explain what the message "info: No classes to
> > > >> store" means, as this seem to be present when it fails?
> >
> > > >> I've found that it does however work when I either specify a node
> > > >> definition with the class or remove the class entirely so it's just
> a
> > > >> sinlge resource outside of a class
> >
> > > >> node xldn1784dis { include files1 }
> >
> > > >> class files1 {
> > > >>         file { "/etc/motd":
> > > >>         group => "puppet",
> > > >>         }
> >
> > > >> }
> >
> > > >> [r...@xldn1784dis puppet]# puppetd --verbose --test --debug
> > > >> debug: Creating default schedules
> > > >> debug: Failed to load library 'ldap' for feature 'ldap'
> > > >> debug: Failed to load library 'shadow' for feature 'libshadow'
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/lib/
> > > >> puppet/lib]: Autorequiring File[/var/lib/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/certs/xldn1784dis.ldn.swissbank.com.pem]: Autorequiring
> File
> > > >> [/var/lib/puppet/ssl/certs]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/private_keys/xldn1784dis.ldn.swissbank.com.pem]:
> > > >> Autorequiring File[/var/lib/puppet/ssl/private_keys]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/public_keys/xldn1784dis.ldn.swissbank.com.pem]:
> > > >> Autorequiring File[/var/lib/puppet/ssl/public_keys]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/csr_xldn1784dis.ldn.swissbank.com.pem]: Autorequiring
> File[/
> > > >> var/lib/puppet/ssl]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/private]: Autorequiring File[/var/lib/puppet/ssl]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/etc/
> > > >> puppet/puppet.conf]: Autorequiring File[/etc/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/certs]: Autorequiring File[/var/lib/puppet/ssl]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/certs/ca.pem]: Autorequiring File[/var/lib/puppet/ssl/
> > > >> certs]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/private_keys]: Autorequiring File[/var/lib/puppet/ssl]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/var/
> > > >> lib/puppet/classes.txt]: Autorequiring File[/var/lib/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/lib/
> > > >> puppet/state]: Autorequiring File[/var/lib/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/lib/
> > > >> puppet/ssl]: Autorequiring File[/var/lib/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/var/
> > > >> lib/puppet/state/state.yaml]: Autorequiring File[/var/lib/puppet/
> > > >> state]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/public_keys]: Autorequiring File[/var/lib/puppet/ssl]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/var/
> > > >> lib/puppet/state/state.yaml]: Changing mode
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/var/
> > > >> lib/puppet/state/state.yaml]: 1 change(s)
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/var/
> > > >> lib/puppet/state/state.yaml]/mode: mode changed '640' to '660'
> > > >> debug: Finishing transaction 23456253626980 with 1 changes
> > > >> debug: Loaded state in 0.00 seconds
> > > >> debug: Retrieved facts in 0.40 seconds
> > > >> debug: Retrieving catalog
> > > >> debug: Calling puppetmaster.getconfig
> > > >> debug: Retrieved catalog in 0.19 seconds
> > > >> debug: Creating default schedules
> > > >> debug: Finishing transaction 23506665634060 with 0 changes
> > > >> info: Caching catalog at /var/lib/puppet/localconfig.yaml
> > > >> notice: Starting catalog run
> > > >> debug: Loaded state in 0.00 seconds
> > > >> debug: //Node[xldn1784dis]/files1/File[/etc/motd]: Changing group
> > > >> debug: //Node[xldn1784dis]/files1/File[/etc/motd]: 1 change(s)
> > > >> notice: //Node[xldn1784dis]/files1/File[/etc/motd]/group: group
> > > >> changed 'root' to 'puppet'
> > > >> debug: Finishing transaction 23506662991820 with 1 changes
> > > >> debug: Storing state
> > > >> debug: Stored state in 0.01 seconds
> > > >> notice: Finished catalog run in 0.46 seconds
> >
> > > >> [r...@xldn1784dis puppet]# puppetd --verbose --test --debug
> > > >> debug: Creating default schedules
> > > >> debug: Failed to load library 'ldap' for feature 'ldap'
> > > >> debug: Failed to load library 'shadow' for feature 'libshadow'
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[puppetd]/File[/etc/
> > > >> puppet/puppet.conf]: Autorequiring File[/etc/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[main]/File[/var/lib/
> > > >> puppet/ssl]: Autorequiring File[/var/lib/puppet]
> > > >> debug:
> /Settings[/etc/puppet/puppet.conf]/Settings[ssl]/File[/var/lib/
> > > >> puppet/ssl/certs/ca.pem]: Autorequiring
> >
> > ...
> >
> > read more ยป- Hide quoted text -
> >
> > - Show quoted text -
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "Puppet Users" group.
> To post to this group, send email to puppet-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@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-us...@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.


Reply via email to