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

  • 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
主站蜘蛛池模板: 五峰| 新郑市| 东山县| 青冈县| 赤城县| 泾源县| 德格县| 余姚市| 赞皇县| 榆林市| 怀宁县| 宁陕县| 永平县| 晋州市| 莱芜市| 台前县| 呈贡县| 巧家县| 九龙城区| 昌乐县| 淅川县| 东源县| 清镇市| 松桃| 博客| 定兴县| 侯马市| 宜宾县| 昭平县| 临澧县| 无棣县| 临西县| 湄潭县| 淮阳县| 潞城市| 苗栗县| 东明县| 莎车县| 米易县| 乌审旗| 阳江市|