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

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
主站蜘蛛池模板: 德阳市| 怀安县| 保定市| 伊金霍洛旗| 微山县| 沧州市| 台江县| 郓城县| 晋州市| 临湘市| 武邑县| 河源市| 临西县| 大埔县| 苗栗县| 广平县| 东兴市| 德清县| 江安县| 鹤岗市| 旺苍县| 康乐县| 天津市| 湖口县| 侯马市| 湖口县| 简阳市| 鹤山市| 宁陵县| 遂溪县| 宣城市| 蛟河市| 平阳县| 嫩江县| 旌德县| 双鸭山市| 东港市| 西贡区| 轮台县| 连云港市| 蒲江县|