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
-~----------~----~----~----~------~----~------~--~---

Reply via email to