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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 607e97f4d7609e2927f6e055baec22293cefb698
4
- data.tar.gz: 7481be4e30655f46ee4908fb735dbcdc6de2383f
3
+ metadata.gz: be38f987a3976c357fd09e70de9ad65509014fd7
4
+ data.tar.gz: c92478de40249c5714dc67490b378dee76bd3f97
5
5
  SHA512:
6
- metadata.gz: 82322ab31eaeddbc94d4d50ec10dd494c107de3837e3eaaee1ce727827133a921f92fe794585fc2e9f79126afc4f9a344e7eaffbd23987f55ff8b88340ddb84f
7
- data.tar.gz: 1a7918248d6319a32fe7ca5daa73b6c506ea15d5cb66f733f6f562038ffeb228115f725d01e3fdce5a30a3bec20abe02e3ad0f35288d8001995fe801b62a4a8b
6
+ metadata.gz: e8094e1f2879c548bdd4f37af9419fbac6d6acefacfa32eead97fd020cdf301682060f6f1c482e9dd4ff4f8ddc41d7c6a0e94761099013bf006814c0a440d008
7
+ data.tar.gz: a76234f46802619085b65907b5f38f4c83c5865ffd91a7a45ad6472461ae78d7cc7eb7cb3b776a49263f1af72715986b972123fb1e168cdb466c1a39d1e953df
@@ -76,9 +76,9 @@ Puppet::Functions.create_function(:run_task) do
76
76
  if !targets.empty? && targets.all? { |t| t.protocol == 'pcp' && t.options['local-validation'] == false }
77
77
  # create a fake task
78
78
  task = Puppet::Pops::Types::TypeFactory.task.from_hash(
79
- 'name' => task_name,
80
- 'executable' => '',
81
- 'supports_noop' => true
79
+ 'name' => task_name,
80
+ 'implementations' => [{ 'name' => '', 'path' => '' }],
81
+ 'supports_noop' => true
82
82
  )
83
83
  else
84
84
  # TODO: use the compiler injection once PUP-8237 lands
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bolt/error'
4
+
5
+ # Sets a particular feature to present on a target.
6
+
7
+ Puppet::Functions.create_function(:set_feature) do
8
+ dispatch :set_feature do
9
+ param 'Target', :target
10
+ param 'String', :feature
11
+ optional_param 'Boolean', :value
12
+ end
13
+
14
+ def set_feature(target, feature, value = true)
15
+ unless Puppet[:tasks]
16
+ raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
17
+ Puppet::Pops::Issues::TASK_OPERATION_NOT_SUPPORTED_WHEN_COMPILING, operation: 'set_feature'
18
+ )
19
+ end
20
+
21
+ inventory = Puppet.lookup(:bolt_inventory) { nil }
22
+
23
+ unless inventory
24
+ raise Puppet::ParseErrorWithIssue.from_issue_and_stack(
25
+ Puppet::Pops::Issues::TASK_MISSING_BOLT, action: _('set feature')
26
+ )
27
+ end
28
+
29
+ inventory.set_feature(target, feature, value)
30
+
31
+ target
32
+ end
33
+ end
@@ -66,6 +66,7 @@ module Bolt
66
66
  @group_lookup = {}
67
67
  @target_vars = {}
68
68
  @target_facts = {}
69
+ @target_features = {}
69
70
  end
70
71
 
71
72
  def validate
@@ -105,6 +106,19 @@ module Bolt
105
106
  @target_facts[target.name] || {}
106
107
  end
107
108
 
109
+ def set_feature(target, feature, value = true)
110
+ @target_features[target.name] ||= Set.new
111
+ if value
112
+ @target_features[target.name] << feature
113
+ else
114
+ @target_features[target.name].delete(feature)
115
+ end
116
+ end
117
+
118
+ def features(target)
119
+ @target_features[target.name] || Set.new
120
+ end
121
+
108
122
  #### PRIVATE ####
109
123
  #
110
124
  # For debugging only now
@@ -181,7 +195,11 @@ module Bolt
181
195
  # Expand a comma-separated list
182
196
  targets.split(/[[:space:],]+/).reject(&:empty?).map do |name|
183
197
  ts = resolve_name(name)
