On Thu, Oct 28, 2010 at 4:17 PM, John T. Guthrie <jguth...@limewire.com> wrote:
> On 10/28/2010 02:26 PM, Jeff McCune wrote:
>> On Thu, Oct 28, 2010 at 2:06 PM, John T. Guthrie <jguth...@limewire.com> 
>> wrote:
>>
>>> Hello all,
>>>
>>> While we can use generate() to get the output of a command into a puppet
>>> manifest, it has limitations.  In particular, no subshell is used to run
>>> the command, so you can't use the pipe symbol, "|", to connect two
>>> commands together.  So how would one go about getting the output of
>>> "command1 | command2" into a puppet variable in a manifest?
>>>
>> I use wrapper scripts for this.  Then have generate() call the wrapper 
>> script.
>>
>> #! /bin/bash
>> # script to be used for generate() function
>> set -e
>> set -u
>> command1 | command2
>>
>>
> I wish I had figured this out earlier.  What also seems to work is the
> following:
>
> $my_variable = inline_template("<%= %x{command1 | command2} %>")

That's quite slick.  Thanks for following up to the list with the
alternative solution to the problem.

-- 
Jeff McCune
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-us...@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.

Reply via email to