Thanks Dan,

Unfortunately, I don't think we're going to 2.6 any time soon in our
environment. I was hoping there was something simpler and I was just
being dumb. Good news is, maybe I'm not so dumb! lol.

I'm looking at using a custom function a co-worker wrote that might
help. If it works well, I'll ask him to post it up here. I can see
that it might be useful.

Drew

On Nov 16, 12:45 pm, Dan Bode <d...@puppetlabs.com> wrote:
> Hi Andrew,
>
>
>
> On Tue, Nov 16, 2010 at 9:33 AM, hudsterboy <andrewmor...@yahoo.com> wrote:
> > I'm trying to create a directory structure from 2 arrays. First array
> > is the "outter", second is the "inner". For each "outter", I'd like to
> > loop through each "inner".
>
> > Below is sort of what I'm trying to do. In the real world, the
> > $sys_name and $mounts vars will be parsed from yaml and will be
> > dynamic. In the example I've created static arrays for simplicity.
>
> > Please don't critique the code. I know it won't work and is the wrong
> > way to do it. I just want to give an idea of what I'm trying to do.
>
> >    $sys_name = ['sys1', 'sys2', 'sys3', 'sys4']
> >    $mounts = ['home', 'var', 'usr', 'duck', 'goose']
>
> >    File { owner => 'root', group => 'root', mode => '0755', ensure =>
> > directory }
>
> >    define outter () {
> >        file { "/mnt/$sys_name": }
>
> >           define inner () {
> >               file {"$mount_base/$mounts":}
> >           }
> >           inner { $mounts }
>
> >  }
> >    outter { $sys_name: }
>
> Looping/iteration is somewhat difficult using Puppet's DSL.
>
> Perhaps you should consider writing this manifest using the new Ruby DSL
> (available in 2.6.x) . I recently wrote a blog about it (which I believe is
> the most up to date documentation not counting the commit message):
>
> http://www.puppetlabs.com/blog/ruby-dsl/
>
> its fairly bleeding edge, so feel free to ask questions.
>
> -Dan
>
> > So basically create directories from a dynamic array inside
> > directories created from a dynamic array.
> > Any way to do this in a simple way?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Puppet Users" group.
> > To post to this group, send email to puppet-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > puppet-users+unsubscr...@googlegroups.com<puppet-users%2bunsubscr...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/puppet-users?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-us...@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