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

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
主站蜘蛛池模板: 日照市| 奇台县| 靖安县| 温州市| 德清县| 东港市| 上高县| 永丰县| 上杭县| 芜湖县| 天台县| 五常市| 丰镇市| 山西省| 从江县| 达州市| 会同县| 民权县| 平原县| 克什克腾旗| 兴和县| 家居| 石景山区| 北碚区| 洛宁县| 徐汇区| 新营市| 三门峡市| 巴彦淖尔市| 黄浦区| 石泉县| 灌南县| 渑池县| 包头市| 赣州市| 乐昌市| 台湾省| 连云港市| 庆城县| 扬中市| 平潭县|