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

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

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
)
{ ...
主站蜘蛛池模板: 观塘区| 界首市| 晋江市| 昌平区| 蓬莱市| 共和县| 古田县| 榕江县| 观塘区| 南雄市| 衡南县| 同德县| 沂水县| 阿克苏市| 永年县| 芒康县| 会同县| 仲巴县| 满城县| 德清县| 渝北区| 鹤山市| 临西县| 繁峙县| 东阿县| 蓬安县| 洛川县| 新晃| 翼城县| 监利县| 宣恩县| 利川市| 扎赉特旗| 乐安县| 奉新县| 大厂| 黔西县| 津南区| 灌阳县| 嘉祥县| 繁峙县|