- 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
)
{ ...
推薦閱讀
- 元器件易學通:常用元件分冊
- 一本書讀懂LBS位置服務
- 無線接入網(wǎng)同步性能測試技術
- 電子線路CAD設計與仿真
- iPhone開發(fā)入門與實戰(zhàn)
- 不可不知的36種電子元器件(第2版)
- 移動互聯(lián)網(wǎng):原理、技術與應用
- 數(shù)字語音處理及MATLAB仿真
- Android App Inventor項目開發(fā)教程
- 3G UMTS與4G LTE核心網(wǎng)
- Cloud-Native Applications in Java
- 物聯(lián)網(wǎng)-射頻識別(RFID)核心技術教程
- iOS 7開發(fā)快速入門
- 5G賦能:行業(yè)應用與創(chuàng)新
- 電子電路知識與實踐課堂