puppet 5.3.7-x64-mingw32 → 5.4.0-x64-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (454) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +42 -29
  3. data/README.md +8 -6
  4. data/ext/cert_inspector +2 -2
  5. data/ext/envpuppet +1 -1
  6. data/ext/gentoo/init.d/puppetmaster +4 -4
  7. data/ext/ips/puppet-agent +11 -11
  8. data/ext/ips/puppet-master +11 -11
  9. data/ext/puppet-test +1 -2
  10. data/ext/redhat/client.init +2 -2
  11. data/ext/redhat/logrotate +1 -1
  12. data/ext/solaris/smf/puppet +11 -11
  13. data/ext/solaris/smf/svc-puppetd +5 -5
  14. data/ext/solaris/smf/svc-puppetmasterd +5 -5
  15. data/ext/windows/service/daemon.rb +1 -1
  16. data/install.rb +2 -3
  17. data/lib/puppet/agent.rb +1 -1
  18. data/lib/puppet/application/cert.rb +1 -3
  19. data/lib/puppet/application/describe.rb +0 -1
  20. data/lib/puppet/application/device.rb +12 -99
  21. data/lib/puppet/application/filebucket.rb +32 -11
  22. data/lib/puppet/application/lookup.rb +1 -11
  23. data/lib/puppet/application/script.rb +261 -0
  24. data/lib/puppet/configurer.rb +3 -4
  25. data/lib/puppet/configurer/plugin_handler.rb +26 -9
  26. data/lib/puppet/context.rb +1 -1
  27. data/lib/puppet/datatypes.rb +213 -0
  28. data/lib/puppet/datatypes/error.rb +21 -0
  29. data/lib/puppet/datatypes/impl/error.rb +40 -0
  30. data/lib/puppet/defaults.rb +51 -20
  31. data/lib/puppet/environments.rb +17 -0
  32. data/lib/puppet/error.rb +17 -0
  33. data/lib/puppet/etc.rb +2 -2
  34. data/lib/puppet/external/pson/pure/generator.rb +1 -1
  35. data/lib/puppet/external/pson/pure/parser.rb +1 -1
  36. data/lib/puppet/face/config.rb +45 -0
  37. data/lib/puppet/face/epp.rb +3 -3
  38. data/lib/puppet/face/help/action.erb +3 -0
  39. data/lib/puppet/face/module/build.rb +1 -0
  40. data/lib/puppet/face/module/generate.rb +5 -0
  41. data/lib/puppet/face/module/install.rb +1 -0
  42. data/lib/puppet/face/module/search.rb +6 -2
  43. data/lib/puppet/face/module/uninstall.rb +1 -0
  44. data/lib/puppet/face/module/upgrade.rb +1 -0
  45. data/lib/puppet/face/parser.rb +0 -1
  46. data/lib/puppet/face/plugin.rb +1 -3
  47. data/lib/puppet/feature/base.rb +1 -1
  48. data/lib/puppet/feature/bolt.rb +3 -0
  49. data/lib/puppet/file_bucket/dipper.rb +1 -2
  50. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  51. data/lib/puppet/file_system/uniquefile.rb +2 -2
  52. data/lib/puppet/forge.rb +6 -0
  53. data/lib/puppet/functions.rb +70 -88
  54. data/lib/puppet/functions/all.rb +6 -2
  55. data/lib/puppet/functions/annotate.rb +1 -1
  56. data/lib/puppet/functions/any.rb +7 -3
  57. data/lib/puppet/functions/contain.rb +6 -0
  58. data/lib/puppet/functions/convert_to.rb +32 -0
  59. data/lib/puppet/functions/defined.rb +0 -3
  60. data/lib/puppet/functions/each.rb +10 -6
  61. data/lib/puppet/functions/filter.rb +16 -10
  62. data/lib/puppet/functions/find_file.rb +0 -1
  63. data/lib/puppet/functions/include.rb +6 -0
  64. data/lib/puppet/functions/map.rb +12 -9
  65. data/lib/puppet/functions/module_directory.rb +41 -0
  66. data/lib/puppet/functions/new.rb +1 -4
  67. data/lib/puppet/functions/regsubst.rb +1 -1
  68. data/lib/puppet/functions/require.rb +6 -0
  69. data/lib/puppet/generate/type.rb +1 -1
  70. data/lib/puppet/gettext/config.rb +2 -2
  71. data/lib/puppet/gettext/stubs.rb +1 -1
  72. data/lib/puppet/indirector/catalog/compiler.rb +0 -1
  73. data/lib/puppet/indirector/file_bucket_file/file.rb +6 -2
  74. data/lib/puppet/indirector/file_server.rb +1 -1
  75. data/lib/puppet/indirector/node/ldap.rb +19 -3
  76. data/lib/puppet/indirector/request.rb +10 -6
  77. data/lib/puppet/indirector/rest.rb +11 -12
  78. data/lib/puppet/info_service/class_information_service.rb +1 -1
  79. data/lib/puppet/interface/action.rb +11 -0
  80. data/lib/puppet/interface/action_builder.rb +8 -0
  81. data/lib/puppet/interface/option_manager.rb +1 -1
  82. data/lib/puppet/loaders.rb +2 -0
  83. data/lib/puppet/module.rb +6 -2
  84. data/lib/puppet/module_tool/applications/builder.rb +4 -0
  85. data/lib/puppet/module_tool/applications/installer.rb +3 -0
  86. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -0
  87. data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
  88. data/lib/puppet/module_tool/applications/upgrader.rb +3 -0
  89. data/lib/puppet/module_tool/installed_modules.rb +1 -1
  90. data/lib/puppet/module_tool/metadata.rb +0 -1
  91. data/lib/puppet/network/authstore.rb +1 -1
  92. data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
  93. data/lib/puppet/network/http/connection.rb +1 -9
  94. data/lib/puppet/network/http/factory.rb +0 -3
  95. data/lib/puppet/network/http/webrick.rb +1 -0
  96. data/lib/puppet/network/rights.rb +1 -1
  97. data/lib/puppet/node.rb +53 -0
  98. data/lib/puppet/node/environment.rb +1 -1
  99. data/lib/puppet/parameter/boolean.rb +1 -1
  100. data/lib/puppet/parser.rb +1 -0
  101. data/lib/puppet/parser/abstract_compiler.rb +36 -0
  102. data/lib/puppet/parser/ast/branch.rb +1 -1
  103. data/lib/puppet/parser/ast/pops_bridge.rb +8 -52
  104. data/lib/puppet/parser/compiler.rb +4 -54
  105. data/lib/puppet/parser/functions.rb +0 -1
  106. data/lib/puppet/parser/functions/create_resources.rb +6 -0
  107. data/lib/puppet/parser/functions/fqdn_rand.rb +6 -2
  108. data/lib/puppet/parser/functions/inline_template.rb +6 -0
  109. data/lib/puppet/parser/functions/new.rb +47 -32
  110. data/lib/puppet/parser/functions/realize.rb +6 -0
  111. data/lib/puppet/parser/functions/return.rb +1 -22
  112. data/lib/puppet/parser/functions/reverse_each.rb +1 -1
  113. data/lib/puppet/parser/functions/scanf.rb +1 -1
  114. data/lib/puppet/parser/functions/sha256.rb +5 -0
  115. data/lib/puppet/parser/functions/tag.rb +6 -0
  116. data/lib/puppet/parser/functions/tagged.rb +6 -0
  117. data/lib/puppet/parser/functions/template.rb +5 -0
  118. data/lib/puppet/parser/scope.rb +28 -4
  119. data/lib/puppet/parser/script_compiler.rb +118 -0
  120. data/lib/puppet/parser/type_loader.rb +1 -1
  121. data/lib/puppet/pops.rb +1 -1
  122. data/lib/puppet/pops/evaluator/access_operator.rb +38 -4
  123. data/lib/puppet/pops/evaluator/closure.rb +12 -4
  124. data/lib/puppet/pops/evaluator/compare_operator.rb +4 -4
  125. data/lib/puppet/pops/evaluator/epp_evaluator.rb +13 -0
  126. data/lib/puppet/pops/evaluator/evaluator_impl.rb +38 -10
  127. data/lib/puppet/pops/evaluator/literal_evaluator.rb +1 -1
  128. data/lib/puppet/pops/evaluator/runtime3_converter.rb +1 -1
  129. data/lib/puppet/pops/evaluator/runtime3_support.rb +2 -3
  130. data/lib/puppet/pops/functions/dispatch.rb +6 -5
  131. data/lib/puppet/pops/functions/function.rb +2 -2
  132. data/lib/puppet/pops/issues.rb +34 -2
  133. data/lib/puppet/pops/loader/base_loader.rb +10 -0
  134. data/lib/puppet/pops/loader/dependency_loader.rb +7 -0
  135. data/lib/puppet/pops/loader/loader.rb +21 -2
  136. data/lib/puppet/pops/loader/loader_paths.rb +180 -30
  137. data/lib/puppet/pops/loader/module_loaders.rb +202 -33
  138. data/lib/puppet/pops/loader/puppet_plan_instantiator.rb +84 -0
  139. data/lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb +9 -9
  140. data/lib/puppet/pops/loader/ruby_data_type_instantiator.rb +40 -0
  141. data/lib/puppet/pops/loader/runtime3_type_loader.rb +6 -1
  142. data/lib/puppet/pops/loader/static_loader.rb +23 -8
  143. data/lib/puppet/pops/loader/task_instantiator.rb +69 -0
  144. data/lib/puppet/pops/loader/type_definition_instantiator.rb +4 -0
  145. data/lib/puppet/pops/loaders.rb +122 -11
  146. data/lib/puppet/pops/lookup/data_dig_function_provider.rb +1 -1
  147. data/lib/puppet/pops/lookup/interpolation.rb +1 -1
  148. data/lib/puppet/pops/lookup/lookup_adapter.rb +0 -1
  149. data/lib/puppet/pops/model/ast.pp +3 -0
  150. data/lib/puppet/pops/model/ast.rb +34 -1
  151. data/lib/puppet/pops/model/factory.rb +30 -3
  152. data/lib/puppet/pops/model/model_label_provider.rb +1 -0
  153. data/lib/puppet/pops/model/model_tree_dumper.rb +12 -1
  154. data/lib/puppet/pops/model/tree_dumper.rb +1 -1
  155. data/lib/puppet/pops/parser/code_merger.rb +2 -2
  156. data/lib/puppet/pops/parser/egrammar.ra +44 -15
  157. data/lib/puppet/pops/parser/eparser.rb +1687 -1571
  158. data/lib/puppet/pops/parser/epp_support.rb +1 -3
  159. data/lib/puppet/pops/parser/evaluating_parser.rb +1 -1
  160. data/lib/puppet/pops/parser/interpolation_support.rb +2 -2
  161. data/lib/puppet/pops/parser/lexer2.rb +4 -4
  162. data/lib/puppet/pops/parser/lexer_support.rb +2 -2
  163. data/lib/puppet/pops/parser/locatable.rb +1 -1
  164. data/lib/puppet/pops/parser/locator.rb +7 -13
  165. data/lib/puppet/pops/parser/parser_support.rb +3 -3
  166. data/lib/puppet/pops/parser/slurp_support.rb +0 -3
  167. data/lib/puppet/pops/pcore.rb +45 -0
  168. data/lib/puppet/pops/resource/param.rb +1 -1
  169. data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
  170. data/lib/puppet/pops/serialization/abstract_reader.rb +4 -0
  171. data/lib/puppet/pops/serialization/abstract_writer.rb +6 -0
  172. data/lib/puppet/pops/serialization/extension.rb +1 -0
  173. data/lib/puppet/pops/serialization/from_data_converter.rb +64 -10
  174. data/lib/puppet/pops/serialization/json_path.rb +2 -1
  175. data/lib/puppet/pops/serialization/object.rb +3 -4
  176. data/lib/puppet/pops/serialization/serializer.rb +2 -1
  177. data/lib/puppet/pops/serialization/to_data_converter.rb +7 -3
  178. data/lib/puppet/pops/time/timespan.rb +1 -1
  179. data/lib/puppet/pops/types/iterable.rb +38 -9
  180. data/lib/puppet/pops/types/p_init_type.rb +1 -1
  181. data/lib/puppet/pops/types/p_meta_type.rb +4 -0
  182. data/lib/puppet/pops/types/p_object_type.rb +146 -14
  183. data/lib/puppet/pops/types/p_object_type_extension.rb +218 -0
  184. data/lib/puppet/pops/types/p_sem_ver_range_type.rb +0 -1
  185. data/lib/puppet/pops/types/p_sem_ver_type.rb +10 -2
  186. data/lib/puppet/pops/types/p_type_set_type.rb +0 -1
  187. data/lib/puppet/pops/types/p_uri_type.rb +190 -0
  188. data/lib/puppet/pops/types/puppet_object.rb +15 -1
  189. data/lib/puppet/pops/types/ruby_generator.rb +46 -54
  190. data/lib/puppet/pops/types/string_converter.rb +22 -1
  191. data/lib/puppet/pops/types/type_acceptor.rb +1 -1
  192. data/lib/puppet/pops/types/type_calculator.rb +13 -4
  193. data/lib/puppet/pops/types/type_factory.rb +29 -5
  194. data/lib/puppet/pops/types/type_formatter.rb +67 -4
  195. data/lib/puppet/pops/types/type_parser.rb +92 -4
  196. data/lib/puppet/pops/types/type_with_members.rb +43 -0
  197. data/lib/puppet/pops/types/types.rb +212 -80
  198. data/lib/puppet/pops/validation/checker4_0.rb +10 -6
  199. data/lib/puppet/pops/validation/tasks_checker.rb +60 -0
  200. data/lib/puppet/pops/validation/validator_factory_4_0.rb +6 -1
  201. data/lib/puppet/property.rb +1 -1
  202. data/lib/puppet/provider.rb +18 -8
  203. data/lib/puppet/provider/augeas/augeas.rb +3 -4
  204. data/lib/puppet/provider/exec.rb +0 -2
  205. data/lib/puppet/provider/group/groupadd.rb +25 -1
  206. data/lib/puppet/provider/group/windows_adsi.rb +7 -4
  207. data/lib/puppet/provider/mount.rb +25 -8
  208. data/lib/puppet/provider/nameservice.rb +9 -4
  209. data/lib/puppet/provider/nameservice/directoryservice.rb +3 -3
  210. data/lib/puppet/provider/nameservice/objectadd.rb +13 -24
  211. data/lib/puppet/provider/nameservice/pw.rb +14 -14
  212. data/lib/puppet/provider/package/appdmg.rb +0 -1
  213. data/lib/puppet/provider/package/apple.rb +0 -1
  214. data/lib/puppet/provider/package/gem.rb +2 -2
  215. data/lib/puppet/provider/package/macports.rb +2 -2
  216. data/lib/puppet/provider/package/pkg.rb +3 -0
  217. data/lib/puppet/provider/package/pkgdmg.rb +0 -1
  218. data/lib/puppet/provider/package/portage.rb +0 -1
  219. data/lib/puppet/provider/package/yum.rb +23 -8
  220. data/lib/puppet/provider/package/zypper.rb +2 -2
  221. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
  222. data/lib/puppet/provider/service/init.rb +1 -0
  223. data/lib/puppet/provider/service/launchd.rb +6 -7
  224. data/lib/puppet/provider/service/redhat.rb +3 -2
  225. data/lib/puppet/provider/service/systemd.rb +2 -2
  226. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
  227. data/lib/puppet/provider/user/aix.rb +3 -2
  228. data/lib/puppet/provider/user/openbsd.rb +1 -1
  229. data/lib/puppet/provider/user/pw.rb +1 -1
  230. data/lib/puppet/provider/user/user_role_add.rb +7 -1
  231. data/lib/puppet/provider/user/useradd.rb +36 -6
  232. data/lib/puppet/provider/user/windows_adsi.rb +1 -1
  233. data/lib/puppet/provider/yumrepo/inifile.rb +2 -4
  234. data/lib/puppet/provider/zfs/zfs.rb +23 -3
  235. data/lib/puppet/provider/zpool/zpool.rb +1 -1
  236. data/lib/puppet/reference/configuration.rb +0 -2
  237. data/lib/puppet/reference/type.rb +0 -1
  238. data/lib/puppet/resource.rb +1 -2
  239. data/lib/puppet/resource/catalog.rb +1 -1
  240. data/lib/puppet/resource/status.rb +0 -1
  241. data/lib/puppet/resource/type.rb +4 -4
  242. data/lib/puppet/resource/type_collection.rb +1 -1
  243. data/lib/puppet/settings/base_setting.rb +1 -1
  244. data/lib/puppet/settings/environment_conf.rb +0 -1
  245. data/lib/puppet/settings/ini_file.rb +66 -12
  246. data/lib/puppet/ssl/certificate_authority.rb +1 -1
  247. data/lib/puppet/ssl/certificate_request.rb +2 -2
  248. data/lib/puppet/ssl/certificate_revocation_list.rb +2 -1
  249. data/lib/puppet/ssl/certificate_signer.rb +11 -0
  250. data/lib/puppet/ssl/host.rb +2 -2
  251. data/lib/puppet/syntax_checkers/base64.rb +1 -1
  252. data/lib/puppet/transaction.rb +37 -14
  253. data/lib/puppet/transaction/report.rb +3 -1
  254. data/lib/puppet/type.rb +17 -4
  255. data/lib/puppet/type/cron.rb +1 -1
  256. data/lib/puppet/type/exec.rb +5 -4
  257. data/lib/puppet/type/file.rb +3 -3
  258. data/lib/puppet/type/file/checksum.rb +7 -1
  259. data/lib/puppet/type/file/checksum_value.rb +4 -3
  260. data/lib/puppet/type/group.rb +3 -0
  261. data/lib/puppet/type/k5login.rb +101 -0
  262. data/lib/puppet/type/macauthorization.rb +1 -1
  263. data/lib/puppet/type/mount.rb +6 -2
  264. data/lib/puppet/type/tidy.rb +6 -4
  265. data/lib/puppet/type/user.rb +26 -39
  266. data/lib/puppet/type/yumrepo.rb +9 -0
  267. data/lib/puppet/type/zfs.rb +4 -0
  268. data/lib/puppet/util.rb +8 -15
  269. data/lib/puppet/util/character_encoding.rb +2 -2
  270. data/lib/puppet/util/checksums.rb +82 -1
  271. data/lib/puppet/util/errors.rb +0 -2
  272. data/lib/puppet/util/filetype.rb +2 -2
  273. data/lib/puppet/util/json_lockfile.rb +1 -1
  274. data/lib/puppet/util/log.rb +1 -1
  275. data/lib/puppet/util/log/destinations.rb +10 -1
  276. data/lib/puppet/util/monkey_patches.rb +1 -1
  277. data/lib/puppet/util/network_device/cisco/device.rb +5 -5
  278. data/lib/puppet/util/network_device/config.rb +2 -3
  279. data/lib/puppet/util/platform.rb +13 -0
  280. data/lib/puppet/util/plist.rb +4 -4
  281. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +2 -2
  282. data/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb +1 -1
  283. data/lib/puppet/util/reference.rb +8 -1
  284. data/lib/puppet/util/windows/adsi.rb +18 -15
  285. data/lib/puppet/util/windows/principal.rb +6 -7
  286. data/lib/puppet/util/windows/process.rb +1 -1
  287. data/lib/puppet/util/windows/registry.rb +2 -2
  288. data/lib/puppet/util/windows/sid.rb +7 -62
  289. data/lib/puppet/vendor/deep_merge/README.md +2 -2
  290. data/lib/puppet/vendor/pathspec/lib/pathspec/gitignorespec.rb +18 -18
  291. data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +2 -2
  292. data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb +5 -5
  293. data/lib/puppet/vendor/semantic_puppet/locales/config.yaml +1 -1
  294. data/lib/puppet/version.rb +1 -1
  295. data/lib/puppet_pal.rb +874 -0
  296. data/locales/ja/puppet.po +140 -163
  297. data/locales/puppet.pot +940 -597
  298. data/man/man5/puppet.conf.5 +16 -91
  299. data/man/man8/puppet-agent.8 +2 -6
  300. data/man/man8/puppet-apply.8 +2 -2
  301. data/man/man8/puppet-ca.8 +1 -1
  302. data/man/man8/puppet-catalog.8 +1 -1
  303. data/man/man8/puppet-cert.8 +1 -1
  304. data/man/man8/puppet-certificate.8 +1 -1
  305. data/man/man8/puppet-certificate_request.8 +1 -1
  306. data/man/man8/puppet-certificate_revocation_list.8 +1 -1
  307. data/man/man8/puppet-config.8 +1 -1
  308. data/man/man8/puppet-describe.8 +1 -1
  309. data/man/man8/puppet-device.8 +11 -33
  310. data/man/man8/puppet-doc.8 +1 -1
  311. data/man/man8/puppet-epp.8 +1 -1
  312. data/man/man8/puppet-facts.8 +1 -1
  313. data/man/man8/puppet-filebucket.8 +4 -22
  314. data/man/man8/puppet-generate.8 +1 -1
  315. data/man/man8/puppet-help.8 +1 -1
  316. data/man/man8/puppet-key.8 +1 -1
  317. data/man/man8/puppet-lookup.8 +1 -1
  318. data/man/man8/puppet-man.8 +1 -1
  319. data/man/man8/puppet-master.8 +1 -1
  320. data/man/man8/puppet-module.8 +2 -11
  321. data/man/man8/puppet-node.8 +1 -1
  322. data/man/man8/puppet-parser.8 +1 -1
  323. data/man/man8/puppet-plugin.8 +1 -1
  324. data/man/man8/puppet-report.8 +1 -1
  325. data/man/man8/puppet-resource.8 +1 -1
  326. data/man/man8/puppet-status.8 +1 -1
  327. data/man/man8/puppet.8 +2 -2
  328. data/spec/integration/application/lookup_spec.rb +0 -21
  329. data/spec/integration/parser/compiler_spec.rb +18 -0
  330. data/spec/integration/parser/script_compiler_spec.rb +113 -0
  331. data/spec/integration/provider/mount_spec.rb +2 -0
  332. data/spec/integration/type/file_spec.rb +11 -3
  333. data/spec/integration/util/windows/adsi_spec.rb +1 -86
  334. data/spec/integration/util/windows/principal_spec.rb +1 -10
  335. data/spec/shared_contexts/checksum.rb +4 -1
  336. data/spec/shared_contexts/digests.rb +46 -1
  337. data/spec/shared_contexts/types_setup.rb +8 -3
  338. data/spec/unit/agent_spec.rb +2 -2
  339. data/spec/unit/application/cert_spec.rb +5 -17
  340. data/spec/unit/application/device_spec.rb +2 -96
  341. data/spec/unit/application/filebucket_spec.rb +18 -4
  342. data/spec/unit/configurer/plugin_handler_spec.rb +5 -32
  343. data/spec/unit/configurer_spec.rb +3 -3
  344. data/spec/unit/datatypes_spec.rb +304 -0
  345. data/spec/unit/defaults_spec.rb +41 -20
  346. data/spec/unit/face/config_spec.rb +46 -1
  347. data/spec/unit/face/epp_face_spec.rb +7 -3
  348. data/spec/unit/face/module/search_spec.rb +11 -0
  349. data/spec/unit/face/parser_spec.rb +2 -2
  350. data/spec/unit/file_bucket/dipper_spec.rb +12 -1
  351. data/spec/unit/forge/module_release_spec.rb +70 -0
  352. data/spec/unit/functions/break_spec.rb +34 -2
  353. data/spec/unit/functions/contain_spec.rb +1 -0
  354. data/spec/unit/functions/convert_to_spec.rb +22 -0
  355. data/spec/unit/functions/epp_spec.rb +5 -0
  356. data/spec/unit/functions/include_spec.rb +15 -0
  357. data/spec/unit/functions/module_directory_spec.rb +43 -0
  358. data/spec/unit/functions/new_spec.rb +14 -14
  359. data/spec/unit/functions/require_spec.rb +2 -0
  360. data/spec/unit/functions/shared.rb +12 -0
  361. data/spec/unit/functions/step_spec.rb +1 -1
  362. data/spec/unit/functions4_spec.rb +49 -4
  363. data/spec/unit/indirector/catalog/compiler_spec.rb +3 -3
  364. data/spec/unit/indirector/file_bucket_file/file_spec.rb +148 -94
  365. data/spec/unit/indirector/node/ldap_spec.rb +15 -12
  366. data/spec/unit/indirector/rest_spec.rb +0 -43
  367. data/spec/unit/interface/action_spec.rb +33 -0
  368. data/spec/unit/module_tool/applications/builder_spec.rb +7 -0
  369. data/spec/unit/module_tool/applications/installer_spec.rb +8 -0
  370. data/spec/unit/module_tool/applications/uninstaller_spec.rb +8 -0
  371. data/spec/unit/module_tool/applications/upgrader_spec.rb +6 -0
  372. data/spec/unit/network/http/connection_spec.rb +1 -1
  373. data/spec/unit/network/http/factory_spec.rb +28 -35
  374. data/spec/unit/parser/compiler_spec.rb +0 -8
  375. data/spec/unit/parser/environment_compiler_spec.rb +36 -0
  376. data/spec/unit/parser/functions/create_resources_spec.rb +9 -0
  377. data/spec/unit/parser/functions/inline_template_spec.rb +7 -0
  378. data/spec/unit/parser/functions/realize_spec.rb +9 -0
  379. data/spec/unit/parser/functions/tag_spec.rb +7 -0
  380. data/spec/unit/parser/functions/tagged_spec.rb +25 -0
  381. data/spec/unit/parser/functions/template_spec.rb +8 -0
  382. data/spec/unit/parser/scope_spec.rb +19 -0
  383. data/spec/unit/pops/evaluator/conditionals_spec.rb +1 -1
  384. data/spec/unit/pops/loaders/loader_spec.rb +516 -0
  385. data/spec/unit/pops/loaders/loaders_spec.rb +11 -0
  386. data/spec/unit/pops/loaders/module_loaders_spec.rb +43 -0
  387. data/spec/unit/pops/loaders/static_loader_spec.rb +15 -7
  388. data/spec/unit/pops/model/model_spec.rb +5 -0
  389. data/spec/unit/pops/parser/lexer2_spec.rb +15 -0
  390. data/spec/unit/pops/parser/locator_spec.rb +20 -0
  391. data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +33 -0
  392. data/spec/unit/pops/parser/parse_calls_spec.rb +28 -0
  393. data/spec/unit/pops/parser/parse_conditionals_spec.rb +12 -0
  394. data/spec/unit/pops/parser/parse_plan_spec.rb +48 -0
  395. data/spec/unit/pops/serialization/packer_spec.rb +8 -0
  396. data/spec/unit/pops/serialization/serialization_spec.rb +30 -0
  397. data/spec/unit/pops/serialization/to_from_hr_spec.rb +31 -0
  398. data/spec/unit/pops/types/error_spec.rb +207 -0
  399. data/spec/unit/pops/types/p_init_type_spec.rb +98 -0
  400. data/spec/unit/pops/types/p_object_type_spec.rb +275 -10
  401. data/spec/unit/pops/types/p_uri_type_spec.rb +191 -0
  402. data/spec/unit/pops/types/ruby_generator_spec.rb +82 -44
  403. data/spec/unit/pops/types/task_spec.rb +353 -0
  404. data/spec/unit/pops/types/type_calculator_spec.rb +76 -5
  405. data/spec/unit/pops/types/type_formatter_spec.rb +31 -13
  406. data/spec/unit/pops/types/type_parser_spec.rb +13 -1
  407. data/spec/unit/pops/types/types_spec.rb +60 -0
  408. data/spec/unit/pops/validator/validator_spec.rb +76 -0
  409. data/spec/unit/provider/group/groupadd_spec.rb +77 -1
  410. data/spec/unit/provider/group/pw_spec.rb +4 -4
  411. data/spec/unit/provider/group/windows_adsi_spec.rb +22 -79
  412. data/spec/unit/provider/mount_spec.rb +18 -5
  413. data/spec/unit/provider/nameservice_spec.rb +5 -5
  414. data/spec/unit/provider/package/dnf_spec.rb +2 -2
  415. data/spec/unit/provider/package/gem_spec.rb +1 -1
  416. data/spec/unit/provider/package/pkg_spec.rb +3 -0
  417. data/spec/unit/provider/package/yum_spec.rb +40 -0
  418. data/spec/unit/provider/service/launchd_spec.rb +2 -1
  419. data/spec/unit/provider/service/redhat_spec.rb +5 -0
  420. data/spec/unit/provider/service/systemd_spec.rb +1 -1
  421. data/spec/unit/provider/user/hpux_spec.rb +2 -2
  422. data/spec/unit/provider/user/openbsd_spec.rb +2 -2
  423. data/spec/unit/provider/user/pw_spec.rb +14 -14
  424. data/spec/unit/provider/user/user_role_add_spec.rb +19 -2
  425. data/spec/unit/provider/user/useradd_spec.rb +188 -22
  426. data/spec/unit/provider/user/windows_adsi_spec.rb +4 -4
  427. data/spec/unit/provider/zfs/zfs_spec.rb +55 -1
  428. data/spec/unit/provider_spec.rb +48 -0
  429. data/spec/unit/puppet_pal_2pec.rb +1005 -0
  430. data/spec/unit/puppet_pal_spec.rb +11 -0
  431. data/spec/unit/settings/ini_file_spec.rb +313 -2
  432. data/spec/unit/ssl/certificate_request_spec.rb +42 -1
  433. data/spec/unit/ssl/certificate_revocation_list_spec.rb +2 -1
  434. data/spec/unit/transaction/report_spec.rb +1 -0
  435. data/spec/unit/transaction_spec.rb +112 -21
  436. data/spec/unit/type/file/checksum_spec.rb +20 -0
  437. data/spec/unit/type/file_spec.rb +8 -0
  438. data/spec/unit/type/group_spec.rb +8 -0
  439. data/spec/unit/type/k5login_spec.rb +22 -1
  440. data/spec/unit/type/scheduled_task_spec.rb +15 -0
  441. data/spec/unit/type/user_spec.rb +11 -1
  442. data/spec/unit/type/yumrepo_spec.rb +5 -0
  443. data/spec/unit/util/checksums_spec.rb +3 -3
  444. data/spec/unit/util/log/destinations_spec.rb +14 -0
  445. data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
  446. data/spec/unit/util/plist_spec.rb +3 -3
  447. data/spec/unit/util/windows/adsi_spec.rb +27 -31
  448. data/spec/unit/util/windows/sid_spec.rb +15 -86
  449. data/spec/unit/util_spec.rb +17 -3
  450. data/tasks/manpages.rake +1 -1
  451. metadata +220 -182
  452. data/lib/puppet/bindings.rb +0 -148
  453. data/lib/puppet/configurer/downloader_factory.rb +0 -44
  454. data/spec/unit/configurer/downloader_factory_spec.rb +0 -129
