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

  • 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
主站蜘蛛池模板: 烟台市| 长泰县| 维西| 淳安县| 九龙县| 鹤山市| 邹平县| 新绛县| 青海省| 四会市| 颍上县| 灵石县| 金堂县| 湖口县| 彭水| 龙川县| 东丽区| 巩义市| 秦安县| 鱼台县| 申扎县| 颍上县| 衡阳市| 财经| 民勤县| 托里县| 洛浦县| 邯郸县| 成安县| 西和县| 台南市| 崇文区| 滁州市| 南丰县| 福州市| 阜城县| 图们市| 方正县| 吴忠市| 庄河市| 哈密市|