- Mastering Puppet 5
- Ryan Russell Yates Jason Southgate
- 105字
- 2021-07-16 17:46:16
Checking datatype compatibility with munge
To decide whether an underlying provider property should be updated, a simple equality comparison is made between the provided value and the value retrieved using the provider.
The munge method can ensure that the data supplied by the user has a consistent datatype with that expected to be returned from the provider. For example, we could call the munge method to make sure that the user-supplied datatype of integer or numeric string is compatible with the integer required by the provider, as shown in the following code:
Puppet::Type.newtype(:mynewtype) do
...
newparam(:identifier) do
munge do |value|
Integer(value)
end
end
...
end
推薦閱讀
- DSP原理及應(yīng)用:TMS320DM6437架構(gòu)、指令、功能模塊、程序設(shè)計(jì)及案例分析
- 通信專業(yè)實(shí)務(wù):動(dòng)力與環(huán)境
- 移動(dòng)網(wǎng)絡(luò)安全體系架構(gòu)與防護(hù)技術(shù)
- 電子產(chǎn)品維修實(shí)用手冊(cè)
- 3D顯示技術(shù)、標(biāo)準(zhǔn)與應(yīng)用
- 圖表細(xì)說(shuō)收音機(jī)裝配與整機(jī)電路分析
- 高速目標(biāo)長(zhǎng)時(shí)間相參積累信號(hào)處理
- 元器件檢測(cè)技能零基礎(chǔ)成長(zhǎng)
- 開(kāi)關(guān)電源工程化設(shè)計(jì)與實(shí)戰(zhàn):從樣機(jī)到量產(chǎn)
- 光電信息實(shí)用技術(shù)
- 傳輸網(wǎng)工程維護(hù)手冊(cè)
- 傳感器與檢測(cè)技術(shù)(第3版)
- 光纖通信技術(shù)
- 印度高科技發(fā)展戰(zhàn)略研究
- TD-SCDMA無(wú)線網(wǎng)絡(luò)優(yōu)化指南