書名: Mastering Puppet 5作者名: Ryan Russell Yates Jason Southgate本章字?jǐn)?shù): 50字更新時(shí)間: 2021-07-16 17:46:18
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
推薦閱讀
- Android進(jìn)階解密
- Flutter App開發(fā):從入門到實(shí)戰(zhàn)
- 基于集成學(xué)習(xí)的角反射體目標(biāo)雷達(dá)識別理論與方法
- 鴻蒙原生應(yīng)用開發(fā):ArkTS語言快速上手
- 電子單元電路應(yīng)用與實(shí)測技能演練
- IPv6網(wǎng)絡(luò)部署實(shí)戰(zhàn)
- 無線網(wǎng)絡(luò)優(yōu)化分析
- 無線定位系統(tǒng)
- 大話移動通信
- 電路基礎(chǔ)
- 一本書讀懂5G
- 現(xiàn)代電子戰(zhàn)系統(tǒng)導(dǎo)論(第二版)
- 高速信號傳輸工程化技術(shù):概念與方法
- 等離子彩電開關(guān)電源速修圖解
- Go Standard Library Cookbook