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

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
)
{ ...
主站蜘蛛池模板: 柘城县| 阿坝县| 博乐市| 斗六市| 富阳市| 阿坝县| 潮安县| 方正县| 南漳县| 内江市| 雷山县| 简阳市| 屯昌县| 漯河市| 崇左市| 桂东县| 兴化市| 汶上县| 安福县| 凤阳县| 中西区| 西和县| 剑川县| 汉川市| 任丘市| 镇坪县| 新郑市| 霍林郭勒市| 定远县| 海晏县| 内黄县| 芦山县| 大宁县| 靖西县| 宕昌县| 文安县| 松溪县| 城口县| 巨鹿县| 沂南县| 盐边县|