Hm, with --debug it seems like all the dependencies, even an array of them, get passed to the nested exec. Voodoo :) Thanks for your help.
On Jul 15, 9:55 am, "robert.gstoehl" <robert.gsto...@gmail.com> wrote: > Seems to work so far, thanks. What happens when a $require is passed > to the definition which contains an array? > > require => [ Package["wget"], $require ] > > My quick test (printing out $require via a notify) indicate that only > the first item of the array is included. Is there a way to merge > arrays? > > On Jul 13, 7:12 pm, David Schmitt <da...@dasz.at> wrote: > > > robert.gstoehl wrote: > > > I'm trying to get the dependencies right: > > > > define wget($source, $options = "", $unless = "") { > > > include pkg::virtual_packages > > > realize (Package["wget"]) > > > exec {"wget $options -O $title $source": > > > path => "/usr/bin:/opt/csw/bin", > > > unless => "$unless", > > > timeout => 18000, > > > require => Package["wget"] > > > } > > > > if $require { > > > Exec ["wget $options -O $title $source"]{ > > > require +> $require > > > } > > > } > > > } > > > > Bombs with: > > > > err: Could not retrieve configuration: Parameter 'require' is already > > > set on Exec[wget -O ... ....] by wget at /etc/opt/csw/puppet/ > > > manifests/definitions/wget.pp:8; cannot redefine at /etc/opt/csw/ > > > puppet/manifests/definitions/wget.pp:14 > > > > The docs say: > > > > Note that all defined types support automatically all metaparameters. > > > Therefore you can pass any later used parameters like $require to a > > > define, without any definition of it: > > > > define svn_repo($path) { > > > exec {"create_repo_${name}": > > > command => "/usr/bin/svnadmin create $path/$title", > > > unless => "/bin/test -d $path", > > > } > > > if $require { > > > Exec["create_repo_${name}"]{ > > > require +> $require, > > > } > > > } > > > } > > > > What am I doing wrong? Is there another way to add the require > > > metaparameter to the nested exec resource? > > > "+>" is only valid when inheriting resources. > > > Instead do this: > > > > define wget($source, $options = "", $unless = "") { > > > include pkg::virtual_packages > > > realize (Package["wget"]) > > > exec {"wget $options -O $title $source": > > > path => "/usr/bin:/opt/csw/bin", > > > unless => "$unless", > > > timeout => 18000, > > > } > > > > > > if $require { > > > Exec ["wget $options -O $title $source"]{ > > > require => [ Package["wget"], $require ] > > > } > > > } else { > > > Exec ["wget $options -O $title $source"]{ > > > require => [ Package["wget"] ] > > > } > > > } > > > } > > > Regards, DavidS --~--~---------~--~----~------------~-------~--~----~ 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+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---