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

Using the exists? method

The exists? method retrieves the ensure state of the resource. A Boolean is returned, as shown in the following code:

Puppet::Type.type(:mynewtype).provide(:yum) do
...
confine :osfamily => :redhat
defaultfor: osfamily => :redhat
...
def exists?
begin
rpm('-q', resource[:name])
rescue Puppet::ExecutionFailure => e

       false
end
end
...
end
主站蜘蛛池模板: 黑龙江省| 涪陵区| 普陀区| 呼和浩特市| 永清县| 隆林| 当阳市| 全椒县| 莱西市| 丹江口市| 高陵县| 海原县| 格尔木市| 青铜峡市| 彰化市| 汽车| 临夏县| 泽库县| 德阳市| 日土县| 娄底市| 安化县| 浦东新区| 卓尼县| 上饶市| 望都县| 盐津县| 灯塔市| 吉首市| 三门县| 邻水| 铜山县| 封开县| 苏州市| 宣汉县| 景宁| 拉孜县| 通化市| 化州市| 西畴县| 德令哈市|