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

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
主站蜘蛛池模板: 紫金县| 博湖县| 英吉沙县| 黔江区| 大足县| 安阳县| 安泽县| 榆社县| 灌云县| 讷河市| 和平区| 息烽县| 乳山市| 同德县| 上蔡县| 姜堰市| 海阳市| 鞍山市| 荃湾区| 樟树市| 固原市| 乐平市| 河北区| 永福县| 页游| 临桂县| 炉霍县| 望都县| 郴州市| 南宁市| 临高县| 汉沽区| 磐安县| 安义县| 宁乡县| 莱阳市| 阜南县| 凌源市| 隆尧县| 台东市| 平塘县|