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
@@ -85,7 +85,6 @@ class Puppet::Node::Environment
85
85
  @modulepath = modulepath
86
86
  @manifest = manifest
87
87
  @config_version = config_version
88
- @modules_strict_semver = false
89
88
  end
90
89
 
91
90
  # Creates a new Puppet::Node::Environment instance, overriding any of the passed
@@ -240,22 +239,6 @@ class Puppet::Node::Environment
240
239
  Puppet.settings.value(param, self.name)
241
240
  end
242
241
 
243
- # A SemanticPuppet::VersionRange version >= 1.0.0 will not include versions with pre-release
244
- # identifiers unless that is explicitly declared. This may cause backward compatibility
245
- # issues when resolving module dependencies and the flag is therefore set to `false` by default.
246
- #
247
- # @param flag [Boolean] set to true to resolve module dependencies using strict SemVer semantics
248
- #
249
- def modules_strict_semver=(flag)
250
- @modules_strict_semver = flag
251
- end
252
-
253
- # @return [Boolean] the current value of the modules_strict_semver flag.
254
- # @api public
255
- def modules_strict_semver?
256
- @modules_strict_semver
257
- end
258
-
259
242
  # @api public
260
243
  # @return [Puppet::Resource::TypeCollection] The current global TypeCollection
261
244
  def known_resource_types
@@ -330,7 +313,7 @@ class Puppet::Node::Environment
330
313
 
331
314
  @modules = module_references.collect do |reference|
332
315
  begin
333
- Puppet::Module.new(reference[:name], reference[:path], self, modules_strict_semver?)
316
+ Puppet::Module.new(reference[:name], reference[:path], self)
334
317
  rescue Puppet::Module::Error => e
335
318
  Puppet.log_exception(e)
336
319
  nil
@@ -372,7 +355,7 @@ class Puppet::Node::Environment
372
355
  Puppet::Module.is_module_directory?(name, path)
373
356
  end
374
357
  modules_by_path[path] = module_names.sort.map do |name|
375
- Puppet::Module.new(name, File.join(path, name), self, modules_strict_semver?)
358
+ Puppet::Module.new(name, File.join(path, name), self)
376
359
  end
377
360
  end
378
361
  else
@@ -1,4 +1,3 @@
1
- require 'puppet/util/methodhelper'
2
1
  require 'puppet/util/logging'
3
2
  require 'puppet/util/docs'
4
3
 
@@ -22,7 +21,6 @@ class Puppet::Parameter
22
21
  include Puppet::Util
23
22
  include Puppet::Util::Errors
24
23
  include Puppet::Util::Logging
25
- include Puppet::Util::MethodHelper
26
24
 
27
25
  require 'puppet/parameter/value_collection'
28
26
 
@@ -93,6 +91,14 @@ class Puppet::Parameter
93
91
  end
94
92
  end
95
93
 
94
+ def sensitive(value = nil, &block)
95
+ if block
96
+ define_method(:is_sensitive, &block)
97
+ else
98
+ define_method(:is_sensitive) do value end
99
+ end
100
+ end
101
+
96
102
  # Produces a documentation string.
97
103
  # If an enumeration of _valid values_ has been defined, it is appended to the documentation
98
104
  # for this parameter specified with the {desc} method.
@@ -332,16 +338,15 @@ class Puppet::Parameter
332
338
  # @api public
333
339
  # @note A parameter should be created via the DSL method {Puppet::Type::newparam}
334
340
  #
335
- def initialize(options = {})
336
- options = symbolize_options(options)
337
- if resource = options[:resource]
341
+ def initialize(resource: nil, value: nil, should: nil)
342
+ if resource
338
343
  self.resource = resource
339
- options.delete(:resource)
340
344
  else
341
345
  raise Puppet::DevError, _("No resource set for %{name}") % { name: self.class.name }
342
346
  end
343
347
 
344
- set_options(options)
348
+ self.value = value if value
349
+ self.should = should if should
345
350
  end
