On Sunday, October 28, 2012 8:23:30 AM UTC-5, danielt wrote:
>
> The definition doesn't need to be in its own module, but it should be in
>> its own *file* within the module (which is what puppet-lint was telling
>> you),
>>
>
> I know but having a definition which just copys files in a global name
> space would immensely reduce the amount of code duplication. I actually do
> not want to have the files definition in every module, I rather want to
> have my helper module which does that for me.
>
> I hope you understood my intension of doing that.
>
>
That's not relevant to my answer. Nevertheless, inasmuch as there is
nothing special about defined types relative to built-in resources when it
comes to arrays as resource titles, I'm not sure I agree that there is an
immense amount of code duplication to be saved. How is using an
intermediary definition better than just writing this:
file { ${files}:
ensure => present,
owner => root,
group => root,
mode => 0644,
source => 'puppet:///files/apache2/',
require => File[$folders],
}
Note 1: "ensure => present" is likely not what you really want, but that's
what your definition does.
Note 2: you might well not need that 'require' parameter, as Puppet will
autorequire the parent directory of any managed file if the parent is
itself managed.
Note 3: if it's the owner / group / mode that you don't want to duplicate,
then you might want to consider the advantages of being explicit about what
you want. If you still want to avoid expressing those explicitly (and how
many places are we talking about, really?) then you could consider setting
global defaults for those parameters:
site.pp
-----------
# ...
File {
owner => root,
group => root,
mode => 0644
}
# ...
John
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/puppet-users/-/Z6s-TnS-UDMJ.
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.