bolt 0.20.3 → 0.20.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +3 -3
- data/bolt-modules/boltlib/lib/puppet/functions/set_feature.rb +33 -0
- data/lib/bolt/inventory.rb +19 -1
- data/lib/bolt/target.rb +15 -0
- data/lib/bolt/transport/local.rb +6 -1
- data/lib/bolt/transport/orch.rb +2 -0
- data/lib/bolt/transport/ssh.rb +7 -2
- data/lib/bolt/transport/winrm.rb +6 -1
- data/lib/bolt/version.rb +1 -1
- data/modules/facts/plans/retrieve.pp +2 -26
- data/modules/facts/tasks/init.json +9 -0
- data/vendored/puppet/lib/hiera/puppet_function.rb +1 -1
- data/vendored/puppet/lib/hiera/scope.rb +24 -2
- data/vendored/puppet/lib/puppet.rb +4 -13
- data/vendored/puppet/lib/puppet/application.rb +2 -2
- data/vendored/puppet/lib/puppet/application/agent.rb +1 -1
- data/vendored/puppet/lib/puppet/application/apply.rb +1 -1
- data/vendored/puppet/lib/puppet/application/cert.rb +1 -1
- data/vendored/puppet/lib/puppet/application/device.rb +8 -8
- data/vendored/puppet/lib/puppet/application/face_base.rb +1 -1
- data/vendored/puppet/lib/puppet/application/lookup.rb +2 -2
- data/vendored/puppet/lib/puppet/application/resource.rb +2 -2
- data/vendored/puppet/lib/puppet/application/script.rb +1 -1
- data/vendored/puppet/lib/puppet/configurer.rb +47 -24
- data/vendored/puppet/lib/puppet/confine.rb +4 -1
- data/vendored/puppet/lib/puppet/context.rb +1 -1
- data/vendored/puppet/lib/puppet/defaults.rb +32 -44
- data/vendored/puppet/lib/puppet/error.rb +14 -7
- data/vendored/puppet/lib/puppet/external/dot.rb +23 -17
- data/vendored/puppet/lib/puppet/face/config.rb +58 -3
- data/vendored/puppet/lib/puppet/face/epp.rb +1 -1
- data/vendored/puppet/lib/puppet/face/module/build.rb +3 -3
- data/vendored/puppet/lib/puppet/face/module/install.rb +0 -4
- data/vendored/puppet/lib/puppet/face/module/list.rb +0 -5
- data/vendored/puppet/lib/puppet/face/module/search.rb +1 -1
- data/vendored/puppet/lib/puppet/face/module/uninstall.rb +0 -4
- data/vendored/puppet/lib/puppet/face/module/upgrade.rb +0 -4
- data/vendored/puppet/lib/puppet/face/status.rb +2 -2
- data/vendored/puppet/lib/puppet/file_serving/base.rb +5 -5
- data/vendored/puppet/lib/puppet/file_serving/metadata.rb +2 -1
- data/vendored/puppet/lib/puppet/forge.rb +7 -8
- data/vendored/puppet/lib/puppet/forge/errors.rb +3 -3
- data/vendored/puppet/lib/puppet/functions/abs.rb +61 -0
- data/vendored/puppet/lib/puppet/functions/all.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/any.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/assert_type.rb +3 -3
- data/vendored/puppet/lib/puppet/functions/break.rb +3 -7
- data/vendored/puppet/lib/puppet/functions/camelcase.rb +62 -0
- data/vendored/puppet/lib/puppet/functions/capitalize.rb +61 -0
- data/vendored/puppet/lib/puppet/functions/ceiling.rb +37 -0
- data/vendored/puppet/lib/puppet/functions/chomp.rb +57 -0
- data/vendored/puppet/lib/puppet/functions/chop.rb +67 -0
- data/vendored/puppet/lib/puppet/functions/compare.rb +125 -0
- data/vendored/puppet/lib/puppet/functions/convert_to.rb +3 -2
- data/vendored/puppet/lib/puppet/functions/dig.rb +21 -1
- data/vendored/puppet/lib/puppet/functions/downcase.rb +89 -0
- data/vendored/puppet/lib/puppet/functions/each.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/empty.rb +1 -3
- data/vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
- data/vendored/puppet/lib/puppet/functions/filter.rb +2 -2
- data/vendored/puppet/lib/puppet/functions/floor.rb +37 -0
- data/vendored/puppet/lib/puppet/functions/get.rb +150 -0
- data/vendored/puppet/lib/puppet/functions/getvar.rb +87 -0
- data/vendored/puppet/lib/puppet/functions/hiera.rb +5 -5
- data/vendored/puppet/lib/puppet/functions/hiera_array.rb +5 -5
- data/vendored/puppet/lib/puppet/functions/hiera_hash.rb +6 -6
- data/vendored/puppet/lib/puppet/functions/hiera_include.rb +7 -7
- data/vendored/puppet/lib/puppet/functions/hocon_data.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/json_data.rb +3 -3
- data/vendored/puppet/lib/puppet/functions/lest.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/lookup.rb +3 -2
- data/vendored/puppet/lib/puppet/functions/lstrip.rb +58 -0
- data/vendored/puppet/lib/puppet/functions/map.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/match.rb +11 -0
- data/vendored/puppet/lib/puppet/functions/max.rb +183 -0
- data/vendored/puppet/lib/puppet/functions/min.rb +182 -0
- data/vendored/puppet/lib/puppet/functions/next.rb +1 -8
- data/vendored/puppet/lib/puppet/functions/reduce.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/return.rb +1 -8
- data/vendored/puppet/lib/puppet/functions/reverse_each.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/round.rb +24 -0
- data/vendored/puppet/lib/puppet/functions/rstrip.rb +58 -0
- data/vendored/puppet/lib/puppet/functions/size.rb +15 -0
- data/vendored/puppet/lib/puppet/functions/sort.rb +74 -0
- data/vendored/puppet/lib/puppet/functions/step.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/strftime.rb +1 -7
- data/vendored/puppet/lib/puppet/functions/strip.rb +58 -0
- data/vendored/puppet/lib/puppet/functions/then.rb +1 -1
- data/vendored/puppet/lib/puppet/functions/tree_each.rb +7 -7
- data/vendored/puppet/lib/puppet/functions/upcase.rb +89 -0
- data/vendored/puppet/lib/puppet/functions/with.rb +4 -4
- data/vendored/puppet/lib/puppet/functions/yaml_data.rb +4 -2
- data/vendored/puppet/lib/puppet/graph/simple_graph.rb +9 -5
- data/vendored/puppet/lib/puppet/indirector/certificate_revocation_list/rest.rb +0 -11
- data/vendored/puppet/lib/puppet/indirector/indirection.rb +8 -12
- data/vendored/puppet/lib/puppet/indirector/node/exec.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/node/ldap.rb +1 -1
- data/vendored/puppet/lib/puppet/indirector/request.rb +11 -11
- data/vendored/puppet/lib/puppet/indirector/rest.rb +11 -11
- data/vendored/puppet/lib/puppet/interface/action.rb +2 -5
- data/vendored/puppet/lib/puppet/metatype/manager.rb +0 -2
- data/vendored/puppet/lib/puppet/module.rb +7 -33
- data/vendored/puppet/lib/puppet/module/task.rb +0 -1
- data/vendored/puppet/lib/puppet/module_tool.rb +2 -5
- data/vendored/puppet/lib/puppet/module_tool/applications/application.rb +5 -5
- data/vendored/puppet/lib/puppet/module_tool/applications/builder.rb +2 -2
- data/vendored/puppet/lib/puppet/module_tool/applications/checksummer.rb +3 -3
- data/vendored/puppet/lib/puppet/module_tool/applications/installer.rb +6 -7
- data/vendored/puppet/lib/puppet/module_tool/applications/uninstaller.rb +1 -2
- data/vendored/puppet/lib/puppet/module_tool/applications/unpacker.rb +2 -2
- data/vendored/puppet/lib/puppet/module_tool/applications/upgrader.rb +5 -6
- data/vendored/puppet/lib/puppet/module_tool/dependency.rb +1 -1
- data/vendored/puppet/lib/puppet/module_tool/installed_modules.rb +2 -2
- data/vendored/puppet/lib/puppet/module_tool/local_tarball.rb +3 -3
- data/vendored/puppet/lib/puppet/module_tool/metadata.rb +3 -4
- data/vendored/puppet/lib/puppet/module_tool/shared_behaviors.rb +2 -2
- data/vendored/puppet/lib/puppet/network/authconfig.rb +0 -13
- data/vendored/puppet/lib/puppet/network/format_support.rb +1 -1
- data/vendored/puppet/lib/puppet/network/formats.rb +5 -7
- data/vendored/puppet/lib/puppet/network/http.rb +0 -2
- data/vendored/puppet/lib/puppet/network/http/api.rb +1 -10
- data/vendored/puppet/lib/puppet/network/http/api/master/v3/environment.rb +2 -2
- data/vendored/puppet/lib/puppet/network/http/api/master/v3/environments.rb +2 -2
- data/vendored/puppet/lib/puppet/network/http/compression.rb +1 -1
- data/vendored/puppet/lib/puppet/network/http/connection.rb +11 -3
- data/vendored/puppet/lib/puppet/network/http/error.rb +3 -3
- data/vendored/puppet/lib/puppet/network/http/factory.rb +3 -0
- data/vendored/puppet/lib/puppet/network/http/handler.rb +59 -27
- data/vendored/puppet/lib/puppet/network/resolver.rb +140 -67
- data/vendored/puppet/lib/puppet/node/environment.rb +2 -19
- data/vendored/puppet/lib/puppet/parameter.rb +12 -7
- data/vendored/puppet/lib/puppet/parser/ast.rb +4 -8
- data/vendored/puppet/lib/puppet/parser/ast/branch.rb +3 -3
- data/vendored/puppet/lib/puppet/parser/ast/leaf.rb +5 -0
- data/vendored/puppet/lib/puppet/parser/ast/pops_bridge.rb +18 -0
- data/vendored/puppet/lib/puppet/parser/compiler.rb +3 -4
- data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +9 -2
- data/vendored/puppet/lib/puppet/parser/functions.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/assert_type.rb +3 -3
- data/vendored/puppet/lib/puppet/parser/functions/create_resources.rb +1 -7
- data/vendored/puppet/lib/puppet/parser/functions/each.rb +2 -2
- data/vendored/puppet/lib/puppet/parser/functions/filter.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/hiera.rb +4 -4
- data/vendored/puppet/lib/puppet/parser/functions/hiera_array.rb +5 -5
- data/vendored/puppet/lib/puppet/parser/functions/hiera_hash.rb +6 -6
- data/vendored/puppet/lib/puppet/parser/functions/hiera_include.rb +10 -11
- data/vendored/puppet/lib/puppet/parser/functions/inline_template.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/lest.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/lookup.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/map.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/reduce.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/return.rb +22 -1
- data/vendored/puppet/lib/puppet/parser/functions/reverse_each.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/step.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/then.rb +1 -1
- data/vendored/puppet/lib/puppet/parser/functions/with.rb +4 -4
- data/vendored/puppet/lib/puppet/parser/resource.rb +0 -1
- data/vendored/puppet/lib/puppet/parser/resource/param.rb +12 -5
- data/vendored/puppet/lib/puppet/parser/scope.rb +5 -7
- data/vendored/puppet/lib/puppet/pops/evaluator/compare_operator.rb +3 -1
- data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +2 -7
- data/vendored/puppet/lib/puppet/pops/issues.rb +4 -0
- data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +17 -12
- data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +73 -45
- data/vendored/puppet/lib/puppet/pops/lookup/lookup_adapter.rb +55 -6
- data/vendored/puppet/lib/puppet/pops/model/model_label_provider.rb +2 -0
- data/vendored/puppet/lib/puppet/pops/parser/epp_parser.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/parser/epp_support.rb +6 -2
- data/vendored/puppet/lib/puppet/pops/parser/lexer2.rb +1 -1
- data/vendored/puppet/lib/puppet/pops/pcore.rb +7 -7
- data/vendored/puppet/lib/puppet/pops/puppet_stack.rb +15 -1
- data/vendored/puppet/lib/puppet/pops/serialization.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/serialization/from_data_converter.rb +2 -2
- data/vendored/puppet/lib/puppet/pops/serialization/json.rb +7 -7
- data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +5 -5
- data/vendored/puppet/lib/puppet/pops/types/types.rb +8 -4
- data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +73 -0
- data/vendored/puppet/lib/puppet/pops/validation/validator_factory_4_0.rb +4 -3
- data/vendored/puppet/lib/puppet/provider/augeas/augeas.rb +7 -0
- data/vendored/puppet/lib/puppet/provider/service/systemd.rb +1 -1
- data/vendored/puppet/lib/puppet/provider/user/aix.rb +2 -2
- data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +21 -9
- data/vendored/puppet/lib/puppet/reference/providers.rb +1 -1
- data/vendored/puppet/lib/puppet/reference/report.rb +1 -1
- data/vendored/puppet/lib/puppet/resource.rb +1 -1
- data/vendored/puppet/lib/puppet/resource/capability_finder.rb +4 -4
- data/vendored/puppet/lib/puppet/resource/catalog.rb +6 -3
- data/vendored/puppet/lib/puppet/resource/type.rb +6 -2
- data/vendored/puppet/lib/puppet/rest/client.rb +79 -0
- data/vendored/puppet/lib/puppet/rest/errors.rb +14 -0
- data/vendored/puppet/lib/puppet/rest/response.rb +29 -0
- data/vendored/puppet/lib/puppet/rest/route.rb +102 -0
- data/vendored/puppet/lib/puppet/rest/routes.rb +31 -0
- data/vendored/puppet/lib/puppet/settings.rb +9 -5
- data/vendored/puppet/lib/puppet/settings/config_file.rb +1 -1
- data/vendored/puppet/lib/puppet/settings/environment_conf.rb +10 -1
- data/vendored/puppet/lib/puppet/ssl.rb +0 -1
- data/vendored/puppet/lib/puppet/ssl/certificate.rb +6 -2
- data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +3 -3
- data/vendored/puppet/lib/puppet/ssl/host.rb +258 -19
- data/vendored/puppet/lib/puppet/ssl/validator/default_validator.rb +33 -19
- data/vendored/puppet/lib/puppet/syntax_checkers/json.rb +1 -1
- data/vendored/puppet/lib/puppet/transaction/event.rb +34 -7
- data/vendored/puppet/lib/puppet/transaction/report.rb +17 -14
- data/vendored/puppet/lib/puppet/type.rb +20 -12
- data/vendored/puppet/lib/puppet/type/file.rb +1 -1
- data/vendored/puppet/lib/puppet/type/file/content.rb +15 -2
- data/vendored/puppet/lib/puppet/type/file/ensure.rb +1 -1
- data/vendored/puppet/lib/puppet/type/schedule.rb +1 -1
- data/vendored/puppet/lib/puppet/type/stage.rb +1 -1
- data/vendored/puppet/lib/puppet/type/tidy.rb +5 -1
- data/vendored/puppet/lib/puppet/type/user.rb +35 -18
- data/vendored/puppet/lib/puppet/type/yumrepo.rb +8 -17
- data/vendored/puppet/lib/puppet/util.rb +0 -1
- data/vendored/puppet/lib/puppet/util/autoload.rb +1 -6
- data/vendored/puppet/lib/puppet/util/checksums.rb +0 -2
- data/vendored/puppet/lib/puppet/util/classgen.rb +0 -6
- data/vendored/puppet/lib/puppet/util/fileparsing.rb +27 -5
- data/vendored/puppet/lib/puppet/util/instance_loader.rb +3 -3
- data/vendored/puppet/lib/puppet/util/json.rb +77 -0
- data/vendored/puppet/lib/puppet/util/json_lockfile.rb +3 -3
- data/vendored/puppet/lib/puppet/util/ldap/connection.rb +7 -7
- data/vendored/puppet/lib/puppet/util/log/destinations.rb +2 -2
- data/vendored/puppet/lib/puppet/util/logging.rb +1 -1
- data/vendored/puppet/lib/puppet/util/plist.rb +1 -1
- data/vendored/puppet/lib/puppet/util/provider_features.rb +2 -5
- data/vendored/puppet/lib/puppet/util/reference.rb +5 -4
- data/vendored/puppet/lib/puppet/util/tagging.rb +16 -3
- data/vendored/puppet/lib/puppet/version.rb +1 -1
- metadata +44 -26
- data/vendored/puppet/lib/puppet/application/master.rb +0 -317
- data/vendored/puppet/lib/puppet/feature/rack.rb +0 -19
- data/vendored/puppet/lib/puppet/network/http/api/ca.rb +0 -2
- data/vendored/puppet/lib/puppet/network/http/api/ca/v1.rb +0 -11
- data/vendored/puppet/lib/puppet/network/http/rack.rb +0 -33
- data/vendored/puppet/lib/puppet/network/http/rack/rest.rb +0 -162
- data/vendored/puppet/lib/puppet/network/http/webrick.rb +0 -124
- data/vendored/puppet/lib/puppet/network/http/webrick/rest.rb +0 -114
- data/vendored/puppet/lib/puppet/network/server.rb +0 -39
- data/vendored/puppet/lib/puppet/ssl/configuration.rb +0 -61
- data/vendored/puppet/lib/puppet/util/methodhelper.rb +0 -32
- data/vendored/puppet/lib/puppet/vendor/load_semantic.rb +0 -1
- data/vendored/puppet/lib/puppet/vendor/load_semantic_puppet.rb +0 -1
- data/vendored/puppet/lib/puppet/vendor/semantic/lib/semantic.rb +0 -5
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +0 -11
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency.rb +0 -181
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/graph.rb +0 -60
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/graph_node.rb +0 -117
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/module_release.rb +0 -58
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/source.rb +0 -25
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/unsatisfiable_graph.rb +0 -31
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/gem_version.rb +0 -3
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +0 -203
- data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb +0 -758
@@ -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
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# Converts a String, Array or Hash (recursively) into upper case.
|
2
|
+
#
|
3
|
+
# This function is compatible with the stdlib function with the same name.
|
4
|
+
#
|
5
|
+
# The function does the following:
|
6
|
+
# * For a `String`, its upper case version is returned. This is done using Ruby system locale which handles some, but not all
|
7
|
+
# special international up-casing rules (for example German double-s ß is upcased to "SS", whereas upper case double-s
|
8
|
+
# is downcased to ß).
|
9
|
+
# * For `Array` and `Hash` the conversion to upper case is recursive and each key and value must be convertible by
|
10
|
+
# this function.
|
11
|
+
# * When a `Hash` is converted, some keys could result in the same key - in those cases, the
|
12
|
+
# latest key-value wins. For example if keys "aBC", and "abC" where both present, after upcase there would only be one
|
13
|
+
# key "ABC".
|
14
|
+
# * If the value is `Numeric` it is simply returned (this is for backwards compatibility).
|
15
|
+
# * An error is raised for all other data types.
|
16
|
+
#
|
17
|
+
# Please note: This function relies directly on Ruby's String implementation and as such may not be entirely UTF8 compatible.
|
18
|
+
# To ensure best compatibility please use this function with Ruby 2.4.0 or greater - https://bugs.ruby-lang.org/issues/10085.
|
19
|
+
#
|
20
|
+
# @example Converting a String to upper case
|
21
|
+
# ```puppet
|
22
|
+
# 'hello'.upcase()
|
23
|
+
# upcase('hello')
|
24
|
+
# ```
|
25
|
+
# Would both result in "HELLO"
|
26
|
+
#
|
27
|
+
# @example Converting an Array to upper case
|
28
|
+
# ```puppet
|
29
|
+
# ['a', 'b'].upcase()
|
30
|
+
# upcase(['a', 'b'])
|
31
|
+
# ```
|
32
|
+
# Would both result in ['A', 'B']
|
33
|
+
#
|
34
|
+
# @example Converting a Hash to upper case
|
35
|
+
# ```puppet
|
36
|
+
# {'a' => 'hello', 'b' => 'goodbye'}.upcase()
|
37
|
+
# ```
|
38
|
+
# Would result in `{'A' => 'HELLO', 'B' => 'GOODBYE'}`
|
39
|
+
#
|
40
|
+
# @example Converting a recursive structure
|
41
|
+
# ```puppet
|
42
|
+
# ['a', 'b', ['c', ['d']], {'x' => 'y'}].upcase
|
43
|
+
# ```
|
44
|
+
# Would result in `['A', 'B', ['C', ['D']], {'X' => 'Y'}]`
|
45
|
+
#
|
46
|
+
Puppet::Functions.create_function(:upcase) do
|
47
|
+
local_types do
|
48
|
+
type 'StringData = Variant[String, Numeric, Array[StringData], Hash[StringData, StringData]]'
|
49
|
+
end
|
50
|
+
|
51
|
+
dispatch :on_numeric do
|
52
|
+
param 'Numeric', :arg
|
53
|
+
end
|
54
|
+
|
55
|
+
dispatch :on_string do
|
56
|
+
param 'String', :arg
|
57
|
+
end
|
58
|
+
|
59
|
+
dispatch :on_array do
|
60
|
+
param 'Array[StringData]', :arg
|
61
|
+
end
|
62
|
+
|
63
|
+
dispatch :on_hash do
|
64
|
+
param 'Hash[StringData, StringData]', :arg
|
65
|
+
end
|
66
|
+
|
67
|
+
# unit function - since the old implementation skipped Numeric values
|
68
|
+
def on_numeric(n)
|
69
|
+
n
|
70
|
+
end
|
71
|
+
|
72
|
+
def on_string(s)
|
73
|
+
s.upcase
|
74
|
+
end
|
75
|
+
|
76
|
+
def on_array(a)
|
77
|
+
a.map {|x| do_upcase(x) }
|
78
|
+
end
|
79
|
+
|
80
|
+
def on_hash(h)
|
81
|
+
result = {}
|
82
|
+
h.each_pair {|k,v| result[do_upcase(k)] = do_upcase(v) }
|
83
|
+
result
|
84
|
+
end
|
85
|
+
|
86
|
+
def do_upcase(x)
|
87
|
+
x.is_a?(String) ? x.upcase : call_function('upcase', x)
|
88
|
+
end
|
89
|
+
end
|
@@ -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"
|
@@ -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
|
@@ -25,7 +25,9 @@ Puppet::Functions.create_function(:yaml_data) do
|
|
25
25
|
if data.is_a?(Hash)
|
26
26
|
Puppet::Pops::Lookup::HieraConfig.symkeys_to_string(data)
|
27
27
|
else
|
28
|
-
|
28
|
+
msg = _("%{path}: file does not contain a valid yaml hash" % { path: path })
|
29
|
+
raise Puppet::DataBinding::LookupError, msg if Puppet[:strict] == :error && data != false
|
30
|
+
Puppet.warning(msg)
|
29
31
|
{}
|
30
32
|
end
|
31
33
|
rescue YAML::SyntaxError => ex
|
@@ -436,14 +436,14 @@ class Puppet::Graph::SimpleGraph
|
|
436
436
|
# undirected Graph. _params_ can contain any graph property specified in
|
437
437
|
# rdot.rb. If an edge or vertex label is a kind of Hash then the keys
|
438
438
|
# which match +dot+ properties will be used as well.
|
439
|
-
def to_dot_graph
|
439
|
+
def to_dot_graph(params = {})
|
440
440
|
params['name'] ||= self.class.name.gsub(/:/,'_')
|
441
441
|
fontsize = params['fontsize'] ? params['fontsize'] : '8'
|
442
442
|
graph = (directed? ? DOT::DOTDigraph : DOT::DOTSubgraph).new(params)
|
443
443
|
edge_klass = directed? ? DOT::DOTDirectedEdge : DOT::DOTEdge
|
444
444
|
vertices.each do |v|
|
445
445
|
name = v.ref
|
446
|
-
params = {'name' =>
|
446
|
+
params = {'name' => stringify(name),
|
447
447
|
'fontsize' => fontsize,
|
448
448
|
'label' => name}
|
449
449
|
v_label = v.ref
|
@@ -451,8 +451,8 @@ class Puppet::Graph::SimpleGraph
|
|
451
451
|
graph << DOT::DOTNode.new(params)
|
452
452
|
end
|
453
453
|
edges.each do |e|
|
454
|
-
params = {'from' =>
|
455
|
-
'to' =>
|
454
|
+
params = {'from' => stringify(e.source.ref),
|
455
|
+
'to' => stringify(e.target.ref),
|
456
456
|
'fontsize' => fontsize }
|
457
457
|
e_label = e.ref
|
458
458
|
params.merge!(e_label) if e_label and e_label.kind_of? Hash
|
@@ -461,8 +461,12 @@ class Puppet::Graph::SimpleGraph
|
|
461
461
|
graph
|
462
462
|
end
|
463
463
|
|
464
|
+
def stringify(s)
|
465
|
+
%("#{s.gsub('"', '\\"')}")
|
466
|
+
end
|
467
|
+
|
464
468
|
# Output the dot format as a string
|
465
|
-
def to_dot
|
469
|
+
def to_dot(params={}) to_dot_graph(params).to_s; end
|
466
470
|
|
467
471
|
# Produce the graph files if requested.
|
468
472
|
def write_graph(name)
|
@@ -8,15 +8,4 @@ class Puppet::SSL::CertificateRevocationList::Rest < Puppet::Indirector::REST
|
|
8
8
|
use_port_setting(:ca_port)
|
9
9
|
use_srv_service(:ca)
|
10
10
|
|
11
|
-
def find(request)
|
12
|
-
if !Puppet::FileSystem.exist?(Puppet[:hostcrl])
|
13
|
-
msg = "Disable certificate revocation checking when fetching the CRL and no CRL is present"
|
14
|
-
overrides = {certificate_revocation: false}
|
15
|
-
Puppet.override(overrides, msg) do
|
16
|
-
super
|
17
|
-
end
|
18
|
-
else
|
19
|
-
super
|
20
|
-
end
|
21
|
-
end
|
22
11
|
end
|
@@ -1,6 +1,5 @@
|
|
1
1
|
require 'puppet/util/docs'
|
2
2
|
require 'puppet/util/profiler'
|
3
|
-
require 'puppet/util/methodhelper'
|
4
3
|
require 'puppet/indirector/envelope'
|
5
4
|
require 'puppet/indirector/request'
|
6
5
|
|
@@ -8,7 +7,6 @@ require 'puppet/indirector/request'
|
|
8
7
|
# back-ends. Each indirection has a set of associated terminus classes,
|
9
8
|
# each of which is a subclass of Puppet::Indirector::Terminus.
|
10
9
|
class Puppet::Indirector::Indirection
|
11
|
-
include Puppet::Util::MethodHelper
|
12
10
|
include Puppet::Util::Docs
|
13
11
|
|
14
12
|
attr_accessor :name, :model
|
@@ -89,25 +87,23 @@ class Puppet::Indirector::Indirection
|
|
89
87
|
text
|
90
88
|
end
|
91
89
|
|
92
|
-
def initialize(model, name,
|
90
|
+
def initialize(model, name, doc: nil, indirected_class: nil, cache_class: nil, terminus_class: nil, terminus_setting: nil, extend: nil)
|
93
91
|
@model = model
|
94
92
|
@name = name
|
95
93
|
@termini = {}
|
96
94
|
|
97
|
-
@
|
98
|
-
@terminus_class = nil
|
95
|
+
@doc = doc
|
99
96
|
|
100
97
|
raise(ArgumentError, _("Indirection %{name} is already defined") % { name: @name }) if @@indirections.find { |i| i.name == @name }
|
101
98
|
@@indirections << self
|
102
99
|
|
103
|
-
@indirected_class =
|
104
|
-
if
|
105
|
-
extend(mod)
|
106
|
-
options.delete(:extend)
|
107
|
-
end
|
100
|
+
@indirected_class = indirected_class
|
101
|
+
self.extend(extend) if extend
|
108
102
|
|
109
|
-
#
|
110
|
-
|
103
|
+
# These setters depend on the indirection already being installed so they have to be at the end
|
104
|
+
self.cache_class = cache_class if cache_class
|
105
|
+
self.terminus_class = terminus_class if terminus_class
|
106
|
+
self.terminus_setting = terminus_setting if terminus_setting
|
111
107
|
end
|
112
108
|
|
113
109
|
# Set up our request object.
|
@@ -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"
|
@@ -185,7 +185,11 @@ class Puppet::Indirector::Request
|
|
185
185
|
return yield(self) if !self.server.nil?
|
186
186
|
|
187
187
|
if Puppet.settings[:use_srv_records]
|
188
|
-
|
188
|
+
# We may want to consider not creating a new resolver here
|
189
|
+
# every request eventually, to take advantage of the resolver's
|
190
|
+
# caching behavior.
|
191
|
+
resolver = Puppet::Network::Resolver.new
|
192
|
+
resolver.each_srv_record(Puppet.settings[:srv_domain], srv_service) do |srv_server, srv_port|
|
189
193
|
begin
|
190
194
|
self.server = srv_server
|
191
195
|
self.port = srv_port
|
@@ -197,23 +201,19 @@ class Puppet::Indirector::Request
|
|
197
201
|
end
|
198
202
|
|
199
203
|
# ... Fall back onto the default server.
|
200
|
-
|
201
|
-
bound_server = Puppet.lookup(:server)
|
202
|
-
rescue
|
204
|
+
bound_server = Puppet.lookup(:server) do
|
203
205
|
if primary_server = Puppet.settings[:server_list][0]
|
204
|
-
|
206
|
+
primary_server[0]
|
205
207
|
else
|
206
|
-
|
208
|
+
Puppet.settings[:server]
|
207
209
|
end
|
208
210
|
end
|
209
211
|
|
210
|
-
|
211
|
-
bound_port = Puppet.lookup(:serverport)
|
212
|
-
rescue
|
212
|
+
bound_port = Puppet.lookup(:serverport) do
|
213
213
|
if primary_server = Puppet.settings[:server_list][0]
|
214
|
-
|
214
|
+
primary_server[1]
|
215
215
|
else
|
216
|
-
|
216
|
+
Puppet.settings[:masterport]
|
217
217
|
end
|
218
218
|
end
|
219
219
|
self.server = default_server || bound_server
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'uri'
|
3
|
-
require 'json'
|
3
|
+
require 'puppet/util/json'
|
4
4
|
require 'semantic_puppet'
|
5
5
|
|
6
6
|
require 'puppet/network/http'
|
@@ -57,9 +57,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
|
|
57
57
|
if setting && setting != :server && Puppet.settings.set_by_config?(setting)
|
58
58
|
Puppet.settings[setting]
|
59
59
|
else
|
60
|
-
|
61
|
-
Puppet.lookup(:server)
|
62
|
-
rescue
|
60
|
+
server = Puppet.lookup(:server) do
|
63
61
|
if primary_server = Puppet.settings[:server_list][0]
|
64
62
|
Puppet.debug "Dynamically-bound server lookup failed; using first entry"
|
65
63
|
primary_server[0]
|
@@ -69,6 +67,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
|
|
69
67
|
Puppet.settings[setting]
|
70
68
|
end
|
71
69
|
end
|
70
|
+
server
|
72
71
|
end
|
73
72
|
end
|
74
73
|
|
@@ -84,22 +83,21 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
|
|
84
83
|
(srv_setting && srv_setting != :server && Puppet.settings.set_by_config?(srv_setting))
|
85
84
|
Puppet.settings[setting].to_i
|
86
85
|
else
|
87
|
-
|
88
|
-
Puppet.lookup(:serverport).to_i
|
89
|
-
rescue
|
86
|
+
port = Puppet.lookup(:serverport) do
|
90
87
|
if primary_server = Puppet.settings[:server_list][0]
|
91
88
|
Puppet.debug "Dynamically-bound port lookup failed; using first entry"
|
92
89
|
|
93
90
|
# Port might not be set, so we want to fallback in that
|
94
91
|
# case. We know we don't need to use `setting` here, since
|
95
92
|
# the default value of every port setting is `masterport`
|
96
|
-
(primary_server[1] || Puppet.settings[:masterport])
|
93
|
+
(primary_server[1] || Puppet.settings[:masterport])
|
97
94
|
else
|
98
95
|
setting ||= :masterport
|
99
96
|
Puppet.debug "Dynamically-bound port lookup failed; falling back to #{setting} setting"
|
100
|
-
Puppet.settings[setting]
|
97
|
+
Puppet.settings[setting]
|
101
98
|
end
|
102
99
|
end
|
100
|
+
port.to_i
|
103
101
|
end
|
104
102
|
end
|
105
103
|
|
@@ -263,7 +261,9 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
|
|
263
261
|
def handle_response(request, response)
|
264
262
|
server_version = response[Puppet::Network::HTTP::HEADER_PUPPET_VERSION]
|
265
263
|
if server_version
|
266
|
-
Puppet.
|
264
|
+
Puppet.lookup(:server_agent_version) do
|
265
|
+
Puppet.push_context(:server_agent_version => server_version)
|
266
|
+
end
|
267
267
|
if SemanticPuppet::Version.parse(server_version).major < MAJOR_VERSION_JSON_DEFAULT &&
|
268
268
|
Puppet[:preferred_serialization_format] != 'pson'
|
269
269
|
#TRANSLATORS "PSON" should not be translated
|
@@ -301,7 +301,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
|
|
301
301
|
elsif response['content-type'].is_a?(String)
|
302
302
|
content_type, body = parse_response(response)
|
303
303
|
if content_type =~ /[pj]son/
|
304
|
-
returned_message =
|
304
|
+
returned_message = Puppet::Util::Json.load(body)["message"]
|
305
305
|
else
|
306
306
|
returned_message = uncompress_body(response)
|
307
307
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
# coding: utf-8
|
2
2
|
require 'prettyprint'
|
3
3
|
|
4
4
|
# This represents an action that is attached to a face. Actions should
|
@@ -7,12 +7,11 @@ require 'prettyprint'
|
|
7
7
|
# {Puppet::Interface::ActionBuilder} in the supplied block.
|
8
8
|
# @api private
|
9
9
|
class Puppet::Interface::Action
|
10
|
-
include Puppet::Util::MethodHelper
|
11
10
|
extend Puppet::Interface::DocGen
|
12
11
|
include Puppet::Interface::FullDocs
|
13
12
|
|
14
13
|
# @api private
|
15
|
-
def initialize(face, name
|
14
|
+
def initialize(face, name)
|
16
15
|
raise "#{name.inspect} is an invalid action name" unless name.to_s =~ /^[a-z]\w*$/
|
17
16
|
@face = face
|
18
17
|
@name = name.to_sym
|
@@ -23,8 +22,6 @@ class Puppet::Interface::Action
|
|
23
22
|
@authors = []
|
24
23
|
@license = 'All Rights Reserved'
|
25
24
|
|
26
|
-
set_options(attrs)
|
27
|
-
|
28
25
|
# @options collects the added options in the order they're declared.
|
29
26
|
# @options_hash collects the options keyed by alias for quick lookups.
|
30
27
|
@options = []
|