You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(PUP-12064) Add task to generate function reference
bundle exec rake references:function
This task uses puppet strings to generate references/function.md.
The task requires the puppet-strings gems, so add it to the documentation
bundler group. Since the group is optional, check to see if the gem is present
before trying to load it, similar to how we handle ronn.
If there are both 3.x and 4.x functions with the same name, we ignore the 3.x
version and document the 4.x version.
This code is adapted from puppet-docs. The old code had a bug as it used to
replace /####\s/ with '###\s' resulting in a literal '\s' in the header for
some functions.
If `puppet-strings` gem is installed, then the man page generation will include
strings as a new application type. Since we don't actually ship strings
in puppet, hide it from man page generation.
# Based on https://github.com/puppetlabs/puppet-docs/blob/1a13be3fc6981baa8a96ff832ab090abc986830e/lib/puppet_references/puppet/functions.rb#L24-L56
> **NOTE:** This page was generated from the Puppet source code on <%=now%>
13
+
14
+
15
+
16
+
This page is a list of Puppet's built-in functions, with descriptions of what they do and how to use them.
17
+
18
+
Functions are plugins you can call during catalog compilation. A call to any function is an expression that resolves to a value. For more information on how to call functions, see [the language reference page about function calls.](lang_functions.dita)
19
+
20
+
Many of these function descriptions include auto-detected _signatures,_ which are short reminders of the function's allowed arguments. These signatures aren't identical to the syntax you use to call the function; instead, they resemble a parameter list from a Puppet [class](lang_classes.dita), [defined resource type](lang_defined_types.dita), [function](lang_write_functions_in_puppet.dita), or [lambda](lang_lambdas.dita). The syntax of a signature is:
21
+
22
+
```
23
+
<FUNCTIONNAME>(<DATATYPE><ARGUMENTNAME>, ...)
24
+
```
25
+
26
+
The `<DATATYPE>` is a [Puppet data type value](lang_data_type.dita), like `String` or `Optional[Array[String]]`. The `<ARGUMENTNAME>` is a descriptive name chosen by the function's author to indicate what the argument is used for.
27
+
28
+
* Any arguments with an `Optional` data type can be omitted from the function call.
29
+
* Arguments that start with an asterisk (like `*$values`) can be repeated any number of times.
30
+
* Arguments that start with an ampersand (like `&$block`) aren't normal arguments; they represent a code block, provided with [Puppet's lambda syntax.](lang_lambdas.dita)
31
+
32
+
## `undef` values in Puppet 6
33
+
34
+
In Puppet 6, many Puppet types were moved out of the Puppet codebase, and into modules on the Puppet Forge. The new functions handle `undef` values more strictly than their stdlib counterparts. In Puppet 6, code that relies on `undef` values being implicitly treated as other types will return an evaluation error. For more information on which types were moved into modules, see the [Puppet 6 release notes](https://puppet.com/docs/puppet/6.0/release_notes_puppet.html#select-types-moved-to-modules).
0 commit comments