184
- ts.map { |t| Bolt::Target.new(t) }
198
+ ts.map do |t|
199
+ target = Target.new(t)
200
+ target.inventory = self
201
+ target
202
+ end
185
203
  end
186
204
  end
187
205
  end
@@ -6,6 +6,7 @@ require 'bolt/error'
6
6
  module Bolt
7
7
  class Target
8
8
  attr_reader :uri, :options
9
+ attr_writer :inventory
9
10
 
10
11
  # Satisfies the Puppet datatypes API
11
12
  def self.from_asserted_hash(hash)
@@ -44,6 +45,20 @@ module Bolt
44
45
  end
45
46
  private :parse
46
47
 
48
+ def select_impl(task, additional_features = [])
49
+ available_features = features + additional_features
50
+ suitable_impl = task.implementations.find { |impl| Set.new(impl['requirements']).subset?(available_features) }
51
+ return suitable_impl['path'] if suitable_impl
52
+ end
53
+
54
+ def features
55
+ if @inventory
56
+ @inventory.features(self)
57
+ else
58
+ Set.new
59
+ end
60
+ end
61
+
47
62
  def eql?(other)
48
63
  self.class.equal?(other.class) && @uri == other.uri
49
64
  end
@@ -13,6 +13,8 @@ module Bolt
13
13
  %w[tmpdir]
14
14
  end
15
15
 
16
+ PROVIDED_FEATURES = ['shell'].freeze
17
+
16
18
  def self.validate(_options); end
17
19
 
18
20
  def initialize
@@ -78,11 +80,14 @@ module Bolt
78
80
  end
79
81
 
80
82
  def run_task(target, task, arguments, _options = {})
83
+ executable = target.select_impl(task, PROVIDED_FEATURES)
84
+ raise "No suitable implementation of #{task.name} for #{target.name}" unless executable
85
+
81
86
  input_method = task.input_method
82
87
  stdin = STDIN_METHODS.include?(input_method) ? JSON.dump(arguments) : nil
83
88
  env = ENVIRONMENT_METHODS.include?(input_method) ? arguments : nil
84
89
 
85
- with_tmpscript(task.executable, target.options['tmpdir']) do |script|
90
+ with_tmpscript(executable, target.options['tmpdir']) do |script|
86
91
  logger.debug("Running '#{script}' with #{arguments}")
87
92
 
88
93
  output = @conn.execute(script, stdin: stdin, env: env)
@@ -22,6 +22,8 @@ module Bolt
22
22
  %w[service-url cacert token-file task-environment local-validation]
23
23
  end
24
24
 
25
+ PROVIDED_FEATURES = ['puppet-agent'].freeze
26
+
25
27
  def self.validate(options)
26
28
  validation_flag = options['local-validation']
27
29
  unless !!validation_flag == validation_flag
@@ -9,9 +9,11 @@ module Bolt
9
9
  module Transport
10
10
  class SSH < Base
11
11
  def self.options
12
- %w[port user password sudo-password private-key host-key-check connect-timeout tmpdir run-as]
12
+ %w[port user password sudo-password private-key host-key-check connect-timeout tmpdir run-as tty]
13
13
  end
14
14
 
15
+ PROVIDED_FEATURES = ['shell'].freeze
16
+
15
17
  def self.validate(options)
16
18
  logger = Logging.logger[self]
17
19
 
@@ -108,6 +110,9 @@ module Bolt
108
110
  end
109
111
 
110
112
  def run_task(target, task, arguments, options = {})
113
+ executable = target.select_impl(task, PROVIDED_FEATURES)
114
+ raise "No suitable implementation of #{task.name} for #{target.name}" unless executable
115
+
111
116
  input_method = task.input_method
112
117
  with_connection(target) do |conn|
113
118
  conn.running_as(options['_run_as']) do
@@ -128,7 +133,7 @@ module Bolt
128
133
  end
129
134
 
130
135
  conn.with_remote_tempdir do |dir|
131
- remote_task_path = conn.write_remote_executable(dir, task.executable)
136
+ remote_task_path = conn.write_remote_executable(dir, executable)
132
137
  if conn.run_as && stdin
133
138
  wrapper = make_wrapper_stringio(remote_task_path, stdin)
134
139
  remote_wrapper_path = conn.write_remote_executable(dir, wrapper, 'wrapper.sh')
