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

  • 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
主站蜘蛛池模板: 朝阳市| 宿州市| 会泽县| 张家口市| 内丘县| 二手房| 华宁县| 哈尔滨市| 伊宁市| 汕尾市| 肇东市| 聂荣县| 武宣县| 句容市| 台中县| 睢宁县| 隆安县| 固阳县| 蒲江县| 卓资县| 来凤县| 武山县| 厦门市| 内江市| 彩票| 和硕县| 平山县| 遂川县| 平果县| 石泉县| 金秀| 台安县| 邳州市| 克什克腾旗| 彝良县| 绥江县| 江安县| 宝丰县| 五常市| 准格尔旗| 始兴县|