- 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
推薦閱讀
- 電子產(chǎn)品制作工藝與操作實(shí)訓(xùn)
- 無線定位原理與技術(shù)
- 短視頻制作實(shí)戰(zhàn) 策劃 拍攝 制作 運(yùn)營(yíng)(全彩慕課版)
- 無線網(wǎng)絡(luò)優(yōu)化分析
- iOS游戲框架Sprite Kit技術(shù)詳解
- 微信小程序開發(fā)實(shí)戰(zhàn)
- 目標(biāo)特性與傳感原理
- Android多媒體編程從初學(xué)到精通
- 數(shù)字視頻制作應(yīng)用
- 妙用微信微博就讀它
- .NET 微信公眾平臺(tái)開發(fā)教程
- 移動(dòng)互聯(lián)網(wǎng)概論 第2版
- 高處作業(yè) 通信線路專業(yè)篇
- 移動(dòng)支付改變生活:電信運(yùn)營(yíng)商的移動(dòng)支付創(chuàng)新與實(shí)踐
- 機(jī)器人制作從入門到精通