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

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
主站蜘蛛池模板: 白城市| 邢台市| 乐安县| 浦东新区| 邮箱| 闽清县| 广元市| 区。| 时尚| 吕梁市| 安阳市| 嵩明县| 潮安县| 祥云县| 鹤峰县| 长沙市| 犍为县| 镇安县| 子洲县| 云安县| 报价| 横峰县| 潞西市| 洛阳市| 长子县| 保康县| 绩溪县| 甘洛县| 遵义市| 融水| 阳谷县| 诸城市| 察隅县| 崇左市| 墨脱县| 平湖市| 洛宁县| 大宁县| 河间市| 安徽省| 松江区|