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

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
)
{ ...
主站蜘蛛池模板: 平远县| 平陆县| 金坛市| 蒲城县| 阿图什市| 呼图壁县| 施甸县| 施秉县| 凭祥市| 德州市| 抚松县| 张家口市| 稻城县| 开封市| 和硕县| 台北县| 太康县| 德惠市| 团风县| 双江| 莒南县| 中西区| 胶州市| 海南省| 和静县| 哈巴河县| 江山市| 南雄市| 孟连| 喀喇沁旗| 黄龙县| 富阳市| 资阳市| 镇巴县| 宝鸡市| 承德县| 东乌珠穆沁旗| 阳朔县| 安吉县| 洞头县| 花莲县|