@@ -8,7 +8,7 @@ class PuppetResourceTypeImplInstantiator
8
8
  # given puppet source does not produce such an instance when evaluated.
9
9
  #
10
10
  # @param loader [Loader] The loader the function is associated with
11
- # @param typed_name [TypedName] the type / name of the resoure type impl to load
11
+ # @param typed_name [TypedName] the type / name of the resource type impl to load
12
12
  # @param source_ref [URI, String] a reference to the source / origin of the puppet code to evaluate
13
13
  # @param pp_code_string [String] puppet code in a string
14
14
  #
@@ -20,14 +20,14 @@ class PuppetResourceTypeImplInstantiator
20
20
  # parse and validate
21
21
  model = parser.parse_string(pp_code_string, source_ref)
22
22
  statements = if model.is_a?(Model::Program)
23
- if model.body.is_a?(Model::BlockExpression)
24
- statements = model.body.statements
25
- else
26
- statements = [model.body]
27
- end
28
- else
29
- statements = EMPTY_ARRAY
30
- end
23
+ if model.body.is_a?(Model::BlockExpression)
24
+ model.body.statements
25
+ else
26
+ [model.body]
27
+ end
28
+ else
29
+ EMPTY_ARRAY
30
+ end
31
31
  statements = statements.reject { |s| s.is_a?(Model::Nop) }
