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

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
主站蜘蛛池模板: 于田县| 大余县| 海淀区| 牟定县| 海兴县| 米易县| 凉城县| 喜德县| 许昌市| 古交市| 布拖县| 资中县| 永川市| 苍南县| 英山县| 鹤岗市| 吐鲁番市| 贺兰县| 平顺县| 柏乡县| 大埔县| 囊谦县| 陇川县| 徐水县| 湖州市| 南昌市| 任丘市| 阳高县| 高雄县| 梁平县| 望都县| 海城市| 融水| 太和县| 双桥区| 乌拉特前旗| 西平县| 西峡县| 运城市| 兰溪市| 蓬安县|