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

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
主站蜘蛛池模板: 巴林左旗| 东兴市| 自治县| 毕节市| 达日县| 靖西县| 连城县| 元朗区| 沅陵县| 南通市| 湟源县| 乐安县| 临漳县| 株洲市| 台南市| 福鼎市| 仙桃市| 子长县| 泗阳县| 蚌埠市| 同江市| 鸡东县| 元江| 五原县| 台北县| 渝中区| 稻城县| 同心县| 长寿区| 遂溪县| 铜川市| 天祝| 称多县| 永新县| 合肥市| 丹东市| 威宁| 噶尔县| 仪陇县| 剑河县| 大丰市|