32
32
  if statements.empty?
33
33
  raise ArgumentError, _("The code loaded from %{source_ref} does not create the resource type '%{type_name}' - it is empty") % { source_ref: source_ref, type_name: typed_name.name }
@@ -0,0 +1,40 @@
1
+ # The RubyTypeInstantiator instantiates a data type from the ruby source
2
+ # that calls Puppet::DataTypes.create_type.
3
+ #
4
+ class Puppet::Pops::Loader::RubyDataTypeInstantiator
5
+ # Produces an instance of class derived from PAnyType class with the given typed_name, or fails with an error if the
6
+ # given ruby source does not produce this instance when evaluated.
7
+ #
8
+ # @param loader [Puppet::Pops::Loader::Loader] The loader the type is associated with
9
+ # @param typed_name [Puppet::Pops::Loader::TypedName] the type / name of the type to load
10
+ # @param source_ref [URI, String] a reference to the source / origin of the ruby code to evaluate
11
+ # @param ruby_code_string [String] ruby code in a string
12
+ #
13
+ # @return [Puppet::Pops::Types::PAnyType] - an instantiated data type associated with the given loader
14
+ #
15
+ def self.create(loader, typed_name, source_ref, ruby_code_string)
16
+ unless ruby_code_string.is_a?(String) && ruby_code_string =~ /Puppet\:\:DataTypes\.create_type/
17
+ raise ArgumentError, _("The code loaded from %{source_ref} does not seem to be a Puppet 5x API data type - no create_type call.") % { source_ref: source_ref }
18
+ end
19
+ # make the private loader available in a binding to allow it to be passed on
20
+ loader_for_type = loader.private_loader
21
+ here = get_binding(loader_for_type)
22
+ created = eval(ruby_code_string, here, source_ref, 1)
23
+ unless created.is_a?(Puppet::Pops::Types::PAnyType)
24
+ raise ArgumentError, _("The code loaded from %{source_ref} did not produce a data type when evaluated. Got '%{klass}'") % { source_ref: source_ref, klass: created.class }
25
+ end
26
+ unless created.name.casecmp(typed_name.name) == 0
27
+ raise ArgumentError, _("The code loaded from %{source_ref} produced mis-matched name, expected '%{type_name}', got %{created_name}") % { source_ref: source_ref, type_name: typed_name.name, created_name: created.name }
28
+ end
29
+ created
30
+ end
31
+
32
+ private
33
+
34
+ # Produces a binding where the given loader is bound as a local variable (loader_injected_arg). This variable can be used in loaded
35
+ # ruby code - e.g. to call Puppet::Function.create_loaded_function(:name, loader,...)
36
+ #
37
+ def self.get_binding(loader_injected_arg)
38
+ binding
39
+ end
40
+ end
@@ -13,6 +13,11 @@ class Runtime3TypeLoader < BaseLoader
13
13
  @resource_3x_loader = env_path.nil? ? nil : ModuleLoaders.pcore_resource_type_loader_from(parent_loader, loaders, env_path)
