On Mon, Oct 13, 2008 at 7:17 AM, Matt <[EMAIL PROTECTED]> wrote:
> Hi Pete,
>
> I tried that with $myfiles as an array, but as I said, that just executed
> the sed command with all of the filenames concatanated.
>
> I've got a fix at the moment.  I've just prefixed multiple execs in the
> define method with something unique.  Its working, but just feels like there
> would be a better way to do this.
>
> My code at the moment is:
>
> define searchreplace ( $cwd, $stext, $rtext, $sstext, $rrtext, $ssstext,
> $rrrtext ) {
>         exec {"dns_$name":
>                 cwd     => $cwd,
>                 path    => ["/bin"],
>                 command => "sed -i 's/$stext/$rtext/' ./${name}",
>         }
>         exec {"tag_$name":
>                 cwd     => $cwd,
>                 path    => ["/bin"],
>                 command => "sed -i 's/$sstext/$rrtext/' ./${name}",
>         }
>         exec {"ray_$name":
>                 cwd     => $cwd,
>                 path    => ["/bin"],
>                 command => "sed -i 's/$ssstext/$rrrtext/' ./${name}",
>         }
> }
>
> searchreplace {$bfprocesses :
>                 cwd     => "/home",
>                 stext   => "replacethis",
>                 rtext   => $dns,
>                 sstext  => "replacethis2",
>                 rrtext  => $tag,
>                 ssstext  => "replacethis3",
>                 rrrtext  => $ray,
>
>         }
> }
>
>
> It works - just wondering if there was a simpler way.
>
Have you looked at teh simple text edit examples in the wiki?
http://reductivelabs.com/trac/puppet/wiki/Recipes/SimpleText , It has
several examples of how to do text edits and suggestions for
improvement.

Evan

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to