It's a bit deeper than that, Nesting a class definition inside of a class definition will result in a class namespaced as first_class::second_class. Because of this, you'll need to "include mock::my_file" in your node declaration.
It's recommended to keep one class definition per file and to follow the Module patterns [2] and Style Guide [3] when doing so. [1] http://docs.puppetlabs.com/learning/modules1.html [2] http://docs.puppetlabs.com/guides/style_guide.html On Tue, Dec 4, 2012 at 7:10 PM, José Juan Montes <jjmon...@gmail.com> wrote: > i > >> I am trying to use nested classes but for whatever reason it doesn't >> work. Here's my site.pp file: >> >> include stdlib >> include apt >> node 'zenoss.example.com' { >> include mock >> } >> class mock { >> class my_file { >> file { '/tmp/test': >> ensure => present, >> content => "Just testing to see if 'This' is working", >> } >> } >> apt::source { "debian-squeeze": >> location => "http://ftp.jp.debian.org/debian/", >> release => "squeeze", >> repos => "main contrib non-free", >> include_src => false, >> } >> } >> >> The problem is when I run it, the apt repository is added but the file is >> not. What am I doing wrong? >> >> >> > Nested classes are not automatically included. > > Try including your nested class explicitly ,after apt:source: > > include my_file > > Alternatively, you don't need to do that just for a file. Simply put your > "file" resource directly within the "mock" class. > > I hope it helps. Best regards. > > > > -- > 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+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > -- Gary Larizza Professional Services Engineer Puppet Labs -- 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+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.