@@ -13,6 +13,8 @@ module Bolt
13
13
  %w[port user password connect-timeout ssl ssl-verify tmpdir cacert extensions]
14
14
  end
15
15
 
16
+ PROVIDED_FEATURES = ['powershell'].freeze
17
+
16
18
  def self.validate(options)
17
19
  ssl_flag = options['ssl']
18
20
  unless !!ssl_flag == ssl_flag
@@ -98,6 +100,9 @@ catch
98
100
  end
99
101
 
100
102
  def run_task(target, task, arguments, _options = {})
103
+ executable = target.select_impl(task, PROVIDED_FEATURES)
104
+ raise "No suitable implementation of #{task.name} for #{target.name}" unless executable
105
+
101
106
  input_method = task.input_method
102
107
  with_connection(target) do |conn|
103
108
  if STDIN_METHODS.include?(input_method)
@@ -114,7 +119,7 @@ catch
114
119
  end
115
120
  end
116
121
 
117
- conn.with_remote_file(task.executable) do |remote_path|
122
+ conn.with_remote_file(executable) do |remote_path|
118
123
  output =
119
124
  if powershell_file?(remote_path) && stdin.nil?
120
125
  # NOTE: cannot redirect STDIN to a .ps1 script inside of PowerShell
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bolt
4
- VERSION = '0.20.3'
4
+ VERSION = '0.20.5'
5
5
  end
@@ -1,32 +1,8 @@
1
1
  # A plan that retrieves facts from the specified nodes by running
2
- # an appropriate facts::* task on each. Care is taken to run a
3
- # facts::* task corresponding to the node's platfrom on each
4
- # node.
2
+ # the 'facts' task on each.
5
3
  #
6
4
  # The $nodes parameter is a list of the nodes to retrieve the facts
7
5
  # from.
8
6
  plan facts::retrieve(TargetSpec $nodes) {
9
- $targets = get_targets($nodes)
10
-
11
- # Build a mapping from the names of the tasks to run to the lists of
12
- # targets to run the tasks on
13
- $task_targets = $targets.facts::group_by |$target| {
14
- $target.protocol ? {
15
- 'ssh' => 'facts::bash',
16
- 'winrm' => 'facts::powershell',
17
- 'pcp' => 'facts::ruby',
18
- 'local' => 'facts::bash',
19
- }
20
- }
21
-
22
- # Return a single result set composed of results from the result sets
23
- # returned by the individual task runs.
24
- return ResultSet(
25
- $task_targets.map |$task, $targets| {
26
- run_task($task, $targets, '_catch_errors' => true)
27
- }.reduce([]) |$results, $result_set| {
28
- # Collect the results from the individual result sets
29
- $results + $result_set.results
30
- }
31
- )
7
+ return run_task('facts', $nodes, '_catch_errors' => true)
32
8
  }
@@ -0,0 +1,9 @@
1
+ {
2
+ "description": "Gather system facts",
3
+ "parameters": {},
4
+ "implementations": [
5
+ {"name": "ruby.rb", "requirements": ["puppet-agent"]},
6
+ {"name": "powershell.ps1", "requirements": ["powershell"]},
7
+ {"name": "bash.sh", "requirements": ["shell"]}
8
+ ]
9
+ }
@@ -62,7 +62,7 @@ class Hiera::PuppetFunction < Puppet::Functions::InternalFunction
62
62
  unless Puppet[:strict] == :off
63
63
  #TRANSLATORS 'lookup' is a puppet function and should not be translated
64
64
  message = _("The function '%{class_name}' is deprecated in favor of using 'lookup'.") % { class_name: self.class.name }
65
- message += ' '+ _("See https://docs.puppet.com/puppet/%{minor_version}/reference/deprecated_language.html") %
65
+ message += ' '+ _("See https://puppet.com/docs/puppet/%{minor_version}/deprecated_language.html") %
66
66
  { minor_version: Puppet.minor_version }
67
67
  Puppet.warn_once('deprecations', self.class.name, message)
68
68
  end
@@ -20,13 +20,35 @@ class Hiera
20
20
  elsif key == CALLING_CLASS_PATH
21
21
  ans = find_hostclass(@real).gsub(/::/, '/')
22
22
  elsif key == CALLING_MODULE
