puppet 5.5.1 → 5.5.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- checksums.yaml +7 -0
- data/CONTRIBUTING.md +3 -3
- data/README.md +2 -2
- data/conf/auth.conf +2 -2
- data/conf/environment.conf +1 -1
- data/conf/fileserver.conf +1 -1
- data/conf/puppet.conf +4 -4
- data/ext/README.environment +1 -1
- data/ext/debian/copyright +2 -2
- data/ext/debian/puppetmaster.README.debian +2 -2
- data/ext/hiera/hiera.yaml +1 -1
- data/ext/puppet-test +1 -1
- data/ext/rack/example-passenger-vhost.conf +1 -1
- data/ext/regexp_nodes/regexp_nodes.rb +12 -12
- data/ext/upload_facts.rb +1 -1
- data/lib/hiera/puppet_function.rb +1 -1
- data/lib/puppet.rb +1 -1
- data/lib/puppet/application/agent.rb +1 -1
- data/lib/puppet/application/apply.rb +1 -1
- data/lib/puppet/application/cert.rb +1 -1
- data/lib/puppet/application/device.rb +8 -8
- data/lib/puppet/application/lookup.rb +1 -1
- data/lib/puppet/application/master.rb +1 -1
- data/lib/puppet/application/resource.rb +1 -1
- data/lib/puppet/application/script.rb +1 -1
- data/lib/puppet/defaults.rb +22 -16
- data/lib/puppet/face/config.rb +1 -1
- data/lib/puppet/face/help/man.erb +1 -1
- data/lib/puppet/face/module/build.rb +3 -3
- data/lib/puppet/face/status.rb +2 -2
- data/lib/puppet/functions/all.rb +2 -2
- data/lib/puppet/functions/any.rb +2 -2
- data/lib/puppet/functions/assert_type.rb +3 -3
- data/lib/puppet/functions/each.rb +2 -2
- data/lib/puppet/functions/eyaml_lookup_key.rb +1 -1
- data/lib/puppet/functions/filter.rb +2 -2
- data/lib/puppet/functions/hiera.rb +5 -5
- data/lib/puppet/functions/hiera_array.rb +5 -5
- data/lib/puppet/functions/hiera_hash.rb +6 -6
- data/lib/puppet/functions/hiera_include.rb +7 -7
- data/lib/puppet/functions/hocon_data.rb +1 -1
- data/lib/puppet/functions/json_data.rb +1 -1
- data/lib/puppet/functions/lest.rb +1 -1
- data/lib/puppet/functions/lookup.rb +1 -1
- data/lib/puppet/functions/map.rb +1 -1
- data/lib/puppet/functions/match.rb +11 -0
- data/lib/puppet/functions/reduce.rb +1 -1
- data/lib/puppet/functions/reverse_each.rb +1 -1
- data/lib/puppet/functions/step.rb +1 -1
- data/lib/puppet/functions/then.rb +1 -1
- data/lib/puppet/functions/tree_each.rb +7 -7
- data/lib/puppet/functions/with.rb +4 -4
- data/lib/puppet/functions/yaml_data.rb +1 -1
- data/lib/puppet/indirector/node/exec.rb +1 -1
- data/lib/puppet/indirector/node/ldap.rb +1 -1
- data/lib/puppet/module_tool/applications/application.rb +1 -1
- data/lib/puppet/module_tool/skeleton/templates/generator/examples/init.pp.erb +1 -1
- data/lib/puppet/network/http/factory.rb +3 -0
- data/lib/puppet/parser/ast/pops_bridge.rb +18 -0
- data/lib/puppet/parser/compiler.rb +1 -1
- data/lib/puppet/parser/functions.rb +1 -1
- data/lib/puppet/parser/functions/assert_type.rb +3 -3
- data/lib/puppet/parser/functions/each.rb +2 -2
- data/lib/puppet/parser/functions/filter.rb +1 -1
- data/lib/puppet/parser/functions/hiera.rb +4 -4
- data/lib/puppet/parser/functions/hiera_array.rb +5 -5
- data/lib/puppet/parser/functions/hiera_hash.rb +6 -6
- data/lib/puppet/parser/functions/hiera_include.rb +10 -11
- data/lib/puppet/parser/functions/inline_template.rb +1 -1
- data/lib/puppet/parser/functions/lest.rb +1 -1
- data/lib/puppet/parser/functions/lookup.rb +1 -1
- data/lib/puppet/parser/functions/map.rb +1 -1
- data/lib/puppet/parser/functions/reduce.rb +1 -1
- data/lib/puppet/parser/functions/reverse_each.rb +1 -1
- data/lib/puppet/parser/functions/step.rb +1 -1
- data/lib/puppet/parser/functions/then.rb +1 -1
- data/lib/puppet/parser/functions/with.rb +4 -4
- data/lib/puppet/pops/types/types.rb +8 -4
- data/lib/puppet/provider/user/aix.rb +1 -1
- data/lib/puppet/reference/providers.rb +1 -1
- data/lib/puppet/reference/report.rb +1 -1
- data/lib/puppet/resource/capability_finder.rb +1 -1
- data/lib/puppet/resource/catalog.rb +2 -2
- data/lib/puppet/resource/type.rb +6 -2
- data/lib/puppet/settings/config_file.rb +1 -1
- data/lib/puppet/settings/environment_conf.rb +10 -1
- data/lib/puppet/ssl/certificate_authority.rb +2 -2
- data/lib/puppet/transaction/report.rb +1 -2
- data/lib/puppet/type.rb +12 -12
- data/lib/puppet/type/file/content.rb +15 -2
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/schedule.rb +1 -1
- data/lib/puppet/type/stage.rb +1 -1
- data/lib/puppet/version.rb +1 -1
- data/locales/ja/puppet.po +179 -148
- data/locales/puppet.pot +139 -115
- data/man/man5/puppet.conf.5 +16 -16
- data/man/man8/puppet-agent.8 +2 -2
- data/man/man8/puppet-apply.8 +2 -2
- data/man/man8/puppet-ca.8 +3 -3
- data/man/man8/puppet-catalog.8 +2 -2
- data/man/man8/puppet-cert.8 +2 -2
- data/man/man8/puppet-certificate.8 +3 -3
- data/man/man8/puppet-certificate_request.8 +2 -2
- data/man/man8/puppet-certificate_revocation_list.8 +2 -2
- data/man/man8/puppet-config.8 +3 -3
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +2 -2
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +2 -2
- data/man/man8/puppet-facts.8 +2 -2
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +2 -2
- data/man/man8/puppet-help.8 +2 -2
- data/man/man8/puppet-key.8 +2 -2
- data/man/man8/puppet-lookup.8 +2 -2
- data/man/man8/puppet-man.8 +2 -2
- data/man/man8/puppet-master.8 +2 -2
- data/man/man8/puppet-module.8 +4 -4
- data/man/man8/puppet-node.8 +2 -2
- data/man/man8/puppet-parser.8 +2 -2
- data/man/man8/puppet-plugin.8 +2 -2
- data/man/man8/puppet-report.8 +2 -2
- data/man/man8/puppet-resource.8 +2 -2
- data/man/man8/puppet-script.8 +2 -2
- data/man/man8/puppet-status.8 +3 -3
- data/man/man8/puppet.8 +2 -2
- data/spec/integration/type/file_spec.rb +30 -0
- data/spec/unit/defaults_spec.rb +14 -0
- data/spec/unit/environments_spec.rb +40 -0
- data/spec/unit/face/module/build_spec.rb +2 -2
- data/spec/unit/functions/match_spec.rb +18 -0
- data/spec/unit/functions/new_spec.rb +1 -0
- data/spec/unit/network/http/factory_spec.rb +35 -28
- data/spec/unit/resource/type_spec.rb +22 -6
- data/spec/unit/type/file/content_spec.rb +12 -0
- data/spec/unit/type/file/source_spec.rb +8 -2
- metadata +3628 -3640
data/lib/puppet/face/config.rb
CHANGED
@@ -10,7 +10,7 @@ Puppet::Face.define(:config, '0.0.1') do
|
|
10
10
|
|
11
11
|
description "This subcommand can inspect and modify settings from Puppet's
|
12
12
|
'puppet.conf' configuration file. For documentation about individual settings,
|
13
|
-
see https://
|
13
|
+
see https://puppet.com/docs/puppet/latest/configuration.html."
|
14
14
|
|
15
15
|
DEFAULT_SECTION_MARKER = Object.new
|
16
16
|
DEFAULT_SECTION = "main"
|
@@ -23,7 +23,7 @@ settings, so you can specify `--server <servername>`, or
|
|
23
23
|
`--run_mode <runmode>` as an argument.
|
24
24
|
|
25
25
|
See the configuration file documentation at
|
26
|
-
<https://
|
26
|
+
<https://puppet.com/docs/puppet/latest/configuration.html> for the
|
27
27
|
full list of acceptable parameters. A commented list of all
|
28
28
|
configuration options can also be generated by running puppet with
|
29
29
|
`--genconfig`.
|
@@ -7,7 +7,7 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
7
7
|
Note: Module build uses MD5 checksums, which are prohibited on FIPS enabled systems.
|
8
8
|
|
9
9
|
This action uses the metadata.json file in the module directory to set metadata
|
10
|
-
used by the Forge. See <https://
|
10
|
+
used by the Forge. See <https://puppet.com/docs/puppet/latest/modules_publishing.html> for more
|
11
11
|
about writing metadata.json files.
|
12
12
|
|
13
13
|
After being built, the release archive file can be found in the module's
|
@@ -44,11 +44,11 @@ Puppet::Face.define(:module, '1.0.0') do
|
|
44
44
|
pwd = Dir.pwd
|
45
45
|
module_path = Puppet::ModuleTool.find_module_root(pwd)
|
46
46
|
if module_path.nil?
|
47
|
-
raise _("Unable to find metadata.json in module root %{pwd} or parent directories. See <https://
|
47
|
+
raise _("Unable to find metadata.json in module root %{pwd} or parent directories. See <https://puppet.com/docs/puppet/latest/modules_publishing.html> for required file format.") % { pwd: pwd }
|
48
48
|
end
|
49
49
|
else
|
50
50
|
unless Puppet::ModuleTool.is_module_root?(module_path)
|
51
|
-
raise _("Unable to find metadata.json in module root %{module_path} or parent directories. See <https://
|
51
|
+
raise _("Unable to find metadata.json in module root %{module_path} or parent directories. See <https://puppet.com/docs/puppet/latest/modules_publishing.html> for required file format.") % { module_path: module_path }
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
data/lib/puppet/face/status.rb
CHANGED
@@ -38,7 +38,7 @@ Puppet::Indirector::Face.define(:status, '0.0.1') do
|
|
38
38
|
This action requires that the server's `auth.conf` file allow find
|
39
39
|
access to the `status` REST terminus. Puppet agent does not use this
|
40
40
|
facility, and it is turned off by default. See
|
41
|
-
<https://
|
41
|
+
<https://puppet.com/docs/puppet/latest/config_file_auth.html>
|
42
42
|
for more details.
|
43
43
|
EOT
|
44
44
|
find.examples <<-'EOT'
|
@@ -46,6 +46,6 @@ Puppet::Indirector::Face.define(:status, '0.0.1') do
|
|
46
46
|
|
47
47
|
$ puppet status find --terminus rest
|
48
48
|
EOT
|
49
|
-
|
49
|
+
|
50
50
|
deprecate
|
51
51
|
end
|
data/lib/puppet/functions/all.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Runs a [lambda](
|
1
|
+
# Runs a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
2
2
|
# repeatedly using each value in a data structure until the lambda returns a non "truthy" value which
|
3
3
|
# makes the function return `false`, or if the end of the iteration is reached, `true` is returned.
|
4
4
|
#
|
@@ -54,7 +54,7 @@
|
|
54
54
|
# Would notice true.
|
55
55
|
#
|
56
56
|
# For an general examples that demonstrates iteration, see the Puppet
|
57
|
-
# [iteration](https://
|
57
|
+
# [iteration](https://puppet.com/docs/puppet/latest/lang_iteration.html)
|
58
58
|
# documentation.
|
59
59
|
#
|
60
60
|
# @since 5.2.0
|
data/lib/puppet/functions/any.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Runs a [lambda](
|
1
|
+
# Runs a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
2
2
|
# repeatedly using each value in a data structure until the lambda returns a "truthy" value which
|
3
3
|
# makes the function return `true`, or if the end of the iteration is reached, false is returned.
|
4
4
|
#
|
@@ -59,7 +59,7 @@
|
|
59
59
|
# Would notice true as the index `2` is even and not a `String`
|
60
60
|
#
|
61
61
|
# For an general examples that demonstrates iteration, see the Puppet
|
62
|
-
# [iteration](https://
|
62
|
+
# [iteration](https://puppet.com/docs/puppet/latest/lang_iteration.html)
|
63
63
|
# documentation.
|
64
64
|
#
|
65
65
|
# @since 5.2.0
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# Returns the given value if it is of the given
|
2
|
-
# [data type](https://
|
2
|
+
# [data type](https://puppet.com/docs/puppet/latest/lang_data.html), or
|
3
3
|
# otherwise either raises an error or executes an optional two-parameter
|
4
|
-
# [lambda](https://
|
4
|
+
# [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html).
|
5
5
|
#
|
6
6
|
# The function takes two mandatory arguments, in this order:
|
7
7
|
#
|
@@ -46,7 +46,7 @@
|
|
46
46
|
# ```
|
47
47
|
#
|
48
48
|
# For more information about data types, see the
|
49
|
-
# [documentation](https://
|
49
|
+
# [documentation](https://puppet.com/docs/puppet/latest/lang_data.html).
|
50
50
|
#
|
51
51
|
# @since 4.0.0
|
52
52
|
#
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Runs a [lambda](https://
|
1
|
+
# Runs a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
2
2
|
# repeatedly using each value in a data structure, then returns the values unchanged.
|
3
3
|
#
|
4
4
|
# This function takes two mandatory arguments, in this order:
|
@@ -89,7 +89,7 @@
|
|
89
89
|
#
|
90
90
|
# For an example that demonstrates how to create multiple `file` resources using `each`,
|
91
91
|
# see the Puppet
|
92
|
-
# [iteration](https://
|
92
|
+
# [iteration](https://puppet.com/docs/puppet/latest/lang_iteration.html)
|
93
93
|
# documentation.
|
94
94
|
#
|
95
95
|
# @since 4.0.0
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# The `eyaml_lookup_key` is a hiera 5 `lookup_key` data provider function.
|
2
|
-
# See [the configuration guide documentation](https://
|
2
|
+
# See [the configuration guide documentation](https://puppet.com/docs/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-hiera-eyaml) for
|
3
3
|
# how to use this function.
|
4
4
|
#
|
5
5
|
# @since 5.0.0
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Applies a [lambda](https://
|
1
|
+
# Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
2
2
|
# to every value in a data structure and returns an array or hash containing any elements
|
3
3
|
# for which the lambda evaluates to `true`.
|
4
4
|
#
|
@@ -59,7 +59,7 @@
|
|
59
59
|
# @example Using the `filter` function with a hash and a two-parameter lambda
|
60
60
|
#
|
61
61
|
# ```puppet
|
62
|
-
# # For the hash $data, return a hash of all keys that both end with "berry" and have
|
62
|
+
# # For the hash $data, return a hash of all keys that both end with "berry" and have
|
63
63
|
# # values less than or equal to 1
|
64
64
|
# $data = { "orange" => 0, "blueberry" => 1, "raspberry" => 2 }
|
65
65
|
# $filtered_data = $data.filter |$keys, $values| { $keys =~ /berry$/ and $values <= 1 }
|
@@ -14,7 +14,7 @@ require 'hiera/puppet_function'
|
|
14
14
|
# * If this argument isn't provided and this function results in a lookup failure, Puppet
|
15
15
|
# fails with a compilation error.
|
16
16
|
# 3. The optional name of an arbitrary
|
17
|
-
# [hierarchy level](https://
|
17
|
+
# [hierarchy level](https://puppet.com/docs/hiera/latest/hierarchy.html) to insert at the
|
18
18
|
# top of the hierarchy. This lets you temporarily modify the hierarchy for a single lookup.
|
19
19
|
# * If Hiera doesn't find a matching key in the overriding hierarchy level, it continues
|
20
20
|
# searching the rest of the hierarchy.
|
@@ -56,7 +56,7 @@ require 'hiera/puppet_function'
|
|
56
56
|
# ```
|
57
57
|
#
|
58
58
|
# You can optionally generate the default value with a
|
59
|
-
# [lambda](https://
|
59
|
+
# [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) that
|
60
60
|
# takes one parameter.
|
61
61
|
#
|
62
62
|
# @example Using `hiera` with a lambda
|
@@ -72,13 +72,13 @@ require 'hiera/puppet_function'
|
|
72
72
|
# # "Key 'users' not found".
|
73
73
|
# ```
|
74
74
|
#
|
75
|
-
# The returned value's data type depends on the types of the results. In the example
|
75
|
+
# The returned value's data type depends on the types of the results. In the example
|
76
76
|
# above, Hiera matches the 'users' key and returns it as a hash.
|
77
77
|
#
|
78
78
|
# See
|
79
|
-
# [the 'Using the lookup function' documentation](https://
|
79
|
+
# [the 'Using the lookup function' documentation](https://puppet.com/docs/puppet/latest/hiera_automatic.html) for how to perform lookup of data.
|
80
80
|
# Also see
|
81
|
-
# [the 'Using the deprecated hiera functions' documentation](https://
|
81
|
+
# [the 'Using the deprecated hiera functions' documentation](https://puppet.com/docs/puppet/latest/hiera_automatic.html)
|
82
82
|
# for more information about the Hiera 3 functions.
|
83
83
|
#
|
84
84
|
# @since 4.0.0
|
@@ -3,7 +3,7 @@ require 'hiera/puppet_function'
|
|
3
3
|
# Finds all matches of a key throughout the hierarchy and returns them as a single flattened
|
4
4
|
# array of unique values. If any of the matched values are arrays, they're flattened and
|
5
5
|
# included in the results. This is called an
|
6
|
-
# [array merge lookup](https://
|
6
|
+
# [array merge lookup](https://puppet.com/docs/hiera/latest/lookup_types.html#array-merge).
|
7
7
|
#
|
8
8
|
# This function is deprecated in favor of the `lookup` function. While this function
|
9
9
|
# continues to work, it does **not** support:
|
@@ -17,7 +17,7 @@ require 'hiera/puppet_function'
|
|
17
17
|
# * If this argument isn't provided and this function results in a lookup failure, Puppet
|
18
18
|
# fails with a compilation error.
|
19
19
|
# 3. The optional name of an arbitrary
|
20
|
-
# [hierarchy level](https://
|
20
|
+
# [hierarchy level](https://puppet.com/docs/hiera/latest/hierarchy.html) to insert at the
|
21
21
|
# top of the hierarchy. This lets you temporarily modify the hierarchy for a single lookup.
|
22
22
|
# * If Hiera doesn't find a matching key in the overriding hierarchy level, it continues
|
23
23
|
# searching the rest of the hierarchy.
|
@@ -46,7 +46,7 @@ require 'hiera/puppet_function'
|
|
46
46
|
# ```
|
47
47
|
#
|
48
48
|
# You can optionally generate the default value with a
|
49
|
-
# [lambda](https://
|
49
|
+
# [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) that
|
50
50
|
# takes one parameter.
|
51
51
|
#
|
52
52
|
# @example Using `hiera_array` with a lambda
|
@@ -65,9 +65,9 @@ require 'hiera/puppet_function'
|
|
65
65
|
# value is a hash, Puppet raises a type mismatch error.
|
66
66
|
#
|
67
67
|
# See
|
68
|
-
# [the 'Using the lookup function' documentation](https://
|
68
|
+
# [the 'Using the lookup function' documentation](https://puppet.com/docs/puppet/latest/hiera_automatic.html) for how to perform lookup of data.
|
69
69
|
# Also see
|
70
|
-
# [the 'Using the deprecated hiera functions' documentation](https://
|
70
|
+
# [the 'Using the deprecated hiera functions' documentation](https://puppet.com/docs/puppet/latest/hiera_automatic.html)
|
71
71
|
# for more information about the Hiera 3 functions.
|
72
72
|
#
|
73
73
|
# @since 4.0.0
|
@@ -9,10 +9,10 @@ require 'hiera/puppet_function'
|
|
9
9
|
#
|
10
10
|
# If any of the matched hashes share keys, the final hash uses the value from the
|
11
11
|
# highest priority match. This is called a
|
12
|
-
# [hash merge lookup](https://
|
12
|
+
# [hash merge lookup](https://puppet.com/docs/hiera/latest/lookup_types.html#hash-merge).
|
13
13
|
#
|
14
14
|
# The merge strategy is determined by Hiera's
|
15
|
-
# [`:merge_behavior`](https://
|
15
|
+
# [`:merge_behavior`](https://puppet.com/docs/hiera/latest/configuring.html#mergebehavior)
|
16
16
|
# setting.
|
17
17
|
#
|
18
18
|
# The `hiera_hash` function takes up to three arguments, in this order:
|
@@ -22,7 +22,7 @@ require 'hiera/puppet_function'
|
|
22
22
|
# * If this argument isn't provided and this function results in a lookup failure, Puppet
|
23
23
|
# fails with a compilation error.
|
24
24
|
# 3. The optional name of an arbitrary
|
25
|
-
# [hierarchy level](https://
|
25
|
+
# [hierarchy level](https://puppet.com/docs/hiera/latest/hierarchy.html) to insert at the
|
26
26
|
# top of the hierarchy. This lets you temporarily modify the hierarchy for a single lookup.
|
27
27
|
# * If Hiera doesn't find a matching key in the overriding hierarchy level, it continues
|
28
28
|
# searching the rest of the hierarchy.
|
@@ -56,7 +56,7 @@ require 'hiera/puppet_function'
|
|
56
56
|
# ```
|
57
57
|
#
|
58
58
|
# You can optionally generate the default value with a
|
59
|
-
# [lambda](https://
|
59
|
+
# [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) that
|
60
60
|
# takes one parameter.
|
61
61
|
#
|
62
62
|
# @example Using `hiera_hash` with a lambda
|
@@ -76,9 +76,9 @@ require 'hiera/puppet_function'
|
|
76
76
|
# found in the data sources are strings or arrays, Puppet raises a type mismatch error.
|
77
77
|
#
|
78
78
|
# See
|
79
|
-
# [the 'Using the lookup function' documentation](https://
|
79
|
+
# [the 'Using the lookup function' documentation](https://puppet.com/docs/puppet/latest/hiera_automatic.html) for how to perform lookup of data.
|
80
80
|
# Also see
|
81
|
-
# [the 'Using the deprecated hiera functions' documentation](https://
|
81
|
+
# [the 'Using the deprecated hiera functions' documentation](https://puppet.com/docs/puppet/latest/hiera_automatic.html)
|
82
82
|
# for more information about the Hiera 3 functions.
|
83
83
|
#
|
84
84
|
# @since 4.0.0
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'hiera/puppet_function'
|
2
2
|
|
3
3
|
# Assigns classes to a node using an
|
4
|
-
# [array merge lookup](https://
|
4
|
+
# [array merge lookup](https://puppet.com/docs/hiera/latest/lookup_types.html#array-merge)
|
5
5
|
# that retrieves the value for a user-specified key from Hiera's data.
|
6
6
|
#
|
7
7
|
# This function is deprecated in favor of the `lookup` function in combination with `include`.
|
@@ -10,7 +10,7 @@ require 'hiera/puppet_function'
|
|
10
10
|
# * lookup across global, environment, and module layers
|
11
11
|
#
|
12
12
|
# @example Using `lookup` and `include` instead of of the deprecated `hiera_include`
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# ```puppet
|
15
15
|
# # In site.pp, outside of any node definitions and below any top-scope variables:
|
16
16
|
# lookup('classes', Array[String], 'unique').include
|
@@ -32,13 +32,13 @@ require 'hiera/puppet_function'
|
|
32
32
|
# * If this argument isn't provided and this function results in a lookup failure, Puppet
|
33
33
|
# fails with a compilation error.
|
34
34
|
# 3. The optional name of an arbitrary
|
35
|
-
# [hierarchy level](https://
|
35
|
+
# [hierarchy level](https://puppet.com/docs/hiera/latest/hierarchy.html) to insert at the
|
36
36
|
# top of the hierarchy. This lets you temporarily modify the hierarchy for a single lookup.
|
37
37
|
# * If Hiera doesn't find a matching key in the overriding hierarchy level, it continues
|
38
38
|
# searching the rest of the hierarchy.
|
39
39
|
#
|
40
40
|
# The function uses an
|
41
|
-
# [array merge lookup](https://
|
41
|
+
# [array merge lookup](https://puppet.com/docs/hiera/latest/lookup_types.html#array-merge)
|
42
42
|
# to retrieve the `classes` array, so every node gets every class from the hierarchy.
|
43
43
|
#
|
44
44
|
# @example Using `hiera_include`
|
@@ -66,7 +66,7 @@ require 'hiera/puppet_function'
|
|
66
66
|
# ```
|
67
67
|
#
|
68
68
|
# You can optionally generate the default value with a
|
69
|
-
# [lambda](https://
|
69
|
+
# [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) that
|
70
70
|
# takes one parameter.
|
71
71
|
#
|
72
72
|
# @example Using `hiera_include` with a lambda
|
@@ -83,9 +83,9 @@ require 'hiera/puppet_function'
|
|
83
83
|
# ```
|
84
84
|
#
|
85
85
|
# See
|
86
|
-
# [the 'Using the lookup function' documentation](https://
|
86
|
+
# [the 'Using the lookup function' documentation](https://puppet.com/docs/puppet/latest/hiera_automatic.html) for how to perform lookup of data.
|
87
87
|
# Also see
|
88
|
-
# [the 'Using the deprecated hiera functions' documentation](https://
|
88
|
+
# [the 'Using the deprecated hiera functions' documentation](https://puppet.com/docs/puppet/latest/hiera_automatic.html)
|
89
89
|
# for more information about the Hiera 3 functions.
|
90
90
|
#
|
91
91
|
# @since 4.0.0
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# The `hocon_data` is a hiera 5 `data_hash` data provider function.
|
2
|
-
# See [the configuration guide documentation](https://
|
2
|
+
# See [the configuration guide documentation](https://puppet.com/docs/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for
|
3
3
|
# how to use this function.
|
4
4
|
#
|
5
5
|
# Note that this function is not supported without a hocon library being present.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# The `json_data` is a hiera 5 `data_hash` data provider function.
|
2
|
-
# See [the configuration guide documentation](https://
|
2
|
+
# See [the configuration guide documentation](https://puppet.com/docs/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for
|
3
3
|
# how to use this function.
|
4
4
|
#
|
5
5
|
# @since 4.8.0
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Calls a [lambda](https://
|
1
|
+
# Calls a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
2
2
|
# without arguments if the value given to `lest` is `undef`.
|
3
3
|
# Returns the result of calling the lambda if the argument is `undef`, otherwise the
|
4
4
|
# given argument.
|
@@ -29,7 +29,7 @@
|
|
29
29
|
# first key, it will try again with the subsequent ones, only resorting to a
|
30
30
|
# default value if none of them succeed.
|
31
31
|
# 2. `<VALUE TYPE>` (data type) --- A
|
32
|
-
# [data type](https://
|
32
|
+
# [data type](https://puppet.com/docs/puppet/latest/lang_data_type.html)
|
33
33
|
# that must match the retrieved value; if not, the lookup (and catalog
|
34
34
|
# compilation) will fail. Defaults to `Data` (accepts any normal value).
|
35
35
|
# 3. `<MERGE BEHAVIOR>` (string or hash; see **"Merge Behaviors"** below) ---
|
data/lib/puppet/functions/map.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Applies a [lambda](https://
|
1
|
+
# Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
2
2
|
# to every value in a data structure and returns an array containing the results.
|
3
3
|
#
|
4
4
|
# This function takes two mandatory arguments, in this order:
|
@@ -90,6 +90,17 @@ Puppet::Functions.create_function(:match) do
|
|
90
90
|
do_match(s, regexp)
|
91
91
|
end
|
92
92
|
|
93
|
+
def match_PTypeAliasType(alias_t, s)
|
94
|
+
match(s, alias_t.resolved_type)
|
95
|
+
end
|
96
|
+
|
97
|
+
def match_PVariantType(var_t, s)
|
98
|
+
# Find first matching type (or error out if one of the variants is not acceptable)
|
99
|
+
result = nil
|
100
|
+
var_t.types.find {|t| result = match(s, t) }
|
101
|
+
result
|
102
|
+
end
|
103
|
+
|
93
104
|
def match_PRegexpType(regexp_t, s)
|
94
105
|
raise ArgumentError, _("Given Regexp Type has no regular expression") unless regexp_t.pattern
|
95
106
|
do_match(s, regexp_t.regexp)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Applies a [lambda](https://
|
1
|
+
# Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
2
2
|
# to every value in a data structure from the first argument, carrying over the returned
|
3
3
|
# value of each iteration, and returns the result of the lambda's final iteration. This
|
4
4
|
# lets you create a new value or data structure by combining values from the first
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Reverses the order of the elements of something that is iterable and optionally runs a
|
2
|
-
# [lambda](https://
|
2
|
+
# [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) for each
|
3
3
|
# element.
|
4
4
|
#
|
5
5
|
# This function takes one to two arguments:
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Provides stepping with given interval over elements in an iterable and optionally runs a
|
2
|
-
# [lambda](https://
|
2
|
+
# [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) for each
|
3
3
|
# element.
|
4
4
|
#
|
5
5
|
# This function takes two to three arguments:
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Calls a [lambda](https://
|
1
|
+
# Calls a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
2
2
|
# with the given argument unless the argument is `undef`.
|
3
3
|
# Returns `undef` if the argument is `undef`, and otherwise the result of giving the
|
4
4
|
# argument to the lambda.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Runs a [lambda](
|
1
|
+
# Runs a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
2
2
|
# recursively and repeatedly using values from a data structure, then returns the unchanged data structure, or if
|
3
3
|
# a lambda is not given, returns an `Iterator` for the tree.
|
4
4
|
#
|
@@ -50,13 +50,13 @@
|
|
50
50
|
#
|
51
51
|
# If containers are skipped:
|
52
52
|
#
|
53
|
-
# * `depth_first` order `1`, `2`, `3`, `4`
|
54
|
-
# * `breadth_first` order `1`, `4`,`2`, `3`
|
53
|
+
# * `depth_first` order `1`, `2`, `3`, `4`
|
54
|
+
# * `breadth_first` order `1`, `4`,`2`, `3`
|
55
55
|
#
|
56
56
|
# If containers and root, are included:
|
57
57
|
#
|
58
|
-
# * `depth_first` order `[1, [2, 3], 4]`, `1`, `[2, 3]`, `2`, `3`, `4`
|
59
|
-
# * `breadth_first` order `[1, [2, 3], 4]`, `1`, `[2, 3]`, `4`, `2`, `3`
|
58
|
+
# * `depth_first` order `[1, [2, 3], 4]`, `1`, `[2, 3]`, `2`, `3`, `4`
|
59
|
+
# * `breadth_first` order `[1, [2, 3], 4]`, `1`, `[2, 3]`, `4`, `2`, `3`
|
60
60
|
#
|
61
61
|
# Typical use of the `tree_each` function include:
|
62
62
|
# * a more efficient way to iterate over a tree than first using `flatten` on an array
|
@@ -111,7 +111,7 @@
|
|
111
111
|
# **Chaining** When calling `tree_each` without a lambda the function produces an `Iterator`
|
112
112
|
# that can be chained into another iteration. Thus it is easy to use one of:
|
113
113
|
#
|
114
|
-
# * `reverse_each` - get "leaves before root"
|
114
|
+
# * `reverse_each` - get "leaves before root"
|
115
115
|
# * `filter` - prune the tree
|
116
116
|
# * `map` - transform each element
|
117
117
|
# * `reduce` - produce something else
|
@@ -137,7 +137,7 @@
|
|
137
137
|
#
|
138
138
|
#
|
139
139
|
# For general examples that demonstrates iteration see the Puppet
|
140
|
-
# [iteration](https://
|
140
|
+
# [iteration](https://puppet.com/docs/puppet/latest/lang_iteration.html)
|
141
141
|
# documentation.
|
142
142
|
#
|
143
143
|
# @since 5.0.0
|
@@ -1,8 +1,8 @@
|
|
1
|
-
# Calls a [lambda](https://
|
1
|
+
# Calls a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
2
2
|
# with the given arguments and returns the result.
|
3
3
|
#
|
4
4
|
# Since a lambda's scope is
|
5
|
-
# [local](https://
|
5
|
+
# [local](https://puppet.com/docs/puppet/latest/lang_lambdas.html#lambda-scope)
|
6
6
|
# to the lambda, you can use the `with` function to create private blocks of code within a
|
7
7
|
# class using variables whose values cannot be accessed outside of the lambda.
|
8
8
|
#
|
@@ -10,8 +10,8 @@
|
|
10
10
|
#
|
11
11
|
# ```puppet
|
12
12
|
# # Concatenate three strings into a single string formatted as a list.
|
13
|
-
# $fruit = with("apples", "oranges", "bananas") |$x, $y, $z| {
|
14
|
-
# "${x}, ${y}, and ${z}"
|
13
|
+
# $fruit = with("apples", "oranges", "bananas") |$x, $y, $z| {
|
14
|
+
# "${x}, ${y}, and ${z}"
|
15
15
|
# }
|
16
16
|
# $check_var = $x
|
17
17
|
# # $fruit contains "apples, oranges, and bananas"
|