Ken wrote:
Would it be possible to do something like:

file { "/foo/voo/bar/baz" :
    ensure => directory,
    between => {
        start => "/foo",
        end  => "/foo/voo/bar",
        owner => "foo",
        group => "foo",
        mode => 755, }
    between => {
        start => "/foo/voo/bar/baz",
        end  => "/foo/voo/bar/baz",
        owner => "baz",
        group => "baz",
        mode => 775, }

}

or would that require re-writing chuncks of puppet?

There was a patch to support hashes:

http://github.com/reductivelabs/puppet/commit/75c32f910ea124a938a7035b3352c11a11b57d0c

So you could in theory write your own provider. Up until that patch
the Puppet DSL would not have supported the format you suggest.

From another perspective. What's wrong with doing it this way:

file { ["/foo","/foo/voo","/foo/voo/bar" ]:
  ensure => directory,
  owner => "foo",
  group => "foo",
  mode => "0755"
}
file { "/foo/voo/bar/baz":
  ensure => directory,
  owner => "baz",
  group => "baz",
  mode => "0755"
}

Only the list seems a little wordy initially, but it won't take you
much longer to type then your suggestion.

ken.

Hello Ken,

If the directory is dynamic - ie

file { $my_dir_tree :
  ensure => directory,
...
}

That's a little harder to accomplish - if one doesn't know beforehand what the directory structure looks like, or how many levels it might have. If it's all static, your method works.

Nigel's suggestion of using an exec instead of file resource to "create" the directory - ie:

exec {"makedir" :
  command => "mkdir -p $my_dir_tree",
...
}

would probably fit my immediate needs, as I'm looking to make sure the directory is created..

I'm not relying on specific ownership or permissions management (at least at this point). However, to be able to create parent dirs & make the file resource to be more robust, one would also need more fine grained control over ownership and permissions. Ie, one issue, if /foo/voo/bar is already on one machine, and only /foo is on another machine, what will be the permissions/ownership of the directories on each machine. What if it doesn't exist on a pristine machine?

Regards,
-Roy


--
You received this message because you are subscribed to the Google Groups "Puppet 
Developers" 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-dev?hl=en.

Reply via email to