Hi, I want to execute multiple sed commands using the exec commands within puppet. I can only setup one command parameter. For now i have to give a long list of commands separated with ";" in order to use the single command parameter. I know there are other efficient ways to solve this problem. But my requirement is such i need to execute multiple commands using the exec tool within puppet. Any one have who can give me a hint how this problem could be solved. NOTE: I need only the command parameter of exec. I dont need the other parameters Regards, Kevin -- 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.
Mark Stanislav
2011-Feb-03 16:29 UTC
Re: [Puppet Users] Multiple external commands with puppet
Are you able to group these sed statements into a script and pass arguments to the script to do whatever set of executions are needed for that specific dataset? I may not understand your ''need'' exactly, either. Can you explain more of what you are trying to accomplish and less about what you''ve chosen to accomplish it with. May help stir-up better answers. -Mark On Feb 3, 2011, at 11:23 AM, linuxbsdfreak wrote:> Hi, > > I want to execute multiple sed commands using the exec commands within > puppet. I can only setup one command parameter. For now i have to give > a long list of commands separated with ";" in order to use the single > command parameter. I know there are other efficient ways to solve this > problem. But my requirement is such i need to execute multiple > commands using the exec tool within puppet. Any one have who can give > me a hint how this problem could be solved. > > NOTE: I need only the command parameter of exec. I dont need the other > parameters > > Regards, > Kevin > > -- > 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.
Brian Gallew
2011-Feb-03 16:56 UTC
Re: [Puppet Users] Multiple external commands with puppet
While it''s perfectly appropriate to have multiple exec{} or a single exec{} with a multi-line command in your puppet manifest, once you reach a certain level of complexity you almost invariably want to switch to a file{"/usr/local/scripts": ...} exec{"/usr/local/scripts/doit": ...} model. The script can be trivially customized for the local system by puppet giving you great flexibility, while allowing more complex code paths or alternate languages to be easily used. On Feb 3, 2011, at 8:29 AM, Mark Stanislav wrote:> Are you able to group these sed statements into a script and pass arguments to the script to do whatever set of executions are needed for that specific dataset? > > I may not understand your ''need'' exactly, either. Can you explain more of what you are trying to accomplish and less about what you''ve chosen to accomplish it with. May help stir-up better answers. > > -Mark > > On Feb 3, 2011, at 11:23 AM, linuxbsdfreak wrote: > >> Hi, >> >> I want to execute multiple sed commands using the exec commands within >> puppet. I can only setup one command parameter. For now i have to give >> a long list of commands separated with ";" in order to use the single >> command parameter. I know there are other efficient ways to solve this >> problem. But my requirement is such i need to execute multiple >> commands using the exec tool within puppet. Any one have who can give >> me a hint how this problem could be solved. >> >> NOTE: I need only the command parameter of exec. I dont need the other >> parameters >> >> Regards, >> Kevin >> >> -- >> 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. >-- 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.
Daniel Pittman
2011-Feb-03 17:47 UTC
Re: [Puppet Users] Multiple external commands with puppet
On Thu, Feb 3, 2011 at 08:23, linuxbsdfreak <linuxbsdfreak@gmail.com> wrote:> I want to execute multiple sed commands using the exec commands within > puppet. I can only setup one command parameter. For now i have to give > a long list of commands separated with ";" in order to use the single > command parameter. I know there are other efficient ways to solve this > problem. But my requirement is such i need to execute multiple > commands using the exec tool within puppet. Any one have who can give > me a hint how this problem could be solved. > > NOTE: I need only the command parameter of exec. I dont need the other > parametersSo, uh, your constraints are kind of strange, and suggest to me that there is something else you are not telling us about what you are trying to do that we should probably know. It would be a big help if you could post the manifest that is causing trouble somewhere. Anyhow, you can do this a bunch of ways; can you just pass your multiple operations to the single sed instance? That should behave the same way as multiple sed instances, in pretty much every case I can imagine. If that isn''t possible for some reason, you can always fall back to invoking the shell: exec { "example": command => "/bin/sh -c ''sed -e s@very@strange@ | sed -e s@choice@here@''" } Finally, as already noted, installing the script as an extra file would be a really good way to make this easier to manage in future and all. Regards, Daniel PS: If you are trying to do multiple, independent things in the one command, please don''t. Running multiple exec operations to mutate the file, and making sure they are all equipped with an appropriate ''unless'' or ''onlyif'' is much better in the long term. -- ⎋ Puppet Labs Developer – http://puppetlabs.com ✉ Daniel Pittman <daniel@puppetlabs.com> ✆ Contact me via gtalk, email, or phone: +1 (877) 575-9775 ♲ Made with 100 percent post-consumer electrons -- 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.