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
@@ -1,5 +1,5 @@
|
|
1
1
|
# The `yaml_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
|
@@ -3,7 +3,7 @@ require 'puppet/indirector/exec'
|
|
3
3
|
|
4
4
|
class Puppet::Node::Exec < Puppet::Indirector::Exec
|
5
5
|
desc "Call an external program to get node information. See
|
6
|
-
the [External Nodes](https://
|
6
|
+
the [External Nodes](https://puppet.com/docs/puppet/latest/lang_write_functions_in_puppet.html) page for more information."
|
7
7
|
include Puppet::Util
|
8
8
|
|
9
9
|
def command
|
@@ -3,7 +3,7 @@ require 'puppet/indirector/ldap'
|
|
3
3
|
|
4
4
|
class Puppet::Node::Ldap < Puppet::Indirector::Ldap
|
5
5
|
desc "Search in LDAP for node configuration information. See
|
6
|
-
the [LDAP Nodes](https://
|
6
|
+
the [LDAP Nodes](https://puppet.com/docs/puppet/latest/nodes_ldap.html) page for more information. This will first
|
7
7
|
search for whatever the certificate name is, then (if that name
|
8
8
|
contains a `.`) for the short name, then `default`.
|
9
9
|
Requires ruby-ldap with MRI ruby or jruby-ldap with puppetserver/jruby"
|
@@ -40,7 +40,7 @@ module Puppet::ModuleTool
|
|
40
40
|
end
|
41
41
|
|
42
42
|
if require_metadata && !Puppet::ModuleTool.is_module_root?(@path)
|
43
|
-
raise ArgumentError, _("Unable to find metadata.json in module root at %{path} See https://
|
43
|
+
raise ArgumentError, _("Unable to find metadata.json in module root at %{path} See https://puppet.com/docs/puppet/latest/modules_publishing.html for required file format.") % { path: @path }
|
44
44
|
end
|
45
45
|
|
46
46
|
metadata_path = File.join(@path, 'metadata.json')
|
@@ -7,6 +7,6 @@
|
|
7
7
|
# environment (to compare the resulting system state to the desired state).
|
8
8
|
#
|
9
9
|
# Learn more about module testing here:
|
10
|
-
# https://
|
10
|
+
# https://puppet.com/docs/puppet/latest/bgtm.html#testing-your-module
|
11
11
|
#
|
12
12
|
include ::<%= metadata.name %>
|
@@ -12,6 +12,8 @@ require 'puppet/util/http_proxy'
|
|
12
12
|
class Puppet::Network::HTTP::Factory
|
13
13
|
@@openssl_initialized = false
|
14
14
|
|
15
|
+
KEEP_ALIVE_TIMEOUT = 2**31 - 1
|
16
|
+
|
15
17
|
def initialize
|
16
18
|
# PUP-1411, make sure that openssl is initialized before we try to connect
|
17
19
|
if ! @@openssl_initialized
|
@@ -37,6 +39,7 @@ class Puppet::Network::HTTP::Factory
|
|
37
39
|
http.use_ssl = site.use_ssl?
|
38
40
|
http.read_timeout = Puppet[:http_read_timeout]
|
39
41
|
http.open_timeout = Puppet[:http_connect_timeout]
|
42
|
+
http.keep_alive_timeout = KEEP_ALIVE_TIMEOUT if http.respond_to?(:keep_alive_timeout=)
|
40
43
|
|
41
44
|
if Puppet[:sourceaddress]
|
42
45
|
if http.respond_to?(:local_host)
|
@@ -132,8 +132,26 @@ class Puppet::Parser::AST::PopsBridge
|
|
132
132
|
yield self
|
133
133
|
end
|
134
134
|
|
135
|
+
# Returns true if this Program only contains definitions
|
136
|
+
def is_definitions_only?
|
137
|
+
is_definition?(program_model)
|
138
|
+
end
|
139
|
+
|
135
140
|
private
|
136
141
|
|
142
|
+
def is_definition?(o)
|
143
|
+
case o
|
144
|
+
when Puppet::Pops::Model::Program
|
145
|
+
is_definition?(o.body)
|
146
|
+
when Puppet::Pops::Model::BlockExpression
|
147
|
+
o.statements.all {|s| is_definition?(s) }
|
148
|
+
when Puppet::Pops::Model::Definition
|
149
|
+
true
|
150
|
+
else
|
151
|
+
false
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
137
155
|
def instantiate_Parameter(o)
|
138
156
|
# 3x needs parameters as an array of `[name]` or `[name, value_expr]`
|
139
157
|
if o.value
|
@@ -27,7 +27,7 @@ class Puppet::Parser::Compiler
|
|
27
27
|
errors.each { |e| Puppet.err(e) } if errors.size > 1
|
28
28
|
errmsg = [
|
29
29
|
_("Compilation has been halted because: %{error}") % { error: errors.first },
|
30
|
-
_("For more information, see https://
|
30
|
+
_("For more information, see https://puppet.com/docs/puppet/latest/environments_about.html"),
|
31
31
|
]
|
32
32
|
raise(Puppet::Error, errmsg.join(' '))
|
33
33
|
end
|
@@ -82,7 +82,7 @@ module Puppet::Parser::Functions
|
|
82
82
|
# extend the behavior and functionality of Puppet.
|
83
83
|
#
|
84
84
|
# See also [Docs: Custom
|
85
|
-
# Functions](https://
|
85
|
+
# Functions](https://puppet.com/docs/puppet/5.5/lang_write_functions_in_puppet.html)
|
86
86
|
#
|
87
87
|
# @example Define a new Puppet DSL Function
|
88
88
|
# >> Puppet::Parser::Functions.newfunction(:double, :arity => 1,
|
@@ -4,9 +4,9 @@ Puppet::Parser::Functions::newfunction(
|
|
4
4
|
:arity => -3,
|
5
5
|
:doc => <<DOC
|
6
6
|
Returns the given value if it is of the given
|
7
|
-
[data type](https://
|
7
|
+
[data type](https://puppet.com/docs/puppet/latest/lang_data.html), or
|
8
8
|
otherwise either raises an error or executes an optional two-parameter
|
9
|
-
[lambda](https://
|
9
|
+
[lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html).
|
10
10
|
|
11
11
|
The function takes two mandatory arguments, in this order:
|
12
12
|
|
@@ -51,7 +51,7 @@ $valid_username = assert_type(String[1], $raw_username) |$expected, $actual| {
|
|
51
51
|
~~~
|
52
52
|
|
53
53
|
For more information about data types, see the
|
54
|
-
[documentation](https://
|
54
|
+
[documentation](https://puppet.com/docs/puppet/latest/lang_data.html).
|
55
55
|
|
56
56
|
- Since 4.0.0
|
57
57
|
DOC
|
@@ -3,7 +3,7 @@ Puppet::Parser::Functions::newfunction(
|
|
3
3
|
:type => :rvalue,
|
4
4
|
:arity => -3,
|
5
5
|
:doc => <<-DOC
|
6
|
-
Runs a [lambda](https://
|
6
|
+
Runs a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
7
7
|
repeatedly using each value in a data structure, then returns the values unchanged.
|
8
8
|
|
9
9
|
This function takes two mandatory arguments, in this order:
|
@@ -94,7 +94,7 @@ $data.each |$key, $value| {
|
|
94
94
|
|
95
95
|
For an example that demonstrates how to create multiple `file` resources using `each`,
|
96
96
|
see the Puppet
|
97
|
-
[iteration](https://
|
97
|
+
[iteration](https://puppet.com/docs/puppet/latest/lang_iteration.html)
|
98
98
|
documentation.
|
99
99
|
|
100
100
|
- Since 4.0.0
|
@@ -3,7 +3,7 @@ Puppet::Parser::Functions::newfunction(
|
|
3
3
|
:type => :rvalue,
|
4
4
|
:arity => -3,
|
5
5
|
:doc => <<-DOC
|
6
|
-
Applies a [lambda](https://
|
6
|
+
Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
7
7
|
to every value in a data structure and returns an array or hash containing any elements
|
8
8
|
for which the lambda evaluates to `true`.
|
9
9
|
|
@@ -16,7 +16,7 @@ The function takes up to three arguments, in this order:
|
|
16
16
|
* If this argument isn't provided and this function results in a lookup failure, Puppet
|
17
17
|
fails with a compilation error.
|
18
18
|
3. The optional name of an arbitrary
|
19
|
-
[hierarchy level](https://
|
19
|
+
[hierarchy level](https://puppet.com/docs/hiera/latest/hierarchy.html) to insert at the
|
20
20
|
top of the hierarchy. This lets you temporarily modify the hierarchy for a single lookup.
|
21
21
|
* If Hiera doesn't find a matching key in the overriding hierarchy level, it continues
|
22
22
|
searching the rest of the hierarchy.
|
@@ -58,7 +58,7 @@ $users = hiera('users', undef)
|
|
58
58
|
~~~
|
59
59
|
|
60
60
|
You can optionally generate the default value with a
|
61
|
-
[lambda](https://
|
61
|
+
[lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) that
|
62
62
|
takes one parameter.
|
63
63
|
|
64
64
|
**Example**: Using `hiera` with a lambda
|
@@ -78,7 +78,7 @@ The returned value's data type depends on the types of the results. In the examp
|
|
78
78
|
above, Hiera matches the 'users' key and returns it as a hash.
|
79
79
|
|
80
80
|
The `hiera` function is deprecated in favor of using `lookup` and will be removed in 6.0.0.
|
81
|
-
See
|
81
|
+
See https://puppet.com/docs/puppet/#{Puppet.minor_version}/deprecated_language.html.
|
82
82
|
Replace the calls as follows:
|
83
83
|
|
84
84
|
| from | to |
|
@@ -92,7 +92,7 @@ result must be post processed to get exactly the same result, for example using
|
|
92
92
|
with calls to stdlib's `deep_merge` function depending on kind of hiera call and setting of merge in hiera.yaml.
|
93
93
|
|
94
94
|
See
|
95
|
-
[the documentation](https://
|
95
|
+
[the documentation](https://puppet.com/docs/hiera/latest/puppet.html#hiera-lookup-functions)
|
96
96
|
for more information about Hiera lookup functions.
|
97
97
|
|
98
98
|
- Since 4.0.0
|
@@ -9,7 +9,7 @@ module Puppet::Parser::Functions
|
|
9
9
|
Finds all matches of a key throughout the hierarchy and returns them as a single flattened
|
10
10
|
array of unique values. If any of the matched values are arrays, they're flattened and
|
11
11
|
included in the results. This is called an
|
12
|
-
[array merge lookup](https://
|
12
|
+
[array merge lookup](https://puppet.com/docs/hiera/latest/lookup_types.html#array-merge).
|
13
13
|
|
14
14
|
The `hiera_array` function takes up to three arguments, in this order:
|
15
15
|
|
@@ -18,7 +18,7 @@ The `hiera_array` function takes up to three arguments, in this order:
|
|
18
18
|
* If this argument isn't provided and this function results in a lookup failure, Puppet
|
19
19
|
fails with a compilation error.
|
20
20
|
3. The optional name of an arbitrary
|
21
|
-
[hierarchy level](https://
|
21
|
+
[hierarchy level](https://puppet.com/docs/hiera/latest/hierarchy.html) to insert at the
|
22
22
|
top of the hierarchy. This lets you temporarily modify the hierarchy for a single lookup.
|
23
23
|
* If Hiera doesn't find a matching key in the overriding hierarchy level, it continues
|
24
24
|
searching the rest of the hierarchy.
|
@@ -47,7 +47,7 @@ $allusers = hiera_array('users', undef)
|
|
47
47
|
~~~
|
48
48
|
|
49
49
|
You can optionally generate the default value with a
|
50
|
-
[lambda](https://
|
50
|
+
[lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) that
|
51
51
|
takes one parameter.
|
52
52
|
|
53
53
|
**Example**: Using `hiera_array` with a lambda
|
@@ -66,7 +66,7 @@ $allusers = hiera_array('users') | $key | { "Key \'${key}\' not found" }
|
|
66
66
|
value is a hash, Puppet raises a type mismatch error.
|
67
67
|
|
68
68
|
`hiera_array` is deprecated in favor of using `lookup` and will be removed in 6.0.0.
|
69
|
-
See
|
69
|
+
See https://puppet.com/docs/puppet/#{Puppet.minor_version}/deprecated_language.html.
|
70
70
|
Replace the calls as follows:
|
71
71
|
|
72
72
|
| from | to |
|
@@ -80,7 +80,7 @@ result must be post processed to get exactly the same result, for example using
|
|
80
80
|
with calls to stdlib's `deep_merge` function depending on kind of hiera call and setting of merge in hiera.yaml.
|
81
81
|
|
82
82
|
See
|
83
|
-
[the documentation](https://
|
83
|
+
[the documentation](https://puppet.com/docs/hiera/latest/puppet.html#hiera-lookup-functions)
|
84
84
|
for more information about Hiera lookup functions.
|
85
85
|
|
86
86
|
- Since 4.0.0
|
@@ -9,10 +9,10 @@ module Puppet::Parser::Functions
|
|
9
9
|
Finds all matches of a key throughout the hierarchy and returns them in a merged hash.
|
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 @@ The `hiera_hash` function takes up to three arguments, in this order:
|
|
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 @@ $allusers = hiera_hash('users', undef)
|
|
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,7 +76,7 @@ $allusers = hiera_hash('users') | $key | { "Key \'${key}\' not found" }
|
|
76
76
|
found in the data sources are strings or arrays, Puppet raises a type mismatch error.
|
77
77
|
|
78
78
|
`hiera_hash` is deprecated in favor of using `lookup` and will be removed in 6.0.0.
|
79
|
-
See https://
|
79
|
+
See https://puppet.com/docs/puppet/#{Puppet.minor_version}/deprecated_language.html.
|
80
80
|
Replace the calls as follows:
|
81
81
|
|
82
82
|
| from | to |
|
@@ -90,7 +90,7 @@ result must be post processed to get exactly the same result, for example using
|
|
90
90
|
with calls to stdlib's `deep_merge` function depending on kind of hiera call and setting of merge in hiera.yaml.
|
91
91
|
|
92
92
|
See
|
93
|
-
[the documentation](https://
|
93
|
+
[the documentation](https://puppet.com/docs/hiera/latest/puppet.html#hiera-lookup-functions)
|
94
94
|
for more information about Hiera lookup functions.
|
95
95
|
|
96
96
|
- Since 4.0.0
|
@@ -6,7 +6,7 @@ module Puppet::Parser::Functions
|
|
6
6
|
:arity => -2,
|
7
7
|
:doc => <<-DOC
|
8
8
|
Assigns classes to a node using an
|
9
|
-
[array merge lookup](https://
|
9
|
+
[array merge lookup](https://puppet.com/docs/hiera/latest/lookup_types.html#array-merge)
|
10
10
|
that retrieves the value for a user-specified key from Hiera's data.
|
11
11
|
|
12
12
|
The `hiera_include` function requires:
|
@@ -25,13 +25,13 @@ The function takes up to three arguments, in this order:
|
|
25
25
|
* If this argument isn't provided and this function results in a lookup failure, Puppet
|
26
26
|
fails with a compilation error.
|
27
27
|
3. The optional name of an arbitrary
|
28
|
-
[hierarchy level](https://
|
28
|
+
[hierarchy level](https://puppet.com/docs/hiera/latest/hierarchy.html) to insert at the
|
29
29
|
top of the hierarchy. This lets you temporarily modify the hierarchy for a single lookup.
|
30
30
|
* If Hiera doesn't find a matching key in the overriding hierarchy level, it continues
|
31
31
|
searching the rest of the hierarchy.
|
32
32
|
|
33
33
|
The function uses an
|
34
|
-
[array merge lookup](https://
|
34
|
+
[array merge lookup](https://puppet.com/docs/hiera/latest/lookup_types.html#array-merge)
|
35
35
|
to retrieve the `classes` array, so every node gets every class from the hierarchy.
|
36
36
|
|
37
37
|
**Example**: Using `hiera_include`
|
@@ -59,7 +59,7 @@ hiera_include('classes', undef)
|
|
59
59
|
~~~
|
60
60
|
|
61
61
|
You can optionally generate the default value with a
|
62
|
-
[lambda](https://
|
62
|
+
[lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) that
|
63
63
|
takes one parameter.
|
64
64
|
|
65
65
|
**Example**: Using `hiera_include` with a lambda
|
@@ -75,9 +75,8 @@ hiera_include('classes') | $key | {"Key \'${key}\' not found" }
|
|
75
75
|
# "Key 'classes' not found".
|
76
76
|
~~~
|
77
77
|
|
78
|
-
`hiera_include` is deprecated in favor of using a combination of `include`and `lookup` and will be
|
79
|
-
removed in 6.0.0.
|
80
|
-
Replace the calls as follows:
|
78
|
+
`hiera_include` is deprecated in favor of using a combination of `include` and `lookup` and will be
|
79
|
+
removed in Puppet 6.0.0. Replace the calls as follows:
|
81
80
|
|
82
81
|
| from | to |
|
83
82
|
| ---- | ---|
|
@@ -85,14 +84,14 @@ Replace the calls as follows:
|
|
85
84
|
| hiera_include($key, $default) | include(lookup($key, { 'default_value' => $default, 'merge' => 'unique' })) |
|
86
85
|
| hiera_include($key, $default, $level) | override level not supported |
|
87
86
|
|
87
|
+
See
|
88
|
+
[the Upgrading to Hiera 5 migration guide](https://puppet.com/docs/puppet/5.5/hiera_migrate.html)
|
89
|
+
for more information.
|
90
|
+
|
88
91
|
Note that calls using the 'override level' option are not directly supported by 'lookup' and the produced
|
89
92
|
result must be post processed to get exactly the same result, for example using simple hash/array `+` or
|
90
93
|
with calls to stdlib's `deep_merge` function depending on kind of hiera call and setting of merge in hiera.yaml.
|
91
94
|
|
92
|
-
See [the documentation](http://links.puppet.com/hierainclude) for more information
|
93
|
-
and a more detailed example of how `hiera_include` uses array merge lookups to classify
|
94
|
-
nodes.
|
95
|
-
|
96
95
|
- Since 4.0.0
|
97
96
|
DOC
|
98
97
|
) do |*args|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Puppet::Parser::Functions::newfunction(:inline_template, :type => :rvalue, :arity => -2, :doc =>
|
2
2
|
"Evaluate a template string and return its value. See
|
3
|
-
[the templating docs](https://
|
3
|
+
[the templating docs](https://puppet.com/docs/puppet/latest/lang_template.html) for
|
4
4
|
more information. Note that if multiple template strings are specified, their
|
5
5
|
output is all concatenated and returned as the output of the function.") do |vals|
|
6
6
|
|
@@ -3,7 +3,7 @@ Puppet::Parser::Functions::newfunction(
|
|
3
3
|
:type => :rvalue,
|
4
4
|
:arity => -2,
|
5
5
|
:doc => <<-DOC
|
6
|
-
Call a [lambda](https://
|
6
|
+
Call a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
7
7
|
(which should accept no arguments) if the argument given to the function is `undef`.
|
8
8
|
Returns the result of calling the lambda if the argument is `undef`, otherwise the
|
9
9
|
given argument.
|
@@ -31,7 +31,7 @@ The arguments accepted by `lookup` are as follows:
|
|
31
31
|
first key, it will try again with the subsequent ones, only resorting to a
|
32
32
|
default value if none of them succeed.
|
33
33
|
2. `<VALUE TYPE>` (data type) --- A
|
34
|
-
[data type](https://
|
34
|
+
[data type](https://puppet.com/docs/puppet/latest/lang_data_type.html)
|
35
35
|
that must match the retrieved value; if not, the lookup (and catalog
|
36
36
|
compilation) will fail. Defaults to `Data` (accepts any normal value).
|
37
37
|
3. `<MERGE BEHAVIOR>` (string or hash; see **"Merge Behaviors"** below) ---
|
@@ -3,7 +3,7 @@ Puppet::Parser::Functions::newfunction(
|
|
3
3
|
:type => :rvalue,
|
4
4
|
:arity => -3,
|
5
5
|
:doc => <<-DOC
|
6
|
-
Applies a [lambda](https://
|
6
|
+
Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
7
7
|
to every value in a data structure and returns an array containing the results.
|
8
8
|
|
9
9
|
This function takes two mandatory arguments, in this order:
|
@@ -3,7 +3,7 @@ Puppet::Parser::Functions::newfunction(
|
|
3
3
|
:type => :rvalue,
|
4
4
|
:arity => -3,
|
5
5
|
:doc => <<-DOC
|
6
|
-
Applies a [lambda](https://
|
6
|
+
Applies a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
7
7
|
to every value in a data structure from the first argument, carrying over the returned
|
8
8
|
value of each iteration, and returns the result of the lambda's final iteration. This
|
9
9
|
lets you create a new value or data structure by combining values from the first
|
@@ -4,7 +4,7 @@ Puppet::Parser::Functions::newfunction(
|
|
4
4
|
:arity => -1,
|
5
5
|
:doc => <<-DOC
|
6
6
|
Reverses the order of the elements of something that is iterable and optionally runs a
|
7
|
-
[lambda](https://
|
7
|
+
[lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) for each
|
8
8
|
element.
|
9
9
|
|
10
10
|
This function takes one to two arguments:
|
@@ -4,7 +4,7 @@ Puppet::Parser::Functions::newfunction(
|
|
4
4
|
:arity => -1,
|
5
5
|
:doc => <<-DOC
|
6
6
|
Provides stepping with given interval over elements in an iterable and optionally runs a
|
7
|
-
[lambda](https://
|
7
|
+
[lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html) for each
|
8
8
|
element.
|
9
9
|
|
10
10
|
This function takes two to three arguments:
|
@@ -3,7 +3,7 @@ Puppet::Parser::Functions::newfunction(
|
|
3
3
|
:type => :rvalue,
|
4
4
|
:arity => -2,
|
5
5
|
:doc => <<-DOC
|
6
|
-
Call a [lambda](https://
|
6
|
+
Call a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
7
7
|
with the given argument unless the argument is undef. Return `undef` if argument is
|
8
8
|
`undef`, and otherwise the result of giving the argument to the lambda.
|
9
9
|
|
@@ -3,11 +3,11 @@ Puppet::Parser::Functions::newfunction(
|
|
3
3
|
:type => :rvalue,
|
4
4
|
:arity => -1,
|
5
5
|
:doc => <<-DOC
|
6
|
-
Call a [lambda](https://
|
6
|
+
Call a [lambda](https://puppet.com/docs/puppet/latest/lang_lambdas.html)
|
7
7
|
with the given arguments and return the result. Since a lambda's scope is
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
local to the lambda, you can use the `with` function to create private blocks
|
9
|
+
of code within a class using variables whose values cannot be accessed outside
|
10
|
+
of the lambda.
|
11
11
|
|
12
12
|
**Example**: Using `with`
|
13
13
|
|
@@ -906,11 +906,15 @@ class PNumericType < PScalarDataType
|
|
906
906
|
0
|
907
907
|
else
|
908
908
|
begin
|
909
|
-
if from[0] == '0'
|
910
|
-
|
911
|
-
|
912
|
-
|
909
|
+
if from[0] == '0'
|
910
|
+
second_char = (from[1] || '').downcase
|
911
|
+
if second_char == 'b' || second_char == 'x'
|
912
|
+
# use built in conversion
|
913
|
+
return Integer(from)
|
914
|
+
end
|
913
915
|
end
|
916
|
+
|
917
|
+
Puppet::Pops::Utils.to_n(from)
|
914
918
|
rescue TypeError => e
|
915
919
|
raise TypeConversionError.new(e.message)
|
916
920
|
rescue ArgumentError => e
|