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

  • 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,
}
主站蜘蛛池模板: 河源市| 体育| 龙游县| 开封市| 玉屏| 易门县| 长岛县| 永登县| 大兴区| 南昌县| 桑日县| 临漳县| 台安县| 方城县| 六枝特区| 淮南市| 南充市| 四川省| 泰和县| 监利县| 廉江市| 合江县| 纳雍县| 洛南县| 陆河县| 枞阳县| 石景山区| 玉门市| 日喀则市| 原阳县| 芮城县| 柯坪县| 什邡市| 镇远县| 监利县| 房产| 舟山市| 威远县| 南京市| 扎鲁特旗| 镇沅|