On Tue, Aug 07, 2012 at 11:25:32AM -0700, Douglas Garstang wrote: > As usual, I'm confused about scope in puppet. This puppet 2.7.1. > > In my classes below, the bottom class, company::web::content, requires > the file resource '/usr/local/company'. However, that resource is > defined two includes back in the class company::common. I always > thought this wasn't supposed to work, and that you could only access > the immediate scope, not the scope of stuff beyond this. It does work > however. Is it supposed to. Why?
Without having dug into it, I think scope applies more for variables. Resources can be related to other resources no matter where they are. Below you've just defined the equivalent of: class superme { file { '/tmp/file1': content => "123\n", } file { '/tmp/file2': content => "456\n", require => File['/tmp/file1'], } } For what it's worth, I think it's supposed to work how you've described below. > class company::common { > file { > '/usr/local/company': > .... > } > } > > > class company::web::common { > include company::common > } > > > class company::web::content { > include company::web::common > > file { > '/usr/local/company/www': > require => File['/usr/local/company'] > } > } > > Doug. > > -- > 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. > > -- 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.