I'm not convinced that Justin wasn't correct about this being a bug. I'm having a similar issue
class myclass (...) { # some extra stuff here $file_list = [ 'a', 'b' ..., 'n' ] file { $file_list : ensure => 'file', source => "puppet://modules/myclass/$title", path => "/tmp/$title" } results in the "cannot alias file [a] to [/tmp/myclass]". For some reason the resource title in my file is resolving to the class name rather than the file name. The solution provided above seems to change the semantics. myclass becomes a defined type instead and the list of files is moved outside and passed in as multiple instances are created. That's a work around. Another would be to not use a list and simply define each file separately in the class, that avoids having to use the $title to abstract the definition into a single resource definition. I can do that quite easily but in my case I have about 100 files so it makes this much less readable. Found someone had already explained the issue here: http://www.nico.schottelius.org/blog/puppet-name-is-not-as-expected-but-classname/. Does anyone have an answer as to why $title in this case is resolving to the class title rather than the resource title? Is that expected and is there a variable I could use instead that would resolve to the name of the resource I'm declaring rather than the class or defined type I'm declaring it in? I also tested this and it's not to do with the list, if I use put in each file individually and use $title or $name it still resolves to the class name thanks Paul On Tuesday, February 14, 2012 4:36:41 AM UTC+4, Justin wrote: > > Ok, thanks for the tip. > > On Mon, Feb 13, 2012 at 3:42 PM, Nan Liu <n...@puppetlabs.com<javascript:> > > wrote: > >> On Mon, Feb 13, 2012 at 3:37 PM, Justin Lloyd >> <jst...@gmail.com<javascript:>> >> wrote: >> > I was wondering if I'd need to create a define() but the language >> guide's >> > description seems misleading, at least to me. From the 6th paragraph of >> the >> > Resources section: >> > >> > http://docs.puppetlabs.com/guides/language_guide.html#resources >> > >> > The field before the colon is the resource’s title, which must be >> unique and >> > can be used to refer to the resource in other parts of the Puppet >> > configuration. >> >> You can refer to the title of the resource in a defined type as $name, >> you can't use $name when you declare a resource. This page explains in >> further detail about the unique constraint: >> >> http://docs.puppetlabs.com/learning/definedtypes.html >> >> HTH, >> >> Nan >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To post to this group, send email to puppet...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> puppet-users...@googlegroups.com <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> >> > > > -- > “We don’t need to increase our goods nearly as much as we need to scale > down our wants. Not wanting something is as good as possessing it.” -- > Donald Horban > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/nUdfItkxHvYJ. 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.