最新消息:

Node inheritance is not supported in Puppet >= 4.0.0

puppet admin 3569浏览 0评论

3.7 版本之后 不建议使用 node 继承, 修改方法如下:

Puppet 4.0 will deprecate node inheritance which is currently a common way to organize resources. I have been using node inheritance to group common configurations into a basic role and then inherit that with a node declaration like the following:

# site.pp
...
node webserver {
  # add all generic web server configuration here
}

node web01 inherits webserver {
  # any custom things that apply to only web01
}
...

This has worked pretty well for me but with a recent update toPuppet 3.7 on a few nodes, I’m getting the following deprecation warning:

Warning: Deprecation notice: Node inheritance is not supported in Puppet >= 4.0.0.
See http://links.puppetlabs.com/puppet-node-inheritance-deprecation

This quickly becomes annoying as puppet runs frequently on the nodes I manage as I like to be able to quickly deploy changes without a kick or other manual intervention, as well as be able to recover quickly if an error were to occur.

To resolve this issue for now, I have modifed all generic nodes and made them into classes and included those classes in the specific node declarations, similar to the following, which is the modified/updated version of what I included above:

# site.pp
...
class webserver {
  # add all generic web server configuration here
}

node web01 {

  # include the generic web server class
  include webserver

  # any custom things that apply to only web01

}
...

Now that works without issuing a deprecation warning which has cleared my inbox quite a bit. The right answer moving forward will be to adhere to the official puppet recommendation of creating modules from these classes and potentially making them parameterized to allow very specific configuration calls from the nodes.

转载请注明:爱开源 » Node inheritance is not supported in Puppet >= 4.0.0

您必须 登录 才能发表评论!