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

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
主站蜘蛛池模板: 襄城县| 怀柔区| 全南县| 滁州市| 伊通| 温泉县| 衡水市| 灵武市| 澄城县| 顺昌县| 北京市| 广宁县| 环江| 庆城县| 密云县| 恩施市| 客服| 高安市| 包头市| 自治县| 静安区| 开平市| 读书| 北安市| 惠州市| 曲靖市| 辽宁省| 宝山区| 甘洛县| 屯留县| 两当县| 宁晋县| 乐亭县| 搜索| 军事| 偏关县| 屯留县| 喀什市| 德令哈市| 元朗区| 灯塔市|