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

Strongly typing your module variables

In versions of Puppet proper to the new language features which came out in version 4, we would create class parameters with undefined data types, and then, if we were being very nice, we would use the stdlib validate_<datatype> functions to check appropriate values for those variables:

class vhost (
$servername,
$serveraliases,
$port
)
{ ...

Puppet 4 and 5 have an in-built way of defining the data type that a parameterized class accepts. See the following example:

class vhost (
String $servername,
Array $serveraliases,
Integer $port
)
{ ...
主站蜘蛛池模板: 蒙山县| 宁城县| 习水县| 讷河市| 黑山县| 安达市| 郧西县| 周至县| 合江县| 邛崃市| 德格县| 大丰市| 鹿泉市| 浠水县| 虹口区| 襄汾县| 鹤山市| 肇东市| 五家渠市| 武宣县| 长海县| 柘城县| 神池县| 广州市| 鲜城| 定边县| 五台县| 永修县| 报价| 大姚县| 天津市| 苍山县| 商都县| 瑞金市| 施甸县| 平和县| 沛县| 丹巴县| 额济纳旗| 伊吾县| 克东县|