Hi Axel,

On 31.07.2012 15:59, Axel Bock wrote:
Hello readers,

I am wondering - I intend to create a few directory trees with the file{
[array] } pattern, but unfortunately Puppet complains. It says "File[]
is already declared in file ..."- which kind of looks like as if Puppet
takes a file object with an array as parameter as a single, unnamed File
object. I would assume this would be equivalent to

File{ array[0] : ... }
File{ array[1] : ... }
File{ array[2] : ... }

... etc. Unfortunately the directories should have different owners and
permissions, so I cannot merge those into a single file{} statement. Any
advice how I can achieve what I want without breaking this up into -
right now - six different file{} delarations?

You're description is not totally clear to me, but here's an example how arrays should work:


  $filesA = ["/tmp/A1", "/tmp/A2", "/tmp/A3" ]
  $filesB = ["/tmp/B1", "/tmp/B2", "/tmp/B3" ]

  file {
    $filesA:
      ensure => present,
      mode => 0644, owner => root;
    $filesB:
      ensure => present,
      mode => 0755, owner => "www-data";
  }

If you're looking for something different you might want to look into setting recurse=>true. Read the Type Reference for more info.

Best Regards, David

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