23
- ans = @real.lookupvar(MODULE_NAME)
23
+ ans = safe_lookupvar(MODULE_NAME)
24
24
  else
25
- ans = @real.lookupvar(key)
25
+ ans = safe_lookupvar(key)
26
26
  end
27
27
  ans == EMPTY_STRING ? nil : ans
28
28
  end
29
29
 
30
+ # This method is used to handle the throw of :undefined_variable since when
31
+ # strict variables is not in effect, missing handling of the throw leads to
32
+ # a more expensive code path.
33
+ #
34
+ def safe_lookupvar(key)
35
+ reason = catch :undefined_variable do
36
+ return @real.lookupvar(key)
37
+ end
38
+
39
+ case Puppet[:strict]
40
+ when :off
41
+ # do nothing
42
+ when :warning
43
+ Puppet.warn_once(Puppet::Parser::Scope::UNDEFINED_VARIABLES_KIND, _("Variable: %{name}") % { name: key },
44
+ _("Undefined variable '%{name}'; %{reason}") % { name: key, reason: reason } )
45
+ when :error
46
+ raise ArgumentError, _("Undefined variable '%{name}'; %{reason}") % { name: key, reason: reason }
47
+ end
48
+ nil
49
+ end
50
+ private :safe_lookupvar
51
+
30
52
  def exist?(key)
31
53
  CALLING_KEYS.include?(key) || @real.exist?(key)
32
54
  end
@@ -1,10 +1,10 @@
1
1
  require 'puppet/version'
2
2
 
3
- if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("1.9.3")
4
- raise LoadError, _("Puppet %{version} requires ruby 1.9.3 or greater.") % { version: Puppet.version }
3
+ if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new("2.3.0")
4
+ raise LoadError, _("Puppet %{version} requires ruby 2.3.0 or greater.") % { version: Puppet.version }
5
5
  end
6
6
 
7
- Puppet::OLDEST_RECOMMENDED_RUBY_VERSION = '2.1.0'
7
+ Puppet::OLDEST_RECOMMENDED_RUBY_VERSION = '2.3.0'
8
8
 
9
9
  # see the bottom of the file for further inclusions
10
10
  # Also see the new Vendor support - towards the end
@@ -127,7 +127,7 @@ module Puppet
127
127
  # Now that settings are loaded we have the code loaded to be able to issue
128
128
  # deprecation warnings. Warn if we're on a deprecated ruby version.
129
129
  if Gem::Version.new(RUBY_VERSION.dup) < Gem::Version.new(Puppet::OLDEST_RECOMMENDED_RUBY_VERSION)
130
- Puppet.deprecation_warning(_("Support for ruby version %{version} is deprecated and will be removed in a future release. See https://docs.puppet.com/puppet/latest/system_requirements.html#ruby for a list of supported ruby versions.") % { version: RUBY_VERSION })
130
+ Puppet.deprecation_warning(_("Support for ruby version %{version} is deprecated and will be removed in a future release. See https://puppet.com/docs/puppet/latest/system_requirements.html for a list of supported ruby versions.") % { version: RUBY_VERSION })
131
131
  end
132
132
 
133
133
  # Initialize puppet's settings. This is intended only for use by external tools that are not
@@ -170,14 +170,6 @@ module Puppet
170
170
  end
171
171
  end
172
172
 
173
- # Create a new type. Just proxy to the Type class. The mirroring query
174
- # code was deprecated in 2008, but this is still in heavy use. I suppose
175
- # this can count as a soft deprecation for the next dev. --daniel 2011-04-12
176
- def self.newtype(name, options = {}, &block)
177
- Puppet.deprecation_warning(_("Creating %{name} via Puppet.newtype is deprecated and will be removed in a future release. Use Puppet::Type.newtype instead.") % { name: name })
178
- Puppet::Type.newtype(name, options, &block)
179
- end
180
-
181
173
  # Load vendored (setup paths, and load what is needed upfront).
182
174
  # See the Vendor class for how to add additional vendored gems/code
183
175
  require "puppet/vendor"
@@ -216,7 +208,6 @@ module Puppet
216
208
  Puppet::Network::HTTP::NoCachePool.new
217
209
  },
218
210
  :ssl_host => proc { Puppet::SSL::Host.localhost },
