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

  • 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
主站蜘蛛池模板: 当阳市| 读书| 顺义区| 新沂市| 水城县| 东阿县| 天等县| 安顺市| 武城县| 铅山县| 张家港市| 芒康县| 二连浩特市| 五河县| 乌鲁木齐市| 清流县| 贡嘎县| 特克斯县| 鄱阳县| 石屏县| 女性| 万年县| 德庆县| 邵武市| 遂川县| 宜君县| 临漳县| 安西县| 沁水县| 论坛| 蒙阴县| 双城市| 台南县| 浮梁县| 东兰县| 汾西县| 华容县| 镇赉县| 丰顺县| 阿拉善右旗| 海盐县|