Try using the variable *caller_module_name* instead

>     file { "${cachedir}/${source}":
>       source  => "puppet:///modules/${caller_module_name}/${source}",
>                                     ^^^^^^^^^^^^^^^^^^^^
>       require => File[$cachedir],
>     }

-- 
Nikola


On Thu, Feb 21, 2013 at 07:33:00PM +0530, Francis Pereira wrote:
> How do I retrieve the name of the module where a define is used ?
> 
> Consider the following
> 
> file java/manifests/setup.pp
> 
> define java::setup (
>   $source        = undef,){
>     file { $cachedir:
>       ensure => 'directory',
>       owner  => 'root',
>       group  => 'root',
>       mode   => '644'
>     }
> 
>     file { "${cachedir}/${source}":
>       source  => "puppet:///modules/${module_name}/${source}",
>       require => File[$cachedir],
>     }
> # stripped out for readability
> }
> 
> file mywebapp/manifests/init.pp
> 
> # stripped out for readability
>   java::setup { 'mywebapp-java':
>     source        => 'jdk-7u7-linux-x64.gz',
>   }
> # stripped out for readability
> 
> I want the source to be constructed
> as  puppet:///modules/mywebapp/jdk-7u7-linux-x64.gz instead of
> puppet:///modules/java/jdk-7u7-linux-x64.gz
> 
> 
> 
> ~Francis

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To post to this group, send email to puppet-users@googlegroups.com.
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to