- Mastering Puppet 5
- Ryan Russell Yates Jason Southgate
- 117字
- 2021-07-16 17:46:17
Using the commands method
Confining providers may also be based on the availability of certain commands from the system path using the commands method.
More importantly, by using the special methods generated by commands, we can also inform Puppet of the correct commands for interacting with the underlying system. This is preferable over Ruby's own methods for command execution, such as %x{cmd} or cmd for the following reasons:
- Puppet displays commands invoked this way when the --debug flag is set
- They are documented as a requirement for the provider
- Exceptions are handled consistently by raising a Puppet::ExecutionFalure
This is shown in the following code:
Puppet::Type.type(:mynewtype).provide(:yum) do
...
commands :yum => 'yum', :rpm => 'rpm'
...
end
推薦閱讀
- 數(shù)據(jù)通信與計算機網(wǎng)絡(luò)(第2版)
- 雷達微波新技術(shù)
- 衛(wèi)星通信干擾感知及智能抗干擾技術(shù)
- 移動網(wǎng)絡(luò)安全體系架構(gòu)與防護技術(shù)
- 21堂課精通電子元器件檢測
- 5G創(chuàng)新技術(shù)與行業(yè)實踐
- NI Multisim 11電路仿真應(yīng)用
- Altium Designer 16基礎(chǔ)實例教程
- 現(xiàn)代移動通信(第4版)
- 突破平面:會聲會影2018視頻編輯與制作
- Android商業(yè)軟件開發(fā)全程實戰(zhàn)
- RFID標簽所有權(quán)安全轉(zhuǎn)換
- UI 那些事兒:新手設(shè)計師的成長之路
- CMOS模擬集成電路全流程設(shè)計
- 5G應(yīng)用從入門到精通