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

  • 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
主站蜘蛛池模板: 伽师县| 内丘县| 县级市| 将乐县| 三明市| 正镶白旗| 乐陵市| 岳西县| 阿尔山市| 宣武区| 乳源| 茌平县| 灵石县| 布尔津县| 三台县| 鄂州市| 哈密市| 嘉善县| 深圳市| 大兴区| 新营市| 林甸县| 五河县| 石城县| 多伦县| 兴安盟| 平和县| 尉氏县| 田林县| 平塘县| 会理县| 白银市| 包头市| 车致| 观塘区| 石棉县| 江门市| 阳泉市| 乌兰县| 洛南县| 兴业县|