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

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,
}
主站蜘蛛池模板: 孝昌县| 邮箱| 昭平县| 渭南市| 屏山县| 光山县| 苏尼特左旗| 五原县| 中宁县| 开远市| 桂东县| 临西县| 宁津县| 霍邱县| 涿州市| 兴宁市| 威宁| 凤阳县| 石渠县| 中西区| 瑞昌市| 宁陕县| 元氏县| 罗定市| 邢台县| 修武县| 高要市| 西昌市| 邻水| 安岳县| 科尔| 连山| 镇巴县| 邢台市| 广西| 汽车| 安国市| 三台县| 盐边县| 岱山县| 珲春市|