Skip to content

Commit 2586f09

Browse files
committed
Merge branch 'master' of ssh://git@github.com/hlindberg/misc-puppet-docs.git
2 parents 56efc06 + 3f33f77 commit 2586f09

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# Puppet documentation proposal
2+
This is a proposal of how documentation could be written in puppet manifests
3+
4+
5+
# Internal comment (Not picked up by the doc generator)
6+
## Documetantion
7+
/** Documentation */
8+
@example
9+
@param
10+
@deprecation
11+
@see
12+
@todo
13+
@api private | public
14+
@since version
15+
@return
16+
17+
### Examples
18+
19+
20+
/** Monitor a specific process in the system.
21+
Alert users if threshold is met
22+
*/
23+
24+
define monitor(
25+
$process, ## Name of process
26+
$memory_limit = '502' ## Memory limit in MB
27+
$alert = ['root'] ## Array of users to report to
28+
) {
29+
# Do stuff
30+
$a = 'foo' ## This is picked up
31+
$b = 'bar' # This is not
32+
33+
## x is a nice variable
34+
$x = true
35+
36+
## @todo make it more robust
37+
$z = false
38+
}
39+
40+
41+
Longer documentation
42+
43+
/**
44+
This will monitor your system!
45+
@param memory [String] will default to 512, blah blah blah
46+
@param alert [Array] can take multiple people
47+
*/
48+
49+
monitor { 'foobar':
50+
memory_limit => 1024,
51+
alert => ['jhaals']
52+
}
53+
54+
55+
_"This class is so easy so I'll skip writing doc"_
56+
(Should generate documentation for the class, parameters and default values)
57+
58+
class { 'foobar':
59+
backup => true
60+
}
61+
62+
## Invalid examples
63+
64+
parameter documentation should not be defined in two places. Output warning and skip
65+
66+
define foo(
67+
## should be ipv4
68+
$ip ## or ipv6
69+
)
70+
71+
72+
Parameter documented both top and inline should warn and probably skip inline in favour for top doc
73+
74+
## This part handle the databases
75+
## @params backup [Bool] wall of text
76+
77+
database { 'mydb':
78+
## Should probably backup by default
79+
backup => false
80+
}

0 commit comments

Comments
 (0)