346
351
 
347
352
  # Writes the given `msg` to the log with the loglevel indicated by the associated resource's
@@ -7,7 +7,6 @@ class Puppet::Parser::AST
7
7
  AST = Puppet::Parser::AST
8
8
 
9
9
  include Puppet::Util::Errors
10
- include Puppet::Util::MethodHelper
11
10
 
12
11
  attr_accessor :parent, :scope, :file, :line, :pos
13
12
 
@@ -44,14 +43,11 @@ class Puppet::Parser::AST
44
43
  end
45
44
  end
46
45
 
47
- # Initialize the object. Requires a hash as the argument, and
48
- # takes each of the parameters of the hash and calls the setter
49
- # method for them. This is probably pretty inefficient and should
50
- # likely be changed at some point.
51
- def initialize(args)
52
- set_options(args)
46
+ def initialize(file: nil, line: nil, pos: nil)
47
+ @file = file
48
+ @line = line
49
+ @pos = pos
53
50
  end
54
-
55
51
  end
56
52
 
57
53
  # And include all of the AST subclasses.
@@ -12,8 +12,8 @@ class Puppet::Parser::AST::Branch < Puppet::Parser::AST
12
12
  @children.each { |child| yield child }
13
13
  end
14
14
 
15
- def initialize(arghash)
16
- super(arghash)
17
- @children ||= []
15
+ def initialize(children: [], **args)
16
+ @children = children
17
+ super(**args)
18
18
  end
19
19
  end
@@ -16,6 +16,11 @@ class Puppet::Parser::AST::Leaf < Puppet::Parser::AST
16
16
  def to_s
17
17
  @value.to_s unless @value.nil?
18
18
  end
19
+
20
+ def initialize(value: nil, **options)
21
+ @value = value
22
+ super(**options)
23
+ end
19
24
  end
20
25
 
21
26
  # Host names, either fully qualified or just the short name, or even a regex
@@ -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
@@ -16,7 +16,6 @@ class Puppet::Parser::Compiler
16
16
 
17
17
  include Puppet::Util
18
18
  include Puppet::Util::Errors
19
- include Puppet::Util::MethodHelper
20
19
  include Puppet::Pops::Evaluator::Runtime3Support
21
20
 
22
21
  def self.compile(node, code_id = nil)
@@ -27,7 +26,7 @@ class Puppet::Parser::Compiler
27
26
  errors.each { |e| Puppet.err(e) } if errors.size > 1
28
27
  errmsg = [
29
28
  _("Compilation has been halted because: %{error}") % { error: errors.first },
30
- _("For more information, see https://docs.puppet.com/puppet/latest/reference/environments.html"),
29
+ _("For more information, see https://puppet.com/docs/puppet/latest/environments_about.html"),
31
30
  ]
32
31
  raise(Puppet::Error, errmsg.join(' '))
33
32
  end
@@ -397,7 +396,7 @@ class Puppet::Parser::Compiler
397
396
  # Return a resource by either its ref or its type and title.
398
397
  def_delegator :@catalog, :resource, :findresource
399
398
 
400
- def initialize(node, options = {})
399
+ def initialize(node, code_id: nil)
401
400
  @node = sanitize_node(node)
402
401
  # Array of resources representing all application instances we've found
403
402
  @applications = []
@@ -409,7 +408,7 @@ class Puppet::Parser::Compiler
409
408
  # in the middle of executing evaluate_applications
410
409
  @current_app = nil
411
410
  @current_components = nil
412
- set_options(options)
411
+ @code_id = code_id
413
412
  initvars
414
413
  add_catalog_validators
415
414
  # Resolutions of fully qualified variable names
@@ -32,8 +32,15 @@ class Puppet::Parser::Compiler
32
32
  refs = param.value.is_a?(Array) ? param.value.flatten : [param.value]
33
33
  refs.each do |r|
34
34
  next if r.nil? || r == :undef