219
- :certificate_revocation => proc { Puppet[:certificate_revocation] },
220
211
  :plugins => proc { Puppet::Plugins::Configuration.load_plugins }
221
212
  }
222
213
  end
@@ -311,13 +311,13 @@ class Application
311
311
  # handling of this.
312
312
  option("--version", "-V") do |arg|
313
313
  puts "#{Puppet.version}"
314
- exit
314
+ exit(0)
315
315
  end
316
316
 
317
317
  # Every app responds to --help
318
318
  option("--help", "-h") do |v|
319
319
  puts help
320
- exit
320
+ exit(0)
321
321
  end
322
322
 
323
323
  def app_defaults()
@@ -166,7 +166,7 @@ specify '--server <servername>' as an argument. Boolean settings translate into
166
166
  '--setting' and '--no-setting' pairs.
167
167
 
168
168
  See the configuration file documentation at
169
- https://docs.puppetlabs.com/puppet/latest/reference/configuration.html for the
169
+ https://puppet.com/docs/puppet/latest/configuration.html for the
170
170
  full list of acceptable settings. A commented list of all settings can also be
171
171
  generated by running puppet agent with '--genconfig'.
172
172
 
@@ -78,7 +78,7 @@ valid setting, so you can specify '--tags <class>,<tag>'
78
78
  as an argument.
79
79
 
80
80
  See the configuration file documentation at
81
- https://docs.puppetlabs.com/puppet/latest/reference/configuration.html for the
81
+ https://puppet.com/docs/puppet/latest/configuration.html for the
82
82
  full list of acceptable parameters. A commented list of all
83
83
  configuration options can also be generated by running puppet with
84
84
  '--genconfig'.
@@ -194,7 +194,7 @@ setting, so you can specify '--ssldir <directory>' as an
194
194
  argument.
195
195
 
196
196
  See the configuration file documentation at
197
- https://docs.puppetlabs.com/puppet/latest/reference/configuration.html for the
197
+ https://puppet.com/docs/puppet/latest/configuration.html for the
198
198
  full list of acceptable parameters. A commented list of all
199
199
  configuration options can also be generated by running puppet cert with
200
200
  '--genconfig'.
@@ -83,7 +83,7 @@ puppet-device(8) -- #{summary}
83
83
 
84
84
  SYNOPSIS
85
85
  --------
86
- Retrieves catalogs from the Puppet master and applies them to remote devices.
86
+ Retrieves catalogs from the Puppet master and applies them to remote devices.
87
87
 
88
88
  This subcommand can be run manually; or periodically using cron,
89
89
  a scheduled task, or a similar tool.
@@ -106,9 +106,9 @@ retrieve and apply catalogs, and store reports.
106
106
 
107
107
  USAGE NOTES
108
108
  -----------
109
- Devices managed by the puppet-device subcommand on a Puppet agent are
110
- configured in device.conf, which is located at $confdir/device.conf by default,
111
- and is configurable with the $deviceconfig setting.
109
+ Devices managed by the puppet-device subcommand on a Puppet agent are
110
+ configured in device.conf, which is located at $confdir/device.conf by default,
111
+ and is configurable with the $deviceconfig setting.
112
112
 
113
113
  The device.conf file is an INI-like file, with one section per device:
114
114
 
@@ -117,20 +117,20 @@ type <TYPE>
117
117
  url <URL>
118
118
  debug
119
119
 
120
- The section name specifies the certname of the device.
120
+ The section name specifies the certname of the device.
121
121
 
122
122
  The values for the type and url properties are specific to each type of device.
123
123
 
124
124
  The optional debug property specifies transport-level debugging,
125
125
  and is limited to telnet and ssh transports.
126
126
 
127
- See https://docs.puppet.com/puppet/latest/config_file_device.html for details.
127
+ See https://puppet.com/docs/puppet/latest/config_file_device.html for details.
128
128
 
129
129
 
130
130
  OPTIONS
131
131
  -------
132
- Note that any setting that's valid in the configuration file is also a valid
133
- long argument. For example, 'server' is a valid configuration parameter, so
132
+ Note that any setting that's valid in the configuration file is also a valid
133
+ long argument. For example, 'server' is a valid configuration parameter, so
134
134
  you can specify '--server <servername>' as an argument.
135
135
 
136
136
  * --debug: