Sorry about that, google hotkeys (Grrr)
Hi folks,
I think i'm missing something obvious here. I'm trying to search/replace
multiple times for n files but I keep hitting a 'ArgumentError: Duplicate
definition' or similar.
I guess this is because i'm using ${name} to for the multiple files, but as
far as I can tell, i'm unable to use another type of array. i.e. if I do:
$name = ["file1", "file2", etc.. ]
define replacetext ($cwd, $stext, $rtext, $sstext, $rrtext) {
exec {$name:
cwd => $cwd,
path => ["/bin"],
command => "sed -i 's/$stext/$rtext/' ./${name}",
}
exec {$name:
cwd => $cwd,
path => ["/bin"],
command => "sed -i 's/$sstext/$rrtext/' ./${name}",
}
}
replacetext { $myfiles:
cwd => "/opt",
stext => "replacethis",
rtext => "withthis",
sstext => "replacethis2",
rrtext => "withthis2",
}
It throws a Duplicate definition error. If I take out one the exec calls it
works fine on each of the files.
I tried giving it another array of the files so I could do:
$files = ["file1", "file2", etc.. ]
define searchreplace ($cwd, $stext, $rtext, $sstext, $rrtext, $files) {
exec {"1":
cwd => $cwd,
path => ["/bin"],
command => "sed -i 's/$stext/$rtext/' ./${files}",
}
exec {"2":
cwd => $cwd,
path => ["/bin"],
command => "sed -i 's/$stext/$rtext/' ./${files}",
}
}
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?
Thanks,
Matt
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---