Providing stdin to exec

553 views
Skip to first unread message

Ty C

unread,
Feb 21, 2011, 11:07:06 PM2/21/11
to puppet...@googlegroups.com
Hi Everybody,

We've several use cases where we'd like to define stdin as an exec param. My searches didn't reveal anything relevant, but I did dredge up a 3-year old, unimplemented ticket concerning this matter:

https://projects.puppetlabs.com/issues/653

Here is a mock-up of a Puppet passage that conveys our real-world need, where Maven's settings.xml is patched with Sonar JDBC information:

exec { "patch -Nu /opt/apache-maven-2.2.1/conf/settings.xml":
stdin => template('maven/sonar.patch.erb'),
require => Package[patch],
}

Notice the concision. My current approach is to write templatized patch files to local disc and them reference them in separate 'exec's, which even at present may be a sub-optimal solution. Ultimately, the fewer turds scribbled on the file system, the better ..

Any ideas?

* I wonder if an out-of-the-box Puppet 'patch' feature is prudent ..

Felix Frank

unread,
Feb 23, 2011, 9:21:50 AM2/23/11
to puppet...@googlegroups.com
Hi,

while I can see the practical use, it seems to me that such approaches
contradict the general puppet paradigm of "specifying what things should
be" by "specifying how to do things".

As such, I'm not sure such functionality is in fact prudent (both patch
support and exec/stdin support).

Regards,
Felix

Daniel Pittman

unread,
Mar 11, 2011, 3:05:04 PM3/11/11
to puppet...@googlegroups.com, Ty C
On Mon, Feb 21, 2011 at 20:07, Ty C <ty...@cybozu.co.jp> wrote:

> We've several use cases where we'd like to define stdin as an exec param. My searches didn't reveal anything relevant, but I did dredge up a 3-year old, unimplemented ticket concerning this matter:
> https://projects.puppetlabs.com/issues/653
>
> Here is a mock-up of a Puppet passage that conveys our real-world need, where Maven's settings.xml is patched with Sonar JDBC information:
>
> exec { "patch -Nu /opt/apache-maven-2.2.1/conf/settings.xml":
>    stdin => template('maven/sonar.patch.erb'),
>    require => Package[patch],
> }

You could reasonable easily wrap a define around that which installed
the patch on disk in, say, /var/tmp, then applied it from a local
file, as a work-around and all.

> Notice the concision. My current approach is to write templatized patch files to local disc and them reference them in separate 'exec's, which even at present may be a sub-optimal solution. Ultimately, the fewer turds scribbled on the file system, the better ..
>
> Any ideas?
>
> * I wonder if an out-of-the-box Puppet 'patch' feature is prudent ..

Well, writing a "patch" type wouldn't be all that difficult to do.
http://docs.puppetlabs.com/guides/custom_types.html

If you do, let us know, or publish it via the forge. That would allow
you to work through the issues around it and all. Depending, we might
look to ship it with core, or to keep it over on the forge as a
separate project.

If you need help, puppe...@googlegroups.com loves to hear about
things like this, and we are happy to help keep you moving in the
right sort of direction to get it all implemented and all.

Oh, and you can use the plugin distribution features to make it easy
to have this deployed across all your systems without needing to do
too much on each client.

Daniel
--
⎋ Puppet Labs Developer – http://puppetlabs.com
✉ Daniel Pittman <dan...@puppetlabs.com>
✆ Contact me via gtalk, email, or phone: +1 (877) 575-9775
♲ Made with 100 percent post-consumer electrons

Reply all
Reply to author
Forward
0 new messages