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

  • 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,
}
主站蜘蛛池模板: 璧山县| 潮安县| 萨迦县| 永清县| 哈巴河县| 子洲县| 武隆县| 西峡县| 望江县| 龙南县| 卓尼县| 平度市| 永济市| 当阳市| 嫩江县| 黔西县| 河北区| 上虞市| 乌兰县| 马鞍山市| 通渭县| 建水县| 建昌县| 凤山县| 都江堰市| 嘉黎县| 阳东县| 金平| 尚志市| 庐江县| 永顺县| 什邡市| 新密市| 兰西县| 华蓥市| 汕头市| 刚察县| 喀什市| 宁阳县| 安新县| 蕉岭县|