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

  • Mastering Puppet 5
  • Ryan Russell Yates Jason Southgate
  • 210字
  • 2021-07-16 17:46:07

Having a single point of entry to the module

init.pp should be the single entry point for the module. In this way, someone reviewing the documentation in particular, as well as the code in init.pp, can have a complete overview of the module's behavior.

If you've used encapsulation effectively and used descriptive class names, you can get a very good sense just by looking at init.pp of how the module actually manages the software.

Modules that have configurable parameters should be configurable in a single way and in this single place. The only exception to this would be, for example, a module such as the Apache module, where one or more virtual directories are also configurable.

Ideally, you can use your module with a simple include statement, as follows:

include mymodule

You can also use it with the use of a class declaration, as follows:

class {'mymodule':
myparam => false,
}

The Apache virtual directory style of configuring a number of defined types would be the third way to use your new module:

mymodule::mydefine {‘define1':
myotherparam => false,
}

The anti-pattern to this recommendation would be to have a number of classes other than init.pp and your defined types with parameters expecting to be set.

主站蜘蛛池模板: 宿州市| 浙江省| 鸡泽县| 安顺市| 合水县| 二手房| 额敏县| 大理市| 黔西县| 漳浦县| 抚顺县| 尉犁县| 昂仁县| 冕宁县| 都昌县| 和林格尔县| 抚顺市| 无棣县| 遂川县| 葵青区| 凤山县| 报价| 开阳县| 偏关县| 土默特右旗| 舞钢市| 堆龙德庆县| 威远县| 民乐县| 深州市| 息烽县| 安岳县| 乌什县| 历史| 繁峙县| 财经| 台东县| 隆尧县| 集贤县| 洱源县| 洛扎县|