On Fri, May 29, 2009 at 2:26 PM, Joel Heenan <jo...@planetjoel.com> wrote:

> I might be wrong Ohad but my understanding is that puppet configurations
> are declarative and therefore have to be compiled. It probably helps to stop
> thinking about your define as being a function, executed at run time, and
> think of it as a macro that is substitued all over the place. It is not a
> function being run.
>
I guess the function in this case is the template / notice or what ever
you'll replace it with...


>
> You could write a custom function for this but I think the easiest is if
> you simply do

that wont help either, because you cant control when the function would run,
same as templates.
Unless I'll write a function which reads the manifests file again. :(


>
>
> $dirs =["/tmp","/tmp/a","/tmp/b"]


>
> dir { $dirs: }

my example was a simple one, the real usage case wont work with this
workaround as I cant define them in one place

>
>
> then it will be available to your template. I haven't tried this though it
> may not work.
>
> Joel
>
>
> On Fri, May 29, 2009 at 3:55 PM, Ohad Levy <ohadl...@gmail.com> wrote:
>
>> Hi,
>>
>> in this simplified example, I'm trying to create directories, and add each 
>> directory name into a variable,
>>
>> later on, generate a file which its content should be the directory names, 
>> but it doesn't work....
>>
>> any help appreciated.
>>
>> Thanks,
>> Ohad
>>
>>
>> node default {
>> include b
>> }
>>
>> class a {
>> file{"/tmp/dirs": content => template("/tmp/dirs.erb")}
>> }
>>
>> class b {
>> $dirs = ["dummy"]
>> dir{["/tmp","/tmp/a","/tmp/b"]:}
>> include a
>> }
>>
>> define dir() {
>> file {$name: ensure => directory }
>> $b::dirs += $name
>> }
>>
>> -----
>> /tmp/dirs.erb:
>> <%= scope.lookupvar("b::dirs") %>
>>
>>
>>
>>
>
> >
>

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