Ask Your Question
0

Puppet hiera and inherited classes

asked 2015-02-11 09:39:29 -0500

Joseph Carlos gravatar image

Here is a Puppet class s_mysql:

class s_mysql ( $use_local_packages = false) {
  if ($use_local_packages) {
    notify { 'using local packages': }
  } else {
    notify { 'NOT using local packages': }
  }
  ... more ...
}

There is another class that inherits s_mysql:

class s_mysql::test inherits s_mysql {
  ... stuff ..
}

Here is a node that includes s_mysql::test:

node testserver1 { include s_mysql::test }

I have a YAML hiera data source for this server:

---
# testserver1.yaml
s_mysql::use_local_packages : true

I run the command-line version of hiera to ensure that the the hiera data value is correct:

% hiera s_mysql::use_local_packages ::hostname=testerver1
# outputs "true"

However, when I run Puppet on testserver1 I get this error:

Could not find data item s_mysql::use_local_packages 
in any Hiera data file and no default supplied

Why does this not work?

Note: I am running Puppet 3.7.2.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-02-11 10:21:13 -0500

From what I know, data bindings only work when a class is specifically included, not when it is inherited by another class.

As a note, it is strongly recommended to avoid using inheritance and to favor class inclusion instead.

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

Stats

Asked: 2015-02-11 09:39:29 -0500

Seen: 280 times

Last updated: Feb 11 '15