35
- unless catalog.resource(r.to_s)
36
- msg = _("Could not find resource '%{res}' in parameter '%{param}'") % { res: r.to_s, param: param.name.to_s }
35
+ res = r.to_s
36
+ begin
37
+ found = catalog.resource(res)
38
+ rescue ArgumentError => e
39
+ # Raise again but with file and line information
40
+ raise CatalogValidationError.new(e.message, param.file, param.line)
41
+ end
42
+ unless found
43
+ msg = _("Could not find resource '%{res}' in parameter '%{param}'") % { res: res, param: param.name.to_s }
37
44
  raise CatalogValidationError.new(msg, param.file, param.line)
38
45
  end
39
46
  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://docs.puppetlabs.com/guides/custom_functions.html)
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://docs.puppetlabs.com/puppet/latest/reference/lang_data.html), or
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://docs.puppetlabs.com/puppet/latest/reference/lang_lambdas.html).
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://docs.puppetlabs.com/puppet/latest/reference/lang_data.html).
54
+ [documentation](https://puppet.com/docs/puppet/latest/lang_data.html).
55
55
 
56
56
  - Since 4.0.0
57
57
  DOC
@@ -67,13 +67,7 @@ Puppet::Parser::Functions::newfunction(:create_resources, :arity => -3, :doc =>
67
67
  # If relayed via other puppet functions in ruby that do not nest their calls, the source position
68
68
  # will be in the original puppet source.
69
69
  #
70
- stacktrace = Puppet::Pops::PuppetStack.stacktrace()
71
- if stacktrace.size > 0
72
- file, line = stacktrace[0]
73
- else
74
- file = nil
75
- line = nil
76
- end
70
+ file, line = Puppet::Pops::PuppetStack.top_of_stack
77
71
 
78
72
  if type.start_with? '@@'
79
73
  exported = true
@@ -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://docs.puppetlabs.com/puppet/latest/reference/lang_lambdas.html)
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://docs.puppetlabs.com/puppet/latest/reference/lang_iteration.html)
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://docs.puppetlabs.com/puppet/latest/reference/lang_lambdas.html)
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://docs.puppetlabs.com/hiera/latest/hierarchy.html) to insert at the
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://docs.puppetlabs.com/puppet/latest/reference/lang_lambdas.html) that
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 https://docs.puppet.com/puppet/#{Puppet.minor_version}/reference/deprecated_language.html.
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://docs.puppetlabs.com/hiera/latest/puppet.html#hiera-lookup-functions)
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://docs.puppetlabs.com/hiera/latest/lookup_types.html#array-merge).
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://docs.puppetlabs.com/hiera/latest/hierarchy.html) to insert at the
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://docs.puppetlabs.com/puppet/latest/reference/lang_lambdas.html) that
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 https://docs.puppet.com/puppet/#{Puppet.minor_version}/reference/deprecated_language.html.
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://docs.puppetlabs.com/hiera/latest/puppet.html#hiera-lookup-functions)
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://docs.puppetlabs.com/hiera/latest/lookup_types.html#hash-merge).
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://docs.puppetlabs.com/hiera/latest/configuring.html#mergebehavior)
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://docs.puppetlabs.com/hiera/latest/hierarchy.html) to insert at the
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://docs.puppetlabs.com/puppet/latest/reference/lang_lambdas.html) that
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://docs.puppet.com/puppet/#{Puppet.minor_version}/reference/deprecated_language.html.
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://docs.puppetlabs.com/hiera/latest/puppet.html#hiera-lookup-functions)
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://docs.puppetlabs.com/hiera/latest/lookup_types.html#array-merge)
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://docs.puppetlabs.com/hiera/latest/hierarchy.html) to insert at the
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://docs.puppetlabs.com/hiera/latest/lookup_types.html#array-merge)
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://docs.puppetlabs.com/puppet/latest/reference/lang_lambdas.html) that
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. See https://docs.puppet.com/puppet/#{Puppet.minor_version}/reference/deprecated_language.html.
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|