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

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
主站蜘蛛池模板: 建始县| 汽车| 洪湖市| 湘西| 腾冲县| 陆丰市| 金阳县| 武乡县| 剑川县| 胶州市| 高碑店市| 阿克陶县| 许昌市| 黄骅市| 平果县| 兴化市| 灌阳县| 天气| 武清区| 峡江县| 渭南市| 呼和浩特市| 晋城| 深州市| 东乡| 卓资县| 行唐县| 康乐县| 西盟| 大连市| 沈阳市| 手游| 长宁区| 肇州县| 邳州市| 灵丘县| 和田县| 阿图什市| 施甸县| 三江| 新绛县|