Matt,
>From the terminology you are using, you seem to have fallen into the
trap of thinking of defines as functions which you call. I highly
recommend you avoid this; it leads you to certain mistaken assumptions
about how defines work.
>From your description I am having difficulty understanding what you
are trying to accomplish. Can you provide some specific details? You
are trying to perform a search/replace on multiple files in a single
resource?
With those questions answered I might be able to help.
--Paul
On Mon, Oct 13, 2008 at 5: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.
>
> Cheers,
>
> Matt
>
> 2008/10/13 Peter Meier <[EMAIL PROTECTED]>
>>
>> Hi
>>
>> > But that executed the sed command with all of the files as input.
>> >
>> > I also tried with a general define searchreplace method but i'm only
>> > able to
>> > call it once in a class with the $name due to the $name method again.
>> >
>> > Is it possible to get puppet to iterate a definition other than using
>> > the
>> > $name method?
>>
>>
>> use something else than $name as filename. because $name have to be
>> unique.
>>
>> greets pete
>>
>>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---