replying to myself...
so it seems the problem is not the varialbe scope, rather then the template
function.
the following code works:
node default {
include a
include b
}
class a {
$dirs = ""
dir{["/tmp","/tmp/a","/tmp/b"]: before => File["/tmp/dirs"]}
}
class b {
file{"/tmp/dirs": content => $a::dirs}
#file{"/tmp/dirs": content => template("/tmp/dirs.erb")}
}
define dir() {
$a::dirs += " $name"
file {$name: ensure => directory }
}
if anyone has any idea how to make this work with a template, that would be
great.
Thanks,
Ohad
On Fri, May 29, 2009 at 1:55 PM, Ohad Levy <[email protected]> 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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/puppet-users?hl=en
-~----------~----~----~----~------~----~------~--~---