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
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.95.38