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

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

Adding the optional ensure property

Although optional, most native Puppet resource types do have an ensure property, although there are exceptions—for example, . exec and notify. You simply give the resource type the ensure property by immediately calling ensurable:

 Puppet::Type.newtype(:mynewtype) do
ensurable
...
end

The corresponding providers for this type would then implement the ensure property through the use of create, exists?, and destroy methods.

In Puppet DSL, the ensure property should be the first attribute in the resource (according to the Puppet style guidelines), and it supports the present and absent keywords (present being the default, so it may be omitted for the sake of brevity), as shown in the following code:

mynewtype { 'foo':
ensure => absent,
}
主站蜘蛛池模板: 沧源| 通城县| 隆回县| 沁源县| 德安县| 临汾市| 封丘县| 安岳县| 宽甸| 泽库县| 镶黄旗| 重庆市| 营山县| 启东市| 定结县| 竹北市| 祁阳县| 名山县| 平罗县| 图木舒克市| 岑巩县| 马尔康县| 马尔康县| 衡阳市| 新河县| 灵寿县| 时尚| 密云县| 周至县| 大悟县| 宁城县| 泸州市| 四会市| 宝清县| 卓资县| 万宁市| 香河县| 苍梧县| 邯郸市| 轮台县| 文登市|