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

Using the desc method to add inline documentation

Users of your new type can use the puppet describe and puppet doc commands to fetch the inline documentation you've configured. For a full description of all the types currently configured in your environment, including custom resources, run the following command:

$ puppet describe –list

Let's finish our type example now by adding some inline documentation using the desc method:

Puppet::Type.newtype(:mynewtype) do

ensurable

newparam(:override) do
desc 'whether or not to override'
defaultto :true
newvalues(:true, :false)
end

newproperty(:version) do
desc 'the version to use for mynewtype'
validate do |value|
fail("Invalid version") unless value =~
/^(\d+\.)?(\d+\.)?(\*|\d+)$/
end
end

newparam(:identifier) do
desc 'the identifier for mynewtype'
munge do |value|
Integer(value)
end
end

end
主站蜘蛛池模板: 锡林浩特市| 安泽县| 安丘市| 修文县| 卢湾区| 敦化市| 台北县| 宁陵县| 桐城市| 石景山区| 仪陇县| 榆树市| 明星| 海丰县| 乌拉特后旗| 乌鲁木齐市| 博乐市| 松溪县| 嘉黎县| 广河县| 磐安县| 新兴县| 饶阳县| 石城县| 扶风县| 台南市| 北票市| 宜黄县| 通山县| 凌云县| 山丹县| 吉安市| 淮北市| 宝应县| 托克逊县| 海盐县| 虎林市| 穆棱市| 永济市| 丰镇市| 图们市|