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

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
主站蜘蛛池模板: 枞阳县| 中阳县| 南阳市| 邛崃市| 浮山县| 灵石县| 望谟县| 和平县| 龙海市| 库伦旗| 兴业县| 南宫市| 惠来县| 肥东县| 依兰县| 金塔县| 仪征市| 鹤庆县| 宁武县| 柘荣县| 康马县| 津南区| 星子县| 淮阳县| 托克托县| 卢湾区| 方正县| 黑河市| 文山县| 澳门| 万州区| 垦利县| 九寨沟县| 玛多县| 邵武市| 扎兰屯市| 和田市| 民和| 新巴尔虎右旗| 新闻| 比如县|