14
14
  end
15
15
 
16
+ def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY, &block)
17
+ # TODO: Use generated index of all known types (requires separate utility).
18
+ parent.discover(type, error_collector, name_authority, &block)
19
+ end
20
+
16
21
  def to_s()
17
22
  "(Runtime3TypeLoader '#{loader_name()}')"
18
23
  end
@@ -83,7 +88,7 @@ class Runtime3TypeLoader < BaseLoader
83
88
  end
84
89
  private :find_impl
85
90
 
86
- # Allows shadowing since this loader is populalted with all loaded resource types at time
91
+ # Allows shadowing since this loader is populated with all loaded resource types at time
87
92
  # of loading. This loading will, for built in types override the aliases configured in the static
88
93
  # loader.
89
94
  #
@@ -64,7 +64,7 @@ class StaticLoader < Loader
64
64
  BUILTIN_ALIASES = {
65
65
  'Data' => 'Variant[ScalarData,Undef,Hash[String,Data],Array[Data]]',
66
66
  'RichDataKey' => 'Variant[String,Numeric]',
67
- 'RichData' => 'Variant[Scalar,SemVerRange,Binary,Sensitive,Type,TypeSet,Undef,Default,Hash[RichDataKey,RichData],Array[RichData]]',
67
+ 'RichData' => 'Variant[Scalar,SemVerRange,Binary,Sensitive,Type,TypeSet,URI,Object,Undef,Default,Hash[RichDataKey,RichData],Array[RichData]]',
68
68
 
69
69
  # Backward compatible aliases.
70
70
  'Puppet::LookupKey' => 'RichDataKey',
@@ -74,9 +74,16 @@ class StaticLoader < Loader
74
74
  attr_reader :loaded
75
75
  def initialize
76
76
  @loaded = {}
77
+ @runtime_3_initialized = false
77
78
  create_built_in_types
78
- create_resource_type_references
79
- register_aliases
79
+ end
80
+
81
+ def discover(type, error_collector = nil, name_authority = Pcore::RUNTIME_NAME_AUTHORITY)
82
+ # Static loader only contains runtime types
83
+ return EMPTY_ARRAY unless type == :type && name_authority == name_authority = Pcore::RUNTIME_NAME_AUTHORITY
84
+
85
+ typed_names = type == :type && name_authority == Pcore::RUNTIME_NAME_AUTHORITY ? @loaded.keys : EMPTY_ARRAY
86
+ block_given? ? typed_names.select { |tn| yield(tn) } : typed_names
80
87
  end
81
88
 
82
89
  def load_typed(typed_name)
@@ -108,6 +115,19 @@ class StaticLoader < Loader
108
115
  @loaded[typed_name]
109
116
  end
110
117
 
118
+ def runtime_3_init
119
+ unless @runtime_3_initialized
120
+ @runtime_3_initialized = true
121
+ create_resource_type_references
122
+ end
123
+ nil
124
+ end
125
+
126
+ def register_aliases
127
+ aliases = BUILTIN_ALIASES.map { |name, string| add_type(name, Types::PTypeAliasType.new(name, Types::TypeFactory.type_reference(string), nil)) }
128
+ aliases.each { |type| type.resolve(self) }
129
+ end
130
+
111
131
  private
112
132
 
113
133
  def load_constant(typed_name)
@@ -138,11 +158,6 @@ class StaticLoader < Loader
138
158
  def create_resource_type_reference(name)
139
159
  add_type(name, Types::TypeFactory.resource(name))
140
160
  end
141
-
142
- def register_aliases
143
- aliases = BUILTIN_ALIASES.map { |name, string| add_type(name, Types::PTypeAliasType.new(name, Types::TypeFactory.type_reference(string), nil)) }
144
- aliases.each { |type| type.resolve(self) }
145
- end
146
161
  end
147
162
  end
148
163
  end
@@ -0,0 +1,69 @@
1
+ # The TypeDefinitionInstantiator instantiates a type alias or a type definition
2
+ #
3
+ module Puppet::Pops
4
+ module Loader
5
+ class TaskInstantiator
6
+ def self.create(loader, typed_name, source_refs)
7
+ name = typed_name.name
8
+ metadata = nil
9
+ task_source = nil
10
+ source_refs.each do |source_ref|
11
+ if source_ref.end_with?('.json')
12
+ metadata = source_ref
13
+ elsif task_source.nil?
14
+ task_source = source_ref
15
+ else
16
+ raise ArgumentError, _('Only one file can exists besides the .json file for task %{name} in directory %{directory}') %
17
+ { name: name, directory: File.dirname(source_refs[0]) }
18
+ end
19
+ end
20
+
21
+ if task_source.nil?
22
+ raise ArgumentError, _('No source besides task metadata was found in directory %{directory} for task %{name}') %
23
+ { name: name, directory: File.dirname(source_refs[0]) }
24
+ end
25
+ create_task(loader, name, task_source, metadata)
26
+ end
27
+
28
+ def self.create_task(loader, name, task_source, metadata)
29
+ if metadata.nil?
30
+ create_task_from_hash(loader, name, task_source, EMPTY_HASH)
31
+ else
32
+ json_text = loader.get_contents(metadata)
33
+ begin
34
+ create_task_from_hash(loader, name, task_source, JSON.parse(json_text) || EMPTY_HASH)
35
+ rescue JSON::ParserError => ex
36
+ raise Puppet::ParseError.new(ex.message, metadata)
37
+ rescue Types::TypeAssertionError => ex
38
+ # Not strictly a parser error but from the users perspective, the file content didn't parse properly. The
39
+ # ParserError also conveys file info (even though line is unknown)
40
+ msg = _('Failed to load metadata for task %{name}: %{reason}') % { :name => name, :reason => ex.message }
41
+ raise Puppet::ParseError.new(msg, metadata)
42
+ end
43
+ end
44
+ end
45
+
46
+ def self.create_task_from_hash(loader, name, task_source, hash)
47
+ arguments = {
48
+ 'name' => name,
49
+ 'executable' => task_source
50
+ }
51
+ hash.each_pair do |key, value|
52
+ if 'parameters' == key || 'output' == key
53
+ ps = {}
54
+ value.each_pair do |k, v|
55
+ pd = v.dup
56
+ t = v['type']
57
+ pd['type'] = t.nil? ? Types::TypeFactory.data : Types::TypeParser.singleton.parse(t, loader)
58
+ ps[k] = pd
59
+ end
60
+ value = ps
61
+ end
62
+ arguments[key] = value
63
+ end
64
+
65
+ Types::TypeFactory.task.from_hash(arguments)
66
+ end
67
+ end
68
+ end
69
+ end
@@ -88,6 +88,10 @@ class TypeDefinitionInstantiator
88
88
  def self.named_definition(te)
89
89
  te.is_a?(Model::AccessExpression) && (left = te.left_expr).is_a?(Model::QualifiedReference) ? left.cased_value : nil
90
90
  end
91
+
92
+ def several_paths?
93
+ false
94
+ end
91
95
  end
92
96
  end
93
97
  end
@@ -63,6 +63,15 @@ class Loaders
63
63
  # 4. module loaders are set up from the create_environment_loader, they register themselves
64
64
  end
65
65
 
66
+ # Called after loader has been added to Puppet Context as :loaders so that dynamic types can
67
+ # be pre-loaded with a fully configured loader system
68
+ def pre_load
69
+ @puppet_system_loader.load(:type, 'error')
70
+
71
+ # Will move to Bolt
72
+ @puppet_system_loader.load(:type, 'executionresult')
73
+ end
74
+
66
75
  # Clears the cached static and puppet_system loaders (to enable testing)
67
76
  #
68
77
  def self.clear
@@ -84,7 +93,11 @@ class Loaders
84
93
 
85
94
  def self.static_loader
86
95
  # The static loader can only be changed after a reboot
87
- @@static_loader ||= Loader::StaticLoader.new()
96
+ if !class_variable_defined?(:@@static_loader) || @@static_loader.nil?
97
+ @@static_loader = Loader::StaticLoader.new()
98
+ @@static_loader.register_aliases
99
+ end
100
+ @@static_loader
88
101
  end
89
102
 
90
103
  def self.implementation_registry
@@ -93,7 +106,7 @@ class Loaders
93
106
  end
94
107
 
95
108
  def register_implementations(obj_classes, name_authority)
96
- self.class.register_implementations_with_loader(obj_classes, name_authority, loader = @private_environment_loader)
109
+ self.class.register_implementations_with_loader(obj_classes, name_authority, @private_environment_loader)
97
110
  end
98
111
 
99
112
  # Register implementations using the global static loader
@@ -233,8 +246,101 @@ class Loaders
233
246
  @loaders_by_name[name] = loader
234
247
  end
235
248
 
249
+ # Load the main manifest for the given environment
250
+ #
251
+ # There are two sources that can be used for the initial parse:
252
+ #
253
+ # 1. The value of `Puppet[:code]`: Puppet can take a string from
254
+ # its settings and parse that as a manifest. This is used by various
255
+ # Puppet applications to read in a manifest and pass it to the
256
+ # environment as a side effect. This is attempted first.
257
+ # 2. The contents of the environment's +manifest+ attribute: Puppet will
258
+ # try to load the environment manifest. The manifest must be a file.
259
+ #
260
+ # @return [Model::Program] The manifest parsed into a model object
261
+ def load_main_manifest
262
+ parser = Parser::EvaluatingParser.singleton
263
+ parsed_code = Puppet[:code]
264
+ program = if parsed_code != ""
265
+ parser.parse_string(parsed_code, 'unknown-source-location')
266
+ else
267
+ file = @environment.manifest
268
+
269
+ # if the manifest file is a reference to a directory, parse and combine
270
+ # all .pp files in that directory
271
+ if file == Puppet::Node::Environment::NO_MANIFEST
272
+ nil
273
+ elsif File.directory?(file)
274
+ raise Puppet::Error, "manifest of environment '#{@environment.name}' appoints directory '#{file}'. It must be a file"
275
+ elsif File.exists?(file)
276
+ parser.parse_file(file)
277
+ else
278
+ raise Puppet::Error, "manifest of environment '#{@environment.name}' appoints '#{file}'. It does not exist"
279
+ end
280
+ end
281
+ instantiate_definitions(program, public_environment_loader) unless program.nil?
282
+ program
283
+ rescue Puppet::ParseErrorWithIssue => detail
284
+ detail.environment = @environment.name
285
+ raise
286
+ rescue => detail
287
+ msg = _('Could not parse for environment %{env}: %{detail}') % { env: @environment, detail: detail }
288
+ error = Puppet::Error.new(msg)
289
+ error.set_backtrace(detail.backtrace)
290
+ raise error
291
+ end
292
+
293
+ # Add 4.x definitions found in the given program to the given loader.
294
+ def instantiate_definitions(program, loader)
295
+ program.definitions.each { |d| instantiate_definition(d, loader) }
296
+ nil
297
+ end
298
+
299
+ # Add given 4.x definition to the given loader.
300
+ def instantiate_definition(definition, loader)
301
+ case definition
302
+ when Model::PlanDefinition
303
+ instantiate_PlanDefinition(definition, loader)
304
+ when Model::FunctionDefinition
305
+ instantiate_FunctionDefinition(definition, loader)
306
+ when Model::TypeAlias
307
+ instantiate_TypeAlias(definition, loader)
308
+ when Model::TypeMapping
309
+ instantiate_TypeMapping(definition, loader)
310
+ else
311
+ raise Puppet::ParseError, "Internal Error: Unknown type of definition - got '#{definition.class}'"
312
+ end
313
+ end
314
+
236
315
  private
237
316
 
317
+ def instantiate_PlanDefinition(plan_definition, loader)
318
+ typed_name, f = Loader::PuppetPlanInstantiator.create_from_model(plan_definition, loader)
319
+ loader.set_entry(typed_name, f, plan_definition.locator.to_uri(plan_definition))
320
+ nil
321
+ end
322
+
323
+ def instantiate_FunctionDefinition(function_definition, loader)
324
+ # Instantiate Function, and store it in the loader
325
+ typed_name, f = Loader::PuppetFunctionInstantiator.create_from_model(function_definition, loader)
326
+ loader.set_entry(typed_name, f, function_definition.locator.to_uri(function_definition))
327
+ nil
328
+ end
329
+
330
+ def instantiate_TypeAlias(type_alias, loader)
331
+ # Bind the type alias to the loader using the alias
332
+ Puppet::Pops::Loader::TypeDefinitionInstantiator.create_from_model(type_alias, loader)
333
+ nil
334
+ end
335
+
336
+ def instantiate_TypeMapping(type_mapping, loader)
337
+ tf = Types::TypeParser.singleton
338
+ lhs = tf.interpret(type_mapping.type_expr, loader)
339
+ rhs = tf.interpret_any(type_mapping.mapping_expr, loader)
340
+ implementation_registry.register_type_mapping(lhs, rhs, loader)
341
+ nil
342
+ end
343
+
238
344
  def create_puppet_system_loader()
239
345
  Loader::ModuleLoaders.system_loader_from(static_loader, self)
240
346
  end
@@ -259,15 +365,20 @@ class Loaders
259
365
  env_conf = Puppet.lookup(:environments).get_conf(environment.name)
260
366
  env_path = env_conf.nil? || !env_conf.is_a?(Puppet::Settings::EnvironmentConf) ? nil : env_conf.path_to_env
261
367
 
262
- # Create the 3.x resource type loader
263
- @runtime3_type_loader = add_loader_by_name(Loader::Runtime3TypeLoader.new(puppet_system_loader, self, environment, env_conf.nil? ? nil : env_path))
264
-
265
- if env_path.nil?
266
- # Not a real directory environment, cannot work as a module TODO: Drop when legacy env are dropped?
267
- loader = add_loader_by_name(Loader::SimpleEnvironmentLoader.new(@runtime3_type_loader, Loader::ENVIRONMENT))
368
+ if Puppet[:tasks]
369
+ loader = Loader::ModuleLoaders.environment_loader_from(puppet_system_loader, self, env_path)
268
370
  else
269
- # View the environment as a module to allow loading from it - this module is always called 'environment'
270
- loader = Loader::ModuleLoaders.environment_loader_from(@runtime3_type_loader, self, env_path)
371
+ # Create the 3.x resource type loader
372
+ static_loader.runtime_3_init
373
+ @runtime3_type_loader = add_loader_by_name(Loader::Runtime3TypeLoader.new(puppet_system_loader, self, environment, env_conf.nil? ? nil : env_path))
374
+
375
+ if env_path.nil?
376
+ # Not a real directory environment, cannot work as a module TODO: Drop when legacy env are dropped?
377
+ loader = add_loader_by_name(Loader::SimpleEnvironmentLoader.new(@runtime3_type_loader, Loader::ENVIRONMENT))
378
+ else
379
+ # View the environment as a module to allow loading from it - this module is always called 'environment'
380
+ loader = Loader::ModuleLoaders.environment_loader_from(@runtime3_type_loader, self, env_path)
381
+ end
271
382
  end
272
383
 
273
384
  # An environment has a module path even if it has a null loader
@@ -383,7 +494,7 @@ class Loaders
383
494
  nil
384
495
  else
385
496
  module_data.private_loader =
386
- if module_data.restrict_to_dependencies?
497
+ if module_data.restrict_to_dependencies? && !Puppet[:tasks]
387
498
  create_loader_with_only_dependencies_visible(module_data)
388
499
  else
389
500
  create_loader_with_all_modules_visible(module_data)
@@ -71,7 +71,7 @@ class V3BackendFunctionProvider < DataDigFunctionProvider
71
71
  # A merge_behavior retrieved from hiera.yaml must not be converted here. Instead, passing the symbol :hash
72
72
  # tells the V3 backend to pick it up from the config.
73
73
  resolution_type = lookup_invocation.hiera_v3_merge_behavior? ? :hash : convert_merge(merge)
74
- @backend.lookup(key.to_s, lookup_invocation.scope, lookup_invocation.hiera_v3_location_overrides, resolution_type, context = {:recurse_guard => nil})
74
+ @backend.lookup(key.to_s, lookup_invocation.scope, lookup_invocation.hiera_v3_location_overrides, resolution_type, {:recurse_guard => nil})
75
75
  end
76
76
 
77
77
  def full_name
@@ -125,7 +125,7 @@ module Interpolation
125
125
  interpolate_method
126
126
  end
127
127
 
128
- # Because the semanitcs of Puppet::Parser::Scope#include? differs from Hash#include?
128
+ # Because the semantics of Puppet::Parser::Scope#include? differs from Hash#include?
129
129
  def nil_in_scope?(scope, key)
130
130
  if scope.is_a?(Hash)
131
131
  scope.include?(key)
@@ -48,7 +48,6 @@ class LookupAdapter < DataAdapter
48
48
 
49
49
  key = LookupKey.new(key)
50
50
  lookup_invocation.lookup(key, key.module_name) do
51
- merge_explained = false
52
51
  if lookup_invocation.only_explain_options?
53
52
  catch(:no_such_key) { do_lookup(LookupKey::LOOKUP_OPTIONS, lookup_invocation, HASH) }
54
53
  nil
@@ -377,6 +377,9 @@ type Puppet::AST = TypeSet[{
377
377
  }
378
378
  }
379
379
  }],
380
+ PlanDefinition => Object[{
381
+ parent => FunctionDefinition,
382
+ }],
380
383
  LambdaExpression => Object[{
381
384
  parent => Expression,
382
385
  attributes => {