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.

Files changed (256) hide show
  1. checksums.yaml +4 -4
  2. data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +3 -3
  3. data/bolt-modules/boltlib/lib/puppet/functions/set_feature.rb +33 -0
  4. data/lib/bolt/inventory.rb +19 -1
  5. data/lib/bolt/target.rb +15 -0
  6. data/lib/bolt/transport/local.rb +6 -1
  7. data/lib/bolt/transport/orch.rb +2 -0
  8. data/lib/bolt/transport/ssh.rb +7 -2
  9. data/lib/bolt/transport/winrm.rb +6 -1
  10. data/lib/bolt/version.rb +1 -1
  11. data/modules/facts/plans/retrieve.pp +2 -26
  12. data/modules/facts/tasks/init.json +9 -0
  13. data/vendored/puppet/lib/hiera/puppet_function.rb +1 -1
  14. data/vendored/puppet/lib/hiera/scope.rb +24 -2
  15. data/vendored/puppet/lib/puppet.rb +4 -13
  16. data/vendored/puppet/lib/puppet/application.rb +2 -2
  17. data/vendored/puppet/lib/puppet/application/agent.rb +1 -1
  18. data/vendored/puppet/lib/puppet/application/apply.rb +1 -1
  19. data/vendored/puppet/lib/puppet/application/cert.rb +1 -1
  20. data/vendored/puppet/lib/puppet/application/device.rb +8 -8
  21. data/vendored/puppet/lib/puppet/application/face_base.rb +1 -1
  22. data/vendored/puppet/lib/puppet/application/lookup.rb +2 -2
  23. data/vendored/puppet/lib/puppet/application/resource.rb +2 -2
  24. data/vendored/puppet/lib/puppet/application/script.rb +1 -1
  25. data/vendored/puppet/lib/puppet/configurer.rb +47 -24
  26. data/vendored/puppet/lib/puppet/confine.rb +4 -1
  27. data/vendored/puppet/lib/puppet/context.rb +1 -1
  28. data/vendored/puppet/lib/puppet/defaults.rb +32 -44
  29. data/vendored/puppet/lib/puppet/error.rb +14 -7
  30. data/vendored/puppet/lib/puppet/external/dot.rb +23 -17
  31. data/vendored/puppet/lib/puppet/face/config.rb +58 -3
  32. data/vendored/puppet/lib/puppet/face/epp.rb +1 -1
  33. data/vendored/puppet/lib/puppet/face/module/build.rb +3 -3
  34. data/vendored/puppet/lib/puppet/face/module/install.rb +0 -4
  35. data/vendored/puppet/lib/puppet/face/module/list.rb +0 -5
  36. data/vendored/puppet/lib/puppet/face/module/search.rb +1 -1
  37. data/vendored/puppet/lib/puppet/face/module/uninstall.rb +0 -4
  38. data/vendored/puppet/lib/puppet/face/module/upgrade.rb +0 -4
  39. data/vendored/puppet/lib/puppet/face/status.rb +2 -2
  40. data/vendored/puppet/lib/puppet/file_serving/base.rb +5 -5
  41. data/vendored/puppet/lib/puppet/file_serving/metadata.rb +2 -1
  42. data/vendored/puppet/lib/puppet/forge.rb +7 -8
  43. data/vendored/puppet/lib/puppet/forge/errors.rb +3 -3
  44. data/vendored/puppet/lib/puppet/functions/abs.rb +61 -0
  45. data/vendored/puppet/lib/puppet/functions/all.rb +2 -2
  46. data/vendored/puppet/lib/puppet/functions/any.rb +2 -2
  47. data/vendored/puppet/lib/puppet/functions/assert_type.rb +3 -3
  48. data/vendored/puppet/lib/puppet/functions/break.rb +3 -7
  49. data/vendored/puppet/lib/puppet/functions/camelcase.rb +62 -0
  50. data/vendored/puppet/lib/puppet/functions/capitalize.rb +61 -0
  51. data/vendored/puppet/lib/puppet/functions/ceiling.rb +37 -0
  52. data/vendored/puppet/lib/puppet/functions/chomp.rb +57 -0
  53. data/vendored/puppet/lib/puppet/functions/chop.rb +67 -0
  54. data/vendored/puppet/lib/puppet/functions/compare.rb +125 -0
  55. data/vendored/puppet/lib/puppet/functions/convert_to.rb +3 -2
  56. data/vendored/puppet/lib/puppet/functions/dig.rb +21 -1
  57. data/vendored/puppet/lib/puppet/functions/downcase.rb +89 -0
  58. data/vendored/puppet/lib/puppet/functions/each.rb +2 -2
  59. data/vendored/puppet/lib/puppet/functions/empty.rb +1 -3
  60. data/vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb +4 -2
  61. data/vendored/puppet/lib/puppet/functions/filter.rb +2 -2
  62. data/vendored/puppet/lib/puppet/functions/floor.rb +37 -0
  63. data/vendored/puppet/lib/puppet/functions/get.rb +150 -0
  64. data/vendored/puppet/lib/puppet/functions/getvar.rb +87 -0
  65. data/vendored/puppet/lib/puppet/functions/hiera.rb +5 -5
  66. data/vendored/puppet/lib/puppet/functions/hiera_array.rb +5 -5
  67. data/vendored/puppet/lib/puppet/functions/hiera_hash.rb +6 -6
  68. data/vendored/puppet/lib/puppet/functions/hiera_include.rb +7 -7
  69. data/vendored/puppet/lib/puppet/functions/hocon_data.rb +1 -1
  70. data/vendored/puppet/lib/puppet/functions/json_data.rb +3 -3
  71. data/vendored/puppet/lib/puppet/functions/lest.rb +1 -1
  72. data/vendored/puppet/lib/puppet/functions/lookup.rb +3 -2
  73. data/vendored/puppet/lib/puppet/functions/lstrip.rb +58 -0
  74. data/vendored/puppet/lib/puppet/functions/map.rb +1 -1
  75. data/vendored/puppet/lib/puppet/functions/match.rb +11 -0
  76. data/vendored/puppet/lib/puppet/functions/max.rb +183 -0
  77. data/vendored/puppet/lib/puppet/functions/min.rb +182 -0
  78. data/vendored/puppet/lib/puppet/functions/next.rb +1 -8
  79. data/vendored/puppet/lib/puppet/functions/reduce.rb +1 -1
  80. data/vendored/puppet/lib/puppet/functions/return.rb +1 -8
  81. data/vendored/puppet/lib/puppet/functions/reverse_each.rb +1 -1
  82. data/vendored/puppet/lib/puppet/functions/round.rb +24 -0
  83. data/vendored/puppet/lib/puppet/functions/rstrip.rb +58 -0
  84. data/vendored/puppet/lib/puppet/functions/size.rb +15 -0
  85. data/vendored/puppet/lib/puppet/functions/sort.rb +74 -0
  86. data/vendored/puppet/lib/puppet/functions/step.rb +1 -1
  87. data/vendored/puppet/lib/puppet/functions/strftime.rb +1 -7
  88. data/vendored/puppet/lib/puppet/functions/strip.rb +58 -0
  89. data/vendored/puppet/lib/puppet/functions/then.rb +1 -1
  90. data/vendored/puppet/lib/puppet/functions/tree_each.rb +7 -7
  91. data/vendored/puppet/lib/puppet/functions/upcase.rb +89 -0
  92. data/vendored/puppet/lib/puppet/functions/with.rb +4 -4
  93. data/vendored/puppet/lib/puppet/functions/yaml_data.rb +4 -2
  94. data/vendored/puppet/lib/puppet/graph/simple_graph.rb +9 -5
  95. data/vendored/puppet/lib/puppet/indirector/certificate_revocation_list/rest.rb +0 -11
  96. data/vendored/puppet/lib/puppet/indirector/indirection.rb +8 -12
  97. data/vendored/puppet/lib/puppet/indirector/node/exec.rb +1 -1
  98. data/vendored/puppet/lib/puppet/indirector/node/ldap.rb +1 -1
  99. data/vendored/puppet/lib/puppet/indirector/request.rb +11 -11
  100. data/vendored/puppet/lib/puppet/indirector/rest.rb +11 -11
  101. data/vendored/puppet/lib/puppet/interface/action.rb +2 -5
  102. data/vendored/puppet/lib/puppet/metatype/manager.rb +0 -2
  103. data/vendored/puppet/lib/puppet/module.rb +7 -33
  104. data/vendored/puppet/lib/puppet/module/task.rb +0 -1
  105. data/vendored/puppet/lib/puppet/module_tool.rb +2 -5
  106. data/vendored/puppet/lib/puppet/module_tool/applications/application.rb +5 -5
  107. data/vendored/puppet/lib/puppet/module_tool/applications/builder.rb +2 -2
  108. data/vendored/puppet/lib/puppet/module_tool/applications/checksummer.rb +3 -3
  109. data/vendored/puppet/lib/puppet/module_tool/applications/installer.rb +6 -7
  110. data/vendored/puppet/lib/puppet/module_tool/applications/uninstaller.rb +1 -2
  111. data/vendored/puppet/lib/puppet/module_tool/applications/unpacker.rb +2 -2
  112. data/vendored/puppet/lib/puppet/module_tool/applications/upgrader.rb +5 -6
  113. data/vendored/puppet/lib/puppet/module_tool/dependency.rb +1 -1
  114. data/vendored/puppet/lib/puppet/module_tool/installed_modules.rb +2 -2
  115. data/vendored/puppet/lib/puppet/module_tool/local_tarball.rb +3 -3
  116. data/vendored/puppet/lib/puppet/module_tool/metadata.rb +3 -4
  117. data/vendored/puppet/lib/puppet/module_tool/shared_behaviors.rb +2 -2
  118. data/vendored/puppet/lib/puppet/network/authconfig.rb +0 -13
  119. data/vendored/puppet/lib/puppet/network/format_support.rb +1 -1
  120. data/vendored/puppet/lib/puppet/network/formats.rb +5 -7
  121. data/vendored/puppet/lib/puppet/network/http.rb +0 -2
  122. data/vendored/puppet/lib/puppet/network/http/api.rb +1 -10
  123. data/vendored/puppet/lib/puppet/network/http/api/master/v3/environment.rb +2 -2
  124. data/vendored/puppet/lib/puppet/network/http/api/master/v3/environments.rb +2 -2
  125. data/vendored/puppet/lib/puppet/network/http/compression.rb +1 -1
  126. data/vendored/puppet/lib/puppet/network/http/connection.rb +11 -3
  127. data/vendored/puppet/lib/puppet/network/http/error.rb +3 -3
  128. data/vendored/puppet/lib/puppet/network/http/factory.rb +3 -0
  129. data/vendored/puppet/lib/puppet/network/http/handler.rb +59 -27
  130. data/vendored/puppet/lib/puppet/network/resolver.rb +140 -67
  131. data/vendored/puppet/lib/puppet/node/environment.rb +2 -19
  132. data/vendored/puppet/lib/puppet/parameter.rb +12 -7
  133. data/vendored/puppet/lib/puppet/parser/ast.rb +4 -8
  134. data/vendored/puppet/lib/puppet/parser/ast/branch.rb +3 -3
  135. data/vendored/puppet/lib/puppet/parser/ast/leaf.rb +5 -0
  136. data/vendored/puppet/lib/puppet/parser/ast/pops_bridge.rb +18 -0
  137. data/vendored/puppet/lib/puppet/parser/compiler.rb +3 -4
  138. data/vendored/puppet/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +9 -2
  139. data/vendored/puppet/lib/puppet/parser/functions.rb +1 -1
  140. data/vendored/puppet/lib/puppet/parser/functions/assert_type.rb +3 -3
  141. data/vendored/puppet/lib/puppet/parser/functions/create_resources.rb +1 -7
  142. data/vendored/puppet/lib/puppet/parser/functions/each.rb +2 -2
  143. data/vendored/puppet/lib/puppet/parser/functions/filter.rb +1 -1
  144. data/vendored/puppet/lib/puppet/parser/functions/hiera.rb +4 -4
  145. data/vendored/puppet/lib/puppet/parser/functions/hiera_array.rb +5 -5
  146. data/vendored/puppet/lib/puppet/parser/functions/hiera_hash.rb +6 -6
  147. data/vendored/puppet/lib/puppet/parser/functions/hiera_include.rb +10 -11
  148. data/vendored/puppet/lib/puppet/parser/functions/inline_template.rb +1 -1
  149. data/vendored/puppet/lib/puppet/parser/functions/lest.rb +1 -1
  150. data/vendored/puppet/lib/puppet/parser/functions/lookup.rb +1 -1
  151. data/vendored/puppet/lib/puppet/parser/functions/map.rb +1 -1
  152. data/vendored/puppet/lib/puppet/parser/functions/reduce.rb +1 -1
  153. data/vendored/puppet/lib/puppet/parser/functions/return.rb +22 -1
  154. data/vendored/puppet/lib/puppet/parser/functions/reverse_each.rb +1 -1
  155. data/vendored/puppet/lib/puppet/parser/functions/step.rb +1 -1
  156. data/vendored/puppet/lib/puppet/parser/functions/then.rb +1 -1
  157. data/vendored/puppet/lib/puppet/parser/functions/with.rb +4 -4
  158. data/vendored/puppet/lib/puppet/parser/resource.rb +0 -1
  159. data/vendored/puppet/lib/puppet/parser/resource/param.rb +12 -5
  160. data/vendored/puppet/lib/puppet/parser/scope.rb +5 -7
  161. data/vendored/puppet/lib/puppet/pops/evaluator/compare_operator.rb +3 -1
  162. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +2 -7
  163. data/vendored/puppet/lib/puppet/pops/issues.rb +4 -0
  164. data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +2 -2
  165. data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +17 -12
  166. data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +73 -45
  167. data/vendored/puppet/lib/puppet/pops/lookup/lookup_adapter.rb +55 -6
  168. data/vendored/puppet/lib/puppet/pops/model/model_label_provider.rb +2 -0
  169. data/vendored/puppet/lib/puppet/pops/parser/epp_parser.rb +1 -1
  170. data/vendored/puppet/lib/puppet/pops/parser/epp_support.rb +6 -2
  171. data/vendored/puppet/lib/puppet/pops/parser/lexer2.rb +1 -1
  172. data/vendored/puppet/lib/puppet/pops/pcore.rb +7 -7
  173. data/vendored/puppet/lib/puppet/pops/puppet_stack.rb +15 -1
  174. data/vendored/puppet/lib/puppet/pops/serialization.rb +2 -2
  175. data/vendored/puppet/lib/puppet/pops/serialization/from_data_converter.rb +2 -2
  176. data/vendored/puppet/lib/puppet/pops/serialization/json.rb +7 -7
  177. data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +5 -5
  178. data/vendored/puppet/lib/puppet/pops/types/types.rb +8 -4
  179. data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +73 -0
  180. data/vendored/puppet/lib/puppet/pops/validation/validator_factory_4_0.rb +4 -3
  181. data/vendored/puppet/lib/puppet/provider/augeas/augeas.rb +7 -0
  182. data/vendored/puppet/lib/puppet/provider/service/systemd.rb +1 -1
  183. data/vendored/puppet/lib/puppet/provider/user/aix.rb +2 -2
  184. data/vendored/puppet/lib/puppet/provider/yumrepo/inifile.rb +21 -9
  185. data/vendored/puppet/lib/puppet/reference/providers.rb +1 -1
  186. data/vendored/puppet/lib/puppet/reference/report.rb +1 -1
  187. data/vendored/puppet/lib/puppet/resource.rb +1 -1
  188. data/vendored/puppet/lib/puppet/resource/capability_finder.rb +4 -4
  189. data/vendored/puppet/lib/puppet/resource/catalog.rb +6 -3
  190. data/vendored/puppet/lib/puppet/resource/type.rb +6 -2
  191. data/vendored/puppet/lib/puppet/rest/client.rb +79 -0
  192. data/vendored/puppet/lib/puppet/rest/errors.rb +14 -0
  193. data/vendored/puppet/lib/puppet/rest/response.rb +29 -0
  194. data/vendored/puppet/lib/puppet/rest/route.rb +102 -0
  195. data/vendored/puppet/lib/puppet/rest/routes.rb +31 -0
  196. data/vendored/puppet/lib/puppet/settings.rb +9 -5
  197. data/vendored/puppet/lib/puppet/settings/config_file.rb +1 -1
  198. data/vendored/puppet/lib/puppet/settings/environment_conf.rb +10 -1
  199. data/vendored/puppet/lib/puppet/ssl.rb +0 -1
  200. data/vendored/puppet/lib/puppet/ssl/certificate.rb +6 -2
  201. data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +3 -3
  202. data/vendored/puppet/lib/puppet/ssl/host.rb +258 -19
  203. data/vendored/puppet/lib/puppet/ssl/validator/default_validator.rb +33 -19
  204. data/vendored/puppet/lib/puppet/syntax_checkers/json.rb +1 -1
  205. data/vendored/puppet/lib/puppet/transaction/event.rb +34 -7
  206. data/vendored/puppet/lib/puppet/transaction/report.rb +17 -14
  207. data/vendored/puppet/lib/puppet/type.rb +20 -12
  208. data/vendored/puppet/lib/puppet/type/file.rb +1 -1
  209. data/vendored/puppet/lib/puppet/type/file/content.rb +15 -2
  210. data/vendored/puppet/lib/puppet/type/file/ensure.rb +1 -1
  211. data/vendored/puppet/lib/puppet/type/schedule.rb +1 -1
  212. data/vendored/puppet/lib/puppet/type/stage.rb +1 -1
  213. data/vendored/puppet/lib/puppet/type/tidy.rb +5 -1
  214. data/vendored/puppet/lib/puppet/type/user.rb +35 -18
  215. data/vendored/puppet/lib/puppet/type/yumrepo.rb +8 -17
  216. data/vendored/puppet/lib/puppet/util.rb +0 -1
  217. data/vendored/puppet/lib/puppet/util/autoload.rb +1 -6
  218. data/vendored/puppet/lib/puppet/util/checksums.rb +0 -2
  219. data/vendored/puppet/lib/puppet/util/classgen.rb +0 -6
  220. data/vendored/puppet/lib/puppet/util/fileparsing.rb +27 -5
  221. data/vendored/puppet/lib/puppet/util/instance_loader.rb +3 -3
  222. data/vendored/puppet/lib/puppet/util/json.rb +77 -0
  223. data/vendored/puppet/lib/puppet/util/json_lockfile.rb +3 -3
  224. data/vendored/puppet/lib/puppet/util/ldap/connection.rb +7 -7
  225. data/vendored/puppet/lib/puppet/util/log/destinations.rb +2 -2
  226. data/vendored/puppet/lib/puppet/util/logging.rb +1 -1
  227. data/vendored/puppet/lib/puppet/util/plist.rb +1 -1
  228. data/vendored/puppet/lib/puppet/util/provider_features.rb +2 -5
  229. data/vendored/puppet/lib/puppet/util/reference.rb +5 -4
  230. data/vendored/puppet/lib/puppet/util/tagging.rb +16 -3
  231. data/vendored/puppet/lib/puppet/version.rb +1 -1
  232. metadata +44 -26
  233. data/vendored/puppet/lib/puppet/application/master.rb +0 -317
  234. data/vendored/puppet/lib/puppet/feature/rack.rb +0 -19
  235. data/vendored/puppet/lib/puppet/network/http/api/ca.rb +0 -2
  236. data/vendored/puppet/lib/puppet/network/http/api/ca/v1.rb +0 -11
  237. data/vendored/puppet/lib/puppet/network/http/rack.rb +0 -33
  238. data/vendored/puppet/lib/puppet/network/http/rack/rest.rb +0 -162
  239. data/vendored/puppet/lib/puppet/network/http/webrick.rb +0 -124
  240. data/vendored/puppet/lib/puppet/network/http/webrick/rest.rb +0 -114
  241. data/vendored/puppet/lib/puppet/network/server.rb +0 -39
  242. data/vendored/puppet/lib/puppet/ssl/configuration.rb +0 -61
  243. data/vendored/puppet/lib/puppet/util/methodhelper.rb +0 -32
  244. data/vendored/puppet/lib/puppet/vendor/load_semantic.rb +0 -1
  245. data/vendored/puppet/lib/puppet/vendor/load_semantic_puppet.rb +0 -1
  246. data/vendored/puppet/lib/puppet/vendor/semantic/lib/semantic.rb +0 -5
  247. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet.rb +0 -11
  248. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency.rb +0 -181
  249. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/graph.rb +0 -60
  250. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/graph_node.rb +0 -117
  251. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/module_release.rb +0 -58
  252. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/source.rb +0 -25
  253. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/dependency/unsatisfiable_graph.rb +0 -31
  254. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/gem_version.rb +0 -3
  255. data/vendored/puppet/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +0 -203
  256. 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://docs.puppet.com/puppet/latest/reference/lang_lambdas.html)
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](http://docs.puppetlabs.com/puppet/latest/reference/lang_lambdas.html)
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://docs.puppetlabs.com/puppet/latest/reference/lang_iteration.html)
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://docs.puppet.com/puppet/latest/reference/lang_lambdas.html)
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://docs.puppetlabs.com/puppet/latest/reference/lang_lambdas.html#lambda-scope)
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://docs.puppet.com/puppet/latest/hiera_config_yaml_5.html#configuring-a-hierarchy-level-built-in-backends) for
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
- Puppet.warning(_("%{path}: file does not contain a valid yaml hash" % { path: path }))
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 (params = {})
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' => '"'+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' => '"'+ e.source.ref + '"',
455
- 'to' => '"'+ e.target.ref + '"',
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 (params={}) to_dot_graph(params).to_s; end
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, options = {})
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
- @cache_class = nil
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 = options.delete(:indirected_class)
104
- if mod = options[:extend]
105
- extend(mod)
106
- options.delete(:extend)
107
- end
100
+ @indirected_class = indirected_class
101
+ self.extend(extend) if extend
108
102
 
109
- # This is currently only used for cache_class and terminus_class.
110
- set_options(options)
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://docs.puppetlabs.com/guides/external_nodes.html) page for more information."
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://docs.puppetlabs.com/guides/ldap_nodes.html) page for more information. This will first
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
- Puppet::Network::Resolver.each_srv_record(Puppet.settings[:srv_domain], srv_service) do |srv_server, srv_port|
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
- begin
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
- bound_server = primary_server[0]
206
+ primary_server[0]
205
207
  else
206
- bound_server = Puppet.settings[:server]
208
+ Puppet.settings[:server]
207
209
  end
208
210
  end
209
211
 
210
- begin
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
- bound_port = primary_server[1]
214
+ primary_server[1]
215
215
  else
216
- bound_port = Puppet.settings[:masterport]
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
- begin
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
- begin
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]).to_i
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].to_i
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.push_context({:server_agent_version => server_version})
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 = JSON.parse(body)["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
- require 'puppet/util/methodhelper'
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, attrs = {})
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 = []