OK, I''m trying to do something (apparently) stupid. Here''s the relevant fragment of my manifest: "/jumpstart/Begin/rootmirror.beg": require => File["/jumpstart/Begin"], content => template("jumpstart/standard.beg.erb"); "/jumpstart/Begin/standard.beg": require => File["/jumpstart/Begin"], content => template("jumpstart/standard.beg.erb"); So the key thing here is that I''ve got two different files, but I''m using the same template for them. I had assumed that inside the template I could access "name" or "path" to figure out what the current resource was, and thereby choose the correct contents of the script. Sadly, my introspection-fu seems to be lacking and I''m unable to figure it out. Any help? -- 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.
On Tue, Apr 12, 2011 at 02:22:03PM -0700, Brian Gallew wrote:> Sadly, my introspection-fu seems to be lacking and I''m unable to figure it out. Any help?Not easily. The only way I was able to find mention of it at all was with the horrible voodoo of a template of: <%= require ''pp'' ; pp @__scope__ %> And even then, there''s no safe, sane or simple way of getting it out. You''re best off just having two different templates I''m afraid and less magic. -- Ben Hughes || http://www.puppetlabs.com/ -- 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.
On Tue, Apr 12, 2011 at 6:39 PM, Ben Hughes <ben@puppetlabs.com> wrote:> > Sadly, my introspection-fu seems to be lacking and I''m unable to figure > it out. Any help? > > Not easily. The only way I was able to find mention of it at all was > with the horrible voodoo of a template of: > > <%= require ''pp'' ; pp @__scope__ %> > > And even then, there''s no safe, sane or simple way of getting it out. > > You''re best off just having two different templates I''m afraid and less > magic. > >I ended up doing something even uglier (and probably stupider). I created two sub-classes of jumpstart: jumpstart::mirrorroot and jumpstart::zfsroot, and each one just sets a variable ($target) and the uses the template. It''s incredibly stupid, but it works. -- 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.
On Tue, Apr 12, 2011 at 07:20:24PM -0700, Brian Gallew wrote:> I ended up doing something even uglier (and probably stupider). I created > two sub-classes of jumpstart: jumpstart::mirrorroot and jumpstart::zfsroot, > and each one just sets a variable ($target) and the uses the template. It''s > incredibly stupid, but it works.That is neater than trying to pick your way through the objects. Really. -- Ben Hughes || http://www.puppetlabs.com/ -- 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.
On 04/13/2011 04:24 AM, Ben Hughes wrote:> On Tue, Apr 12, 2011 at 07:20:24PM -0700, Brian Gallew wrote: > >> I ended up doing something even uglier (and probably stupider). I created >> two sub-classes of jumpstart: jumpstart::mirrorroot and jumpstart::zfsroot, >> and each one just sets a variable ($target) and the uses the template. It''s >> incredibly stupid, but it works. > > That is neater than trying to pick your way through the objects. Really.Indeed, but my preferred canonical approach is to wrap templates in defines. No need for subclassing here, just pass different parameters to your wrapping define. Cheers, Felix -- 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.
That would undoubtedly have been a neater solution. I may well switch to using that. Thanks! On Fri, Apr 15, 2011 at 1:48 AM, Felix Frank < felix.frank@alumni.tu-berlin.de> wrote:> On 04/13/2011 04:24 AM, Ben Hughes wrote: > > On Tue, Apr 12, 2011 at 07:20:24PM -0700, Brian Gallew wrote: > > > >> I ended up doing something even uglier (and probably stupider). I > created > >> two sub-classes of jumpstart: jumpstart::mirrorroot and > jumpstart::zfsroot, > >> and each one just sets a variable ($target) and the uses the template. > It''s > >> incredibly stupid, but it works. > > > > That is neater than trying to pick your way through the objects. Really. > > Indeed, but my preferred canonical approach is to wrap templates in > defines. No need for subclassing here, just pass different parameters to > your wrapping define. > > Cheers, > Felix > > -- > 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. > >-- 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.