Ask Your Question

Will a required class's File default attributes be included in the 'requiree' class?

asked 2018-04-18 16:15:15 -0600

rph5132 gravatar image

updated 2018-04-20 09:07:30 -0600


class ping {
  File {
    owner => root,
    group => root,
    mode  => '755',
  include ping::pong
class ping::pong {
  require ping
  file { 'foo': 
    ensure => file,

Will file 'foo' from class ping::pong keep the file defaults of owner => root, group => root, mode => '755' ?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-05-01 06:05:16 -0600

You want to read about scopes and search for the keyword “defaults”.

In section “Scope lookup rules” you learn “Dynamic scope lookup” is used for resource defaults. In the explanation of “Dynamic scope lookup” there is this hint box containing:

Since classes can be declared multiple times with the include function, the contents of a given scope are evaluation-order dependent.

So no, in your example – using include/require – you can not assume the defaults from ping are set.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2018-04-18 16:15:15 -0600

Seen: 52 times

Last updated: May 01