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? Regards Robert --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Hi> > 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"] ] > > } > > } > > }or from 0.24.6 on you might be able to simply use the apend function: http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#appending-to-variables /me didn''t test it... cheers pete --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
robert.gstoehl 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?Use the append functionality of newer puppet releases: http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#appending-to-variables 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
I''m still on 0.23.2 for some time. Planning the upgrade at the moment. On Jul 15, 10:09 am, David Schmitt <da...@dasz.at> wrote:> robert.gstoehl 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? > > Use the append functionality of newer puppet releases: > > http://reductivelabs.com/trac/puppet/wiki/LanguageTutorial#appending-... > > 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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en -~----------~----~----~----~------~----~------~--~---
Hi> I''m still on 0.23.2 for some time. Planning the upgrade at the moment.then it might be worth witing for 0.25.0 imho... cheers pete --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi> I''m still on 0.23.2 for some time. Planning the upgrade at the moment.then it might be worth witing for 0.25.0 imho... cheers pete --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---