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

  • 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
主站蜘蛛池模板: 迁西县| 舒兰市| 汝南县| 通河县| 高碑店市| 淅川县| 嵩明县| 威宁| 兴和县| 开化县| 翼城县| 南丰县| 广饶县| 齐齐哈尔市| 昌邑市| 思茅市| 旺苍县| 即墨市| 临西县| 连山| 绥宁县| 昆山市| 明星| 渭南市| 卢湾区| 宣威市| 瓦房店市| 太保市| 正定县| 江安县| 罗源县| 雷波县| 光山县| 平安县| 丰都县| 昆山市| 大埔县| 台北市| 海阳市| 长宁县| 克什克腾旗|