Defined types values exist in a 'local scope' which is only accessible to
its child scopes, so there's no way to access these values using the method
you're using for class variables (which are inside a named scope).

On Tue, 23 Jun 2020, 8:15 pm Albert Shih, <albert.s...@obspm.fr> wrote:

> Hi everyone,
>
> I use a lot of accessing a variables with
>
> class  'my_clas' (
>   String $var1,
>   String $var2,
>   )
>   {
>
>     $path = "$var1/$var2"
>
>     }
>
> After loading my_class
>
>   class { 'my_clas':
>     var1 => 'something',
>     var2 => 'otherthing',
>     }
>
> than I access to those variables
>
>   $::my_class:var1
>   $::my_class:path
>
> Is it possible to do the same with define ? For example to do something
> like
>
> define my_script (
>   String $name,
>   )
>   {
>
>   $script_path = "/opt/local/bin/${name}",
>   }
>
>
> then
>
>   my_script { 'first':
>     name => 'my_script'
>     }
>
>   cron { 'first':
>     command => $my_script::first::script_path
>   }
>
>   my_script { 'second':
>     name => 'my_script_second'
>     }
>
>   cron { 'second':
>     command => $my_script::first_second::script_path
>   }
>
>
> Regards
>
>
> --
> Albert SHIH
> Observatoire de Paris
> xmpp: j...@obspm.fr
> Heure local/Local time:
> Tue 23 Jun 2020 12:08:05 PM CEST
>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/20200623101514.GA58073%40io.chezmoi.fr
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/CABaapwLFQ%2BibV1xMNdhKvNoCD%2BiO0%3DsDwJDPGZmVdag%2BK9fdxg%40mail.gmail.com.

Reply via email to