On Monday, February 11, 2013 4:03:24 PM UTC-6, Roman Shaposhnik wrote: > > On Mon, Feb 11, 2013 at 1:49 PM, Jo Rhett > <jrh...@netconsonance.com<javascript:>> > wrote: > > From the snippet you posted, I don't see why you can't pass $var1 into > the > > define. No magic, just straightforward variable passing, right? > > Sure thing. The trouble is that as I said -- there's *quite* a rich state > that these classes create. So it is not a single var we're talking about > but a dozen or so. > > Now, one could argue that it makes things more explicit if I actually > have to tediously pass them explicitly. Personally, I fear it may increase > the chance of typos. > > As I said -- what I'm asking here is literally a #define as it is known in > C. > There's a bunch of code that I need to be 'pasted' in a couple of > different > places and I'm wondering whether there's a language construct that > could help me. >
Puppet DSL does not have such a feature. You have at least three alternatives: 1. As Jo said, give the definition all the formal parameters it needs to specify its data 2. Split it into multiple, similar defines that each pull some of their data from the appropriate (presumably different) class variables 3. Depending on how your classes are arranged, hiera may provide a reasonable way to address this problem. (Notwithstanding your distinct lack of enthusiasm about hiera in your other thread.) John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.