官术网_书友最值得收藏!

  • Mastering Puppet 5
  • Ryan Russell Yates Jason Southgate
  • 126字
  • 2021-07-16 17:46:17

Using the defaultfor method

The confine method is fine, but its usage may still result in multiple valid providers for a particular resource type. In this circumstance, the type should specify its preferred provider using the defaultfor method.

The defaultfor method uses a fact name and value as its arguments, which are then used to determine the default provider for certain types of underlying system.

For example, on Red Hat systems, both yum and rpm would be valid as providers to the package resource type, but the defaultfor method would be used to indicate that for Red Hat systems, yum is in fact the default provider, as shown in the following code:

Puppet::Type.type(:mynewtype).provide(:yum) do
...
confine :osfamily => :redhat
defaultfor: osfamily => :redhat
...
end
主站蜘蛛池模板: 明星| 新河县| 怀柔区| 麻江县| 广昌县| 莎车县| 五寨县| 阳新县| 泾阳县| 会昌县| 通江县| 伊春市| 当涂县| 亚东县| 宁安市| 陵川县| 碌曲县| 军事| 峨山| 吴桥县| 花莲县| 临城县| 盘锦市| 高碑店市| 文山县| 察雅县| 云浮市| 花垣县| 宿州市| 满洲里市| 襄汾县| 永修县| 太仓市| 眉山市| 永康市| 阿拉尔市| 兴安盟| 桂林市| 屯门区| 卫辉市| 军事|