puppet 3.5.1-x86-mingw32 → 3.6.0.rc1-x86-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 (342) hide show
  1. data/CONTRIBUTING.md +5 -0
  2. data/Gemfile +17 -9
  3. data/README.md +1 -0
  4. data/conf/fileserver.conf +4 -3
  5. data/ext/README.environment +8 -0
  6. data/ext/build_defaults.yaml +1 -1
  7. data/ext/debian/control +2 -2
  8. data/ext/debian/puppet-common.dirs +4 -0
  9. data/ext/debian/rules +4 -0
  10. data/ext/emacs/puppet-mode-init.el +1 -1
  11. data/ext/emacs/puppet-mode.el +36 -17
  12. data/ext/redhat/client.init +3 -3
  13. data/ext/redhat/puppet.spec.erb +9 -0
  14. data/ext/systemd/puppet.service +3 -4
  15. data/ext/systemd/puppetmaster.service +1 -3
  16. data/install.rb +1 -1
  17. data/lib/puppet.rb +2 -1
  18. data/lib/puppet/agent.rb +1 -1
  19. data/lib/puppet/application.rb +17 -17
  20. data/lib/puppet/application/doc.rb +1 -1
  21. data/lib/puppet/configurer.rb +4 -1
  22. data/lib/puppet/configurer/downloader.rb +13 -12
  23. data/lib/puppet/configurer/plugin_handler.rb +3 -3
  24. data/lib/puppet/context.rb +6 -1
  25. data/lib/puppet/defaults.rb +82 -12
  26. data/lib/puppet/environments.rb +169 -13
  27. data/lib/puppet/external/nagios/grammar.ry +2 -0
  28. data/lib/puppet/external/nagios/parser.rb +28 -19
  29. data/lib/puppet/face/config.rb +19 -6
  30. data/lib/puppet/face/module/generate.rb +209 -7
  31. data/lib/puppet/face/module/install.rb +17 -16
  32. data/lib/puppet/face/module/list.rb +83 -82
  33. data/lib/puppet/face/module/search.rb +1 -1
  34. data/lib/puppet/face/module/upgrade.rb +10 -9
  35. data/lib/puppet/face/parser.rb +3 -2
  36. data/lib/puppet/face/plugin.rb +8 -4
  37. data/lib/puppet/file_bucket/dipper.rb +6 -3
  38. data/lib/puppet/file_bucket/file.rb +4 -2
  39. data/lib/puppet/file_serving/metadata.rb +1 -1
  40. data/lib/puppet/file_system/memory_file.rb +27 -1
  41. data/lib/puppet/file_system/memory_impl.rb +15 -1
  42. data/lib/puppet/forge.rb +148 -52
  43. data/lib/puppet/forge/cache.rb +5 -1
  44. data/lib/puppet/forge/errors.rb +10 -0
  45. data/lib/puppet/forge/repository.rb +61 -26
  46. data/lib/puppet/functions.rb +548 -0
  47. data/lib/puppet/functions/assert_type.rb +42 -0
  48. data/lib/puppet/functions/import.rb +7 -0
  49. data/lib/puppet/indirector/facts/facter.rb +1 -1
  50. data/lib/puppet/indirector/file_bucket_file/file.rb +3 -2
  51. data/lib/puppet/indirector/rest.rb +18 -0
  52. data/lib/puppet/loaders.rb +20 -0
  53. data/lib/puppet/module.rb +2 -2
  54. data/lib/puppet/module_tool.rb +40 -14
  55. data/lib/puppet/module_tool/applications.rb +0 -1
  56. data/lib/puppet/module_tool/applications/application.rb +35 -26
  57. data/lib/puppet/module_tool/applications/builder.rb +16 -6
  58. data/lib/puppet/module_tool/applications/checksummer.rb +25 -19
  59. data/lib/puppet/module_tool/applications/installer.rb +196 -35
  60. data/lib/puppet/module_tool/applications/searcher.rb +1 -0
  61. data/lib/puppet/module_tool/applications/uninstaller.rb +7 -1
  62. data/lib/puppet/module_tool/applications/unpacker.rb +57 -31
  63. data/lib/puppet/module_tool/applications/upgrader.rb +221 -65
  64. data/lib/puppet/module_tool/checksums.rb +5 -8
  65. data/lib/puppet/module_tool/errors/installer.rb +12 -44
  66. data/lib/puppet/module_tool/errors/shared.rb +84 -11
  67. data/lib/puppet/module_tool/errors/upgrader.rb +16 -45
  68. data/lib/puppet/module_tool/install_directory.rb +7 -6
  69. data/lib/puppet/module_tool/installed_modules.rb +92 -0
  70. data/lib/puppet/module_tool/local_tarball.rb +91 -0
  71. data/lib/puppet/module_tool/metadata.rb +119 -115
  72. data/lib/puppet/module_tool/modulefile.rb +9 -9
  73. data/lib/puppet/module_tool/shared_behaviors.rb +19 -7
  74. data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +79 -0
  75. data/lib/puppet/module_tool/skeleton/templates/generator/Rakefile +18 -0
  76. data/lib/puppet/module_tool/skeleton/templates/generator/metadata.json.erb +1 -0
  77. data/lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb +7 -0
  78. data/lib/puppet/module_tool/tar.rb +3 -7
  79. data/lib/puppet/module_tool/tar/gnu.rb +21 -9
  80. data/lib/puppet/module_tool/tar/mini.rb +2 -8
  81. data/lib/puppet/network/http/api/v1.rb +1 -1
  82. data/lib/puppet/network/http/api/v2/authorization.rb +4 -2
  83. data/lib/puppet/network/http/issues.rb +1 -0
  84. data/lib/puppet/network/http_pool.rb +15 -6
  85. data/lib/puppet/node/environment.rb +91 -20
  86. data/lib/puppet/parser/ast/pops_bridge.rb +44 -3
  87. data/lib/puppet/parser/collector.rb +1 -1
  88. data/lib/puppet/parser/compiler.rb +50 -7
  89. data/lib/puppet/parser/functions.rb +6 -0
  90. data/lib/puppet/parser/functions/generate.rb +1 -1
  91. data/lib/puppet/parser/resource.rb +1 -1
  92. data/lib/puppet/pops.rb +22 -1
  93. data/lib/puppet/pops/adapters.rb +8 -1
  94. data/lib/puppet/pops/binder/bindings_composer.rb +1 -1
  95. data/lib/puppet/pops/binder/bindings_factory.rb +1 -1
  96. data/lib/puppet/pops/binder/config/binder_config_checker.rb +1 -1
  97. data/lib/puppet/pops/binder/producers.rb +2 -2
  98. data/lib/puppet/pops/evaluator/access_operator.rb +65 -25
  99. data/lib/puppet/pops/evaluator/callable_signature.rb +101 -0
  100. data/lib/puppet/pops/evaluator/closure.rb +57 -2
  101. data/lib/puppet/pops/evaluator/compare_operator.rb +1 -1
  102. data/lib/puppet/pops/evaluator/evaluator_impl.rb +9 -11
  103. data/lib/puppet/pops/evaluator/runtime3_support.rb +72 -21
  104. data/lib/puppet/pops/functions/dispatch.rb +71 -0
  105. data/lib/puppet/pops/functions/dispatcher.rb +237 -0
  106. data/lib/puppet/pops/functions/function.rb +77 -0
  107. data/lib/puppet/pops/issues.rb +12 -0
  108. data/lib/puppet/pops/loader/base_loader.rb +102 -0
  109. data/lib/puppet/pops/loader/dependency_loader.rb +60 -0
  110. data/lib/puppet/pops/loader/gem_support.rb +49 -0
  111. data/lib/puppet/pops/loader/loader.rb +180 -0
  112. data/lib/puppet/pops/loader/loader_paths.rb +137 -0
  113. data/lib/puppet/pops/loader/module_loaders.rb +242 -0
  114. data/lib/puppet/pops/loader/null_loader.rb +44 -0
  115. data/lib/puppet/pops/loader/ruby_function_instantiator.rb +34 -0
  116. data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +109 -0
  117. data/lib/puppet/pops/loader/simple_environment_loader.rb +20 -0
  118. data/lib/puppet/pops/loader/static_loader.rb +69 -0
  119. data/lib/puppet/pops/loader/uri_helper.rb +22 -0
  120. data/lib/puppet/pops/loaders.rb +240 -0
  121. data/lib/puppet/pops/model/factory.rb +13 -5
  122. data/lib/puppet/pops/model/model_tree_dumper.rb +12 -4
  123. data/lib/puppet/pops/parser/egrammar.ra +31 -18
  124. data/lib/puppet/pops/parser/eparser.rb +1137 -1106
  125. data/lib/puppet/pops/parser/lexer2.rb +17 -16
  126. data/lib/puppet/pops/semantic_error.rb +17 -0
  127. data/lib/puppet/pops/types/type_calculator.rb +150 -15
  128. data/lib/puppet/pops/types/type_factory.rb +69 -0
  129. data/lib/puppet/pops/types/type_parser.rb +9 -0
  130. data/lib/puppet/pops/types/types.rb +65 -4
  131. data/lib/puppet/pops/validation/checker4_0.rb +1 -1
  132. data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -1
  133. data/lib/puppet/property/list.rb +1 -1
  134. data/lib/puppet/provider/augeas/augeas.rb +2 -2
  135. data/lib/puppet/provider/cron/crontab.rb +13 -2
  136. data/lib/puppet/provider/package.rb +24 -0
  137. data/lib/puppet/provider/package/apt.rb +6 -1
  138. data/lib/puppet/provider/package/gem.rb +8 -2
  139. data/lib/puppet/provider/package/msi.rb +0 -15
  140. data/lib/puppet/provider/package/openbsd.rb +0 -24
  141. data/lib/puppet/provider/package/rpm.rb +3 -29
  142. data/lib/puppet/provider/package/windows.rb +0 -15
  143. data/lib/puppet/provider/package/yum.rb +101 -24
  144. data/lib/puppet/provider/package/yumhelper.py +31 -1
  145. data/lib/puppet/provider/package/zypper.rb +10 -28
  146. data/lib/puppet/provider/service/debian.rb +1 -1
  147. data/lib/puppet/provider/service/init.rb +3 -0
  148. data/lib/puppet/provider/service/openbsd.rb +318 -0
  149. data/lib/puppet/provider/service/redhat.rb +6 -3
  150. data/lib/puppet/provider/service/systemd.rb +2 -2
  151. data/lib/puppet/provider/yumrepo/inifile.rb +115 -42
  152. data/lib/puppet/resource.rb +13 -9
  153. data/lib/puppet/resource/catalog.rb +12 -6
  154. data/lib/puppet/resource/type_collection.rb +3 -3
  155. data/lib/puppet/settings.rb +57 -36
  156. data/lib/puppet/settings/config_file.rb +5 -0
  157. data/lib/puppet/settings/environment_conf.rb +147 -0
  158. data/lib/puppet/settings/ttl_setting.rb +48 -0
  159. data/lib/puppet/ssl/certificate_authority.rb +2 -3
  160. data/lib/puppet/ssl/certificate_authority/autosign_command.rb +1 -1
  161. data/lib/puppet/ssl/certificate_request.rb +4 -4
  162. data/lib/puppet/ssl/validator/default_validator.rb +2 -2
  163. data/lib/puppet/status.rb +1 -1
  164. data/lib/puppet/test/test_helper.rb +1 -0
  165. data/lib/puppet/type/augeas.rb +13 -1
  166. data/lib/puppet/type/cron.rb +32 -18
  167. data/lib/puppet/type/file.rb +4 -2
  168. data/lib/puppet/type/file/checksum.rb +15 -5
  169. data/lib/puppet/type/file/content.rb +3 -1
  170. data/lib/puppet/type/file/source.rb +5 -5
  171. data/lib/puppet/type/package.rb +12 -17
  172. data/lib/puppet/type/resources.rb +3 -1
  173. data/lib/puppet/type/scheduled_task.rb +4 -5
  174. data/lib/puppet/type/service.rb +12 -2
  175. data/lib/puppet/type/user.rb +106 -0
  176. data/lib/puppet/type/yumrepo.rb +9 -1
  177. data/lib/puppet/util/checksums.rb +60 -1
  178. data/lib/puppet/util/diff.rb +3 -1
  179. data/lib/puppet/util/execution.rb +20 -16
  180. data/lib/puppet/util/feature.rb +3 -0
  181. data/lib/puppet/util/logging.rb +19 -12
  182. data/lib/puppet/util/rubygems.rb +10 -0
  183. data/lib/puppet/util/watched_file.rb +1 -1
  184. data/lib/puppet/util/windows/security.rb +5 -3
  185. data/lib/puppet/vendor/load_semantic.rb +1 -0
  186. data/lib/puppet/vendor/require_vendored.rb +2 -0
  187. data/lib/puppet/vendor/semantic/Gemfile +20 -0
  188. data/lib/puppet/vendor/semantic/Rakefile +69 -0
  189. data/lib/puppet/vendor/semantic/lib/semantic.rb +7 -0
  190. data/lib/puppet/vendor/semantic/lib/semantic/dependency.rb +181 -0
  191. data/lib/puppet/vendor/semantic/lib/semantic/dependency/graph.rb +60 -0
  192. data/lib/puppet/vendor/semantic/lib/semantic/dependency/graph_node.rb +117 -0
  193. data/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb +46 -0
  194. data/lib/puppet/vendor/semantic/lib/semantic/dependency/source.rb +25 -0
  195. data/lib/puppet/vendor/semantic/lib/semantic/dependency/unsatisfiable_graph.rb +31 -0
  196. data/lib/puppet/vendor/semantic/lib/semantic/version.rb +168 -0
  197. data/lib/puppet/vendor/semantic/lib/semantic/version_range.rb +424 -0
  198. data/lib/puppet/vendor/semantic/spec/spec_helper.rb +24 -0
  199. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_node_spec.rb +141 -0
  200. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_spec.rb +162 -0
  201. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/module_release_spec.rb +143 -0
  202. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/source_spec.rb +5 -0
  203. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/unsatisfiable_graph_spec.rb +44 -0
  204. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency_spec.rb +383 -0
  205. data/lib/puppet/vendor/semantic/spec/unit/semantic/version_range_spec.rb +307 -0
  206. data/lib/puppet/vendor/semantic/spec/unit/semantic/version_spec.rb +608 -0
  207. data/lib/puppet/version.rb +1 -1
  208. data/spec/fixtures/java.tgz +0 -0
  209. data/spec/fixtures/stdlib.tgz +0 -0
  210. data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/usee/lib/puppet/functions/usee/callee.rb +5 -0
  211. data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/user/lib/puppet/functions/user/caller.rb +5 -0
  212. data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/user/metadata.json +9 -0
  213. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/modulea/rb_func_a.rb +5 -0
  214. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/rb_func_a.rb +5 -0
  215. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/manifests/init.pp +3 -0
  216. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/metadata.json +19 -0
  217. data/spec/fixtures/unit/pops/loaders/loaders/wo_metadata_module/modules/moduleb/lib/puppet/functions/moduleb/rb_func_b.rb +6 -0
  218. data/spec/fixtures/unit/pops/loaders/loaders/wo_metadata_module/modules/moduleb/manifests/init.pp +3 -0
  219. data/spec/fixtures/unit/provider/naginator/define_empty_param +6 -0
  220. data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services +7 -0
  221. data/spec/fixtures/unit/type/user/authorized_keys +5 -0
  222. data/spec/integration/application/apply_spec.rb +1 -2
  223. data/spec/integration/configurer_spec.rb +2 -2
  224. data/spec/integration/faces/plugin_spec.rb +62 -0
  225. data/spec/integration/indirector/catalog/compiler_spec.rb +1 -1
  226. data/spec/integration/indirector/catalog/queue_spec.rb +1 -1
  227. data/spec/integration/node/environment_spec.rb +2 -2
  228. data/spec/integration/parser/future_compiler_spec.rb +96 -142
  229. data/spec/integration/parser/ruby_manifest_spec.rb +0 -5
  230. data/spec/integration/provider/cron/crontab_spec.rb +35 -0
  231. data/spec/integration/type/file_spec.rb +74 -72
  232. data/spec/integration/util/windows/security_spec.rb +17 -0
  233. data/spec/lib/matchers/resource.rb +45 -13
  234. data/spec/lib/puppet_spec/files.rb +18 -0
  235. data/spec/lib/puppet_spec/module_tool/shared_functions.rb +56 -0
  236. data/spec/lib/puppet_spec/module_tool/stub_source.rb +133 -0
  237. data/spec/shared_contexts/checksums.rb +55 -0
  238. data/spec/unit/application/apply_spec.rb +10 -7
  239. data/spec/unit/application/doc_spec.rb +17 -10
  240. data/spec/unit/application/indirection_base_spec.rb +18 -10
  241. data/spec/unit/application/inspect_spec.rb +22 -20
  242. data/spec/unit/configurer/downloader_spec.rb +7 -6
  243. data/spec/unit/configurer/plugin_handler_spec.rb +5 -8
  244. data/spec/unit/configurer_spec.rb +1 -1
  245. data/spec/unit/context_spec.rb +23 -0
  246. data/spec/unit/environments_spec.rb +274 -16
  247. data/spec/unit/face/config_spec.rb +111 -11
  248. data/spec/unit/face/module/install_spec.rb +14 -85
  249. data/spec/unit/face/module/list_spec.rb +108 -62
  250. data/spec/unit/face/module/search_spec.rb +1 -1
  251. data/spec/unit/face/module/uninstall_spec.rb +21 -42
  252. data/spec/unit/face/parser_spec.rb +5 -2
  253. data/spec/unit/file_bucket/dipper_spec.rb +92 -86
  254. data/spec/unit/file_bucket/file_spec.rb +23 -75
  255. data/spec/unit/file_serving/metadata_spec.rb +74 -74
  256. data/spec/unit/forge/module_release_spec.rb +131 -0
  257. data/spec/unit/forge/repository_spec.rb +21 -20
  258. data/spec/unit/forge_spec.rb +99 -23
  259. data/spec/unit/functions/assert_type_spec.rb +59 -0
  260. data/spec/unit/functions4_spec.rb +671 -0
  261. data/spec/unit/indirector/catalog/static_compiler_spec.rb +2 -2
  262. data/spec/unit/indirector/facts/facter_spec.rb +9 -3
  263. data/spec/unit/indirector/file_bucket_file/file_spec.rb +156 -155
  264. data/spec/unit/indirector/rest_spec.rb +8 -0
  265. data/spec/unit/interface/face_collection_spec.rb +35 -23
  266. data/spec/unit/module_spec.rb +20 -8
  267. data/spec/unit/module_tool/applications/builder_spec.rb +40 -12
  268. data/spec/unit/module_tool/applications/checksummer_spec.rb +86 -105
  269. data/spec/unit/module_tool/applications/installer_spec.rb +293 -261
  270. data/spec/unit/module_tool/applications/searcher_spec.rb +1 -1
  271. data/spec/unit/module_tool/applications/uninstaller_spec.rb +90 -154
  272. data/spec/unit/module_tool/applications/unpacker_spec.rb +12 -12
  273. data/spec/unit/module_tool/applications/upgrader_spec.rb +286 -18
  274. data/spec/unit/module_tool/metadata_spec.rb +223 -14
  275. data/spec/unit/module_tool/tar/gnu_spec.rb +12 -9
  276. data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
  277. data/spec/unit/module_tool/tar_spec.rb +4 -18
  278. data/spec/unit/module_tool_spec.rb +123 -27
  279. data/spec/unit/network/formats_spec.rb +2 -2
  280. data/spec/unit/network/http_pool_spec.rb +21 -0
  281. data/spec/unit/network/rights_spec.rb +10 -8
  282. data/spec/unit/node/environment_spec.rb +27 -2
  283. data/spec/unit/parser/collector_spec.rb +1 -1
  284. data/spec/unit/parser/compiler_spec.rb +1 -1
  285. data/spec/unit/parser/functions/generate_spec.rb +4 -0
  286. data/spec/unit/pops/evaluator/access_ops_spec.rb +50 -11
  287. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +25 -0
  288. data/spec/unit/pops/loaders/dependency_loader_spec.rb +44 -0
  289. data/spec/unit/pops/loaders/loader_paths_spec.rb +66 -0
  290. data/spec/unit/pops/loaders/loaders_spec.rb +105 -0
  291. data/spec/unit/pops/loaders/module_loaders_spec.rb +119 -0
  292. data/spec/unit/pops/loaders/static_loader_spec.rb +46 -0
  293. data/spec/unit/pops/types/type_calculator_spec.rb +145 -10
  294. data/spec/unit/pops/types/type_factory_spec.rb +101 -0
  295. data/spec/unit/pops/types/type_parser_spec.rb +22 -0
  296. data/spec/unit/property/list_spec.rb +9 -1
  297. data/spec/unit/provider/augeas/augeas_spec.rb +58 -11
  298. data/spec/unit/provider/cron/crontab_spec.rb +1 -0
  299. data/spec/unit/provider/cron/parsed_spec.rb +15 -0
  300. data/spec/unit/provider/naginator_spec.rb +14 -0
  301. data/spec/unit/provider/package/apt_spec.rb +78 -64
  302. data/spec/unit/provider/package/gem_spec.rb +15 -0
  303. data/spec/unit/provider/package/rpm_spec.rb +6 -6
  304. data/spec/unit/provider/package/windows_spec.rb +1 -1
  305. data/spec/unit/provider/package/yum_spec.rb +199 -104
  306. data/spec/unit/provider/package/zypper_spec.rb +41 -15
  307. data/spec/unit/provider/service/openbsd_spec.rb +129 -22
  308. data/spec/unit/provider/service/redhat_spec.rb +18 -4
  309. data/spec/unit/provider/service/systemd_spec.rb +5 -9
  310. data/spec/unit/provider/service/upstart_spec.rb +1 -1
  311. data/spec/unit/provider/user/directoryservice_spec.rb +10 -0
  312. data/spec/unit/provider/yumrepo/inifile_spec.rb +171 -15
  313. data/spec/unit/resource/catalog_spec.rb +20 -104
  314. data/spec/unit/resource/type_collection_spec.rb +10 -9
  315. data/spec/unit/settings/config_file_spec.rb +29 -6
  316. data/spec/unit/settings/environment_conf_spec.rb +51 -0
  317. data/spec/unit/settings_spec.rb +97 -12
  318. data/spec/unit/ssl/certificate_authority_spec.rb +2 -0
  319. data/spec/unit/type/augeas_spec.rb +1 -1
  320. data/spec/unit/type/cron_spec.rb +6 -7
  321. data/spec/unit/type/file/checksum_spec.rb +6 -0
  322. data/spec/unit/type/file/content_spec.rb +277 -207
  323. data/spec/unit/type/file_spec.rb +9 -7
  324. data/spec/unit/type/user_spec.rb +106 -18
  325. data/spec/unit/type/yumrepo_spec.rb +8 -0
  326. data/spec/unit/util/checksums_spec.rb +12 -5
  327. data/spec/unit/util/diff_spec.rb +8 -0
  328. data/spec/unit/util/execution_spec.rb +4 -4
  329. data/spec/unit/util/feature_spec.rb +2 -0
  330. data/spec/unit/util/logging_spec.rb +14 -4
  331. data/spec/unit/util/rdoc/parser_spec.rb +5 -4
  332. data/spec/unit/util/rubygems_spec.rb +14 -0
  333. data/tasks/parallel.rake +2 -2
  334. metadata +154 -21
  335. checksums.yaml +0 -7
  336. data/lib/puppet/module_tool/applications/generator.rb +0 -142
  337. data/lib/puppet/module_tool/skeleton.rb +0 -37
  338. data/lib/puppet/module_tool/skeleton/templates/generator/Modulefile.erb +0 -11
  339. data/lib/puppet/module_tool/skeleton/templates/generator/README.erb +0 -16
  340. data/lib/puppet/module_tool/tar/solaris.rb +0 -5
  341. data/spec/fixtures/unit/provider/service/systemd/list_units_services +0 -17
  342. data/spec/unit/module_tool/tar/solaris_spec.rb +0 -22
@@ -55,6 +55,13 @@ class Puppet::Parser::AST::PopsBridge
55
55
  end
56
56
  end
57
57
 
58
+ class NilAsUndefExpression < Expression
59
+ def evaluate(scope)
60
+ result = super
61
+ result.nil? ? :undef : result
62
+ end
63
+ end
64
+
58
65
  # Bridges the top level "Program" produced by the pops parser.
59
66
  # Its main purpose is to give one point where all definitions are instantiated (actually defined since the
60
67
  # Puppet 3x terminology is somewhat misleading - the definitions are instantiated, but instances of the created types
@@ -85,9 +92,10 @@ class Puppet::Parser::AST::PopsBridge
85
92
  when Puppet::Pops::Model::NodeDefinition
86
93
  instantiate_NodeDefinition(d, modname)
87
94
  else
88
- raise Puppet::ParseError("Internal Error: Unknown type of definition - got '#{d.class}'")
95
+ raise Puppet::ParseError, "Internal Error: Unknown type of definition - got '#{d.class}'"
89
96
  end
90
- end.flatten() # flatten since node definition may have returned an array
97
+ end.flatten().compact() # flatten since node definition may have returned an array
98
+ # Compact since functions are not understood by compiler
91
99
  end
92
100
 
93
101
  def evaluate(scope)
@@ -109,7 +117,7 @@ class Puppet::Parser::AST::PopsBridge
109
117
  # can thus reference all sorts of information. Here the value expression is wrapped in an AST Bridge to a Pops
110
118
  # expression since the Pops side can not control the evaluation
111
119
  if o.value
112
- [ o.name, Expression.new(:value => o.value) ]
120
+ [ o.name, NilAsUndefExpression.new(:value => o.value) ]
113
121
  else
114
122
  [ o.name ]
115
123
  end
@@ -155,6 +163,39 @@ class Puppet::Parser::AST::PopsBridge
155
163
  end
156
164
  end
157
165
 
166
+ # Propagates a found Function to the appropriate loader.
167
+ # This is for 4x future-evaluator/loader
168
+ #
169
+ def instantiate_FunctionDefinition(function_definition, modname)
170
+ loaders = (Puppet.lookup(:loaders) { nil })
171
+ unless loaders
172
+ raise Puppet::ParseError, "Internal Error: Puppet Context ':loaders' missing - cannot define any functions"
173
+ end
174
+ loader =
175
+ if modname.nil? || modname == ""
176
+ # TODO : Later when functions can be private, a decision is needed regarding what that means.
177
+ # A private environment loader could be used for logic outside of modules, then only that logic
178
+ # would see the function.
179
+ #
180
+ # Use the private loader, this function may see the environment's dependencies (currently, all modules)
181
+ loaders.private_environment_loader()
182
+ else
183
+ # TODO : Later check if function is private, and then add it to
184
+ # private_loader_for_module
185
+ #
186
+ loaders.public_loader_for_module(modname)
187
+ end
188
+ unless loader
189
+ raise Puppet::ParseError, "Internal Error: did not find public loader for module: '#{modname}'"
190
+ end
191
+
192
+ # Instantiate Function, and store it in the environment loader
193
+ typed_name, f = Puppet::Pops::Loader::PuppetFunctionInstantiator.create_from_model(function_definition, loader)
194
+ loader.set_entry(typed_name, f, Puppet::Pops::Adapters::SourcePosAdapter.adapt(function_definition).to_uri)
195
+
196
+ nil # do not want the function to inadvertently leak into 3x
197
+ end
198
+
158
199
  def code()
159
200
  Expression.new(:value => @value)
160
201
  end
@@ -112,7 +112,7 @@ class Puppet::Parser::Collector
112
112
  unless existing.collector_id == item.collector_id
113
113
  # unless this is the one we've already collected
114
114
  raise Puppet::ParseError,
115
- "Another local or imported resource exists with the type and title #{item.ref}"
115
+ "A duplicate resource was found while collecting exported resources, with the type and title #{item.ref}"
116
116
  end
117
117
  else
118
118
  item.exported = false
@@ -37,6 +37,11 @@ class Puppet::Parser::Compiler
37
37
  #
38
38
  attr_accessor :injector
39
39
 
40
+ # Access to the configured loaders for 4x
41
+ # @return [Puppet::Pops::Loader::Loaders] the configured loaders
42
+ # @api private
43
+ attr_reader :loaders
44
+
40
45
  # The injector that provides lookup services during the creation of the {#injector}.
41
46
  # @return [Puppet::Pops::Binder::Injector, nil] The injector that provides lookup services during injector creation
42
47
  # for this compiler/environment
@@ -98,14 +103,18 @@ class Puppet::Parser::Compiler
98
103
  # Compiler our catalog. This mostly revolves around finding and evaluating classes.
99
104
  # This is the main entry into our catalog.
100
105
  def compile
101
- Puppet.override({ :current_environment => environment }, "For compiling #{node.name}") do
106
+ Puppet.override( @context_overrides , "For compiling #{node.name}") do
107
+ @catalog.environment_instance = environment
108
+
102
109
  # Set the client's parameters into the top scope.
103
110
  Puppet::Util::Profiler.profile("Compile: Set node parameters") { set_node_parameters }
104
111
 
105
112
  Puppet::Util::Profiler.profile("Compile: Created settings scope") { create_settings_scope }
106
113
 
107
114
  if is_binder_active?
108
- Puppet::Util::Profiler.profile("Compile: Created injector") { create_injector }
115
+ # create injector, if not already created - this is for 3x that does not trigger
116
+ # lazy loading of injector via context
117
+ Puppet::Util::Profiler.profile("Compile: Created injector") { injector }
109
118
  end
110
119
 
111
120
  Puppet::Util::Profiler.profile("Compile: Evaluated main") { evaluate_main }
@@ -124,6 +133,23 @@ class Puppet::Parser::Compiler
124
133
  end
125
134
  end
126
135
 
136
+ # Constructs the overrides for the context
137
+ def context_overrides()
138
+ if Puppet[:parser] == 'future'
139
+ require 'puppet/loaders'
140
+ {
141
+ :current_environment => environment,
142
+ :global_scope => @topscope, # 4x placeholder for new global scope
143
+ :loaders => lambda {|| loaders() }, # 4x loaders
144
+ :injector => lambda {|| injector() } # 4x API - via context instead of via compiler
145
+ }
146
+ else
147
+ {
148
+ :current_environment => environment,
149
+ }
150
+ end
151
+ end
152
+
127
153
  def_delegator :@collections, :delete, :delete_collection
128
154
 
129
155
  # Return the node's environment.
@@ -232,6 +258,10 @@ class Puppet::Parser::Compiler
232
258
  @injector
233
259
  end
234
260
 
261
+ def loaders
262
+ @loaders ||= Puppet::Pops::Loaders.new(environment)
263
+ end
264
+
235
265
  def boot_injector
236
266
  create_boot_injector(nil) if @boot_injector.nil?
237
267
  @boot_injector
@@ -471,14 +501,27 @@ class Puppet::Parser::Compiler
471
501
  @relationships = []
472
502
 
473
503
  # For maintaining the relationship between scopes and their resources.
474
- @catalog = Puppet::Resource::Catalog.new(@node.name)
475
- @catalog.version = known_resource_types.version
504
+ @catalog = Puppet::Resource::Catalog.new(@node.name, @node.environment)
476
505
 
477
- @catalog.environment = @node.environment.to_s
478
-
479
- # Create our initial scope and a resource that will evaluate main.
506
+ # MOVED HERE - SCOPE IS NEEDED (MOVE-SCOPE)
507
+ # Create the initial scope, it is needed early
480
508
  @topscope = Puppet::Parser::Scope.new(self)
481
509
 
510
+ # Need to compute overrides here, and remember them, because we are about to
511
+ # enter the magic zone of known_resource_types and intial import.
512
+ # Expensive entries in the context are bound lazily.
513
+ @context_overrides = context_overrides()
514
+
515
+ # This construct ensures that initial import (triggered by instantiating
516
+ # the structure 'known_resource_types') has a configured context
517
+ # It cannot survive the initvars method, and is later reinstated
518
+ # as part of compiling...
519
+ #
520
+ Puppet.override( @context_overrides , "For initializing compiler") do
521
+ # THE MAGIC STARTS HERE ! This triggers parsing, loading etc.
522
+ @catalog.version = known_resource_types.version
523
+ end
524
+
482
525
  @catalog.add_resource(Puppet::Parser::Resource.new("stage", :main, :scope => @topscope))
483
526
 
484
527
  # local resource array to maintain resource ordering
@@ -120,6 +120,12 @@ module Puppet::Parser::Functions
120
120
  #
121
121
  # @api public
122
122
  def self.newfunction(name, options = {}, &block)
123
+ # Short circuit this call when 4x "biff" is in effect to allow the new loader system to load
124
+ # and define the function a different way.
125
+ #
126
+ if Puppet[:biff]
127
+ return Puppet::Pops::Loader::RubyLegacyFunctionInstantiator.legacy_newfunction(name, options, &block)
128
+ end
123
129
  name = name.intern
124
130
  environment = options[:environment] || Puppet.lookup(:current_environment)
125
131
 
@@ -30,7 +30,7 @@ Puppet::Parser::Functions::newfunction(:generate, :arity => -2, :type => :rvalue
30
30
  end
31
31
 
32
32
  begin
33
- Dir.chdir(File.dirname(args[0])) { Puppet::Util::Execution.execute(args) }
33
+ Dir.chdir(File.dirname(args[0])) { Puppet::Util::Execution.execute(args).to_str }
34
34
  rescue Puppet::ExecutionFailure => detail
35
35
  raise Puppet::ParseError, "Failed to execute generator #{args[0]}: #{detail}", detail.backtrace
36
36
  end
@@ -253,7 +253,7 @@ class Puppet::Parser::Resource < Puppet::Resource
253
253
  validate_parameter(name)
254
254
  end
255
255
  rescue => detail
256
- self.fail Puppet::ParseError, detail.to_s, detail
256
+ self.fail Puppet::ParseError, detail.to_s + " on #{self}", detail
257
257
  end
258
258
 
259
259
  def extract_parameters(params)
@@ -1,5 +1,14 @@
1
1
  module Puppet
2
-
2
+ # The Pops language system. This includes the parser, evaluator, AST model, and
3
+ # Binder.
4
+ #
5
+ # @todo Explain how a user should use this to parse and evaluate the puppet
6
+ # language.
7
+ #
8
+ # @note Warning: Pops is still considered experimental, as such the API may
9
+ # change at any time.
10
+ #
11
+ # @api public
3
12
  module Pops
4
13
  require 'puppet/pops/patterns'
5
14
  require 'puppet/pops/utils'
@@ -13,6 +22,7 @@ module Puppet
13
22
  require 'puppet/pops/containment'
14
23
 
15
24
  require 'puppet/pops/issues'
25
+ require 'puppet/pops/semantic_error'
16
26
  require 'puppet/pops/label_provider'
17
27
  require 'puppet/pops/validation'
18
28
  require 'puppet/pops/issue_reporter'
@@ -88,12 +98,23 @@ module Puppet
88
98
  end
89
99
 
90
100
  module Evaluator
101
+ require 'puppet/pops/evaluator/callable_signature'
91
102
  require 'puppet/pops/evaluator/runtime3_support'
92
103
  require 'puppet/pops/evaluator/evaluator_impl'
93
104
  require 'puppet/pops/evaluator/epp_evaluator'
94
105
  end
106
+
107
+ # Subsystem for puppet functions defined in ruby.
108
+ #
109
+ # @api public
110
+ module Functions
111
+ require 'puppet/pops/functions/function'
112
+ require 'puppet/pops/functions/dispatch'
113
+ require 'puppet/pops/functions/dispatcher'
114
+ end
95
115
  end
96
116
 
97
117
  require 'puppet/parser/ast/pops_bridge'
98
118
  require 'puppet/bindings'
119
+ require 'puppet/functions'
99
120
  end
@@ -83,6 +83,13 @@ module Puppet::Pops::Adapters
83
83
  def extract_text
84
84
  locator.string.slice(offset, length)
85
85
  end
86
+
87
+ # Produces an URI with path?line=n&pos=n. If origin is unknown the URI is string:?line=n&pos=n
88
+ def to_uri
89
+ f = locator.file
90
+ f = 'string:' if f.nil? || f.empty?
91
+ URI("#{f}?line=#{line.to_s}&pos=#{pos.to_s}")
92
+ end
86
93
  end
87
94
 
88
95
  # A LoaderAdapter adapts an object with a {Puppet::Pops::Loader}. This is used to make further loading from the
@@ -95,7 +102,7 @@ module Puppet::Pops::Adapters
95
102
  # @see Puppet::Pops::Utils#find_adapter
96
103
  #
97
104
  class LoaderAdapter < Puppet::Pops::Adaptable::Adapter
98
- # @return [Puppet::Pops::Loader] the loader
105
+ # @return [Puppet::Pops::Loader::Loader] the loader
99
106
  attr_accessor :loader
100
107
  end
101
108
  end
@@ -20,7 +20,7 @@ class Puppet::Pops::Binder::BindingsComposer
20
20
  # @api private
21
21
  attr_reader :scheme_handlers
22
22
 
23
- # @return Hash<String, Puppet::Module> map of module name to module instance
23
+ # @return [Hash{String => Puppet::Module}] map of module name to module instance
24
24
  # @api private
25
25
  attr_reader :name_to_module
26
26
 
@@ -213,7 +213,7 @@ module Puppet::Pops::Binder::BindingsFactory
213
213
  # @note
214
214
  # This is only needed if something other than the default type `Data` is wanted, or if the wanted type is
215
215
  # not provided by one of the convenience methods {#array_of_data}, {#boolean}, {#float}, {#hash_of_data},
216
- # {#integer}, {#literal}, {#pattern}, {#string}, or one of the collection methods {#array_of}, or {#hash_of}.
216
+ # {#integer}, {#scalar}, {#pattern}, {#string}, or one of the collection methods {#array_of}, or {#hash_of}.
217
217
  #
218
218
  # To create a type, use the method {#type_factory}, to obtain the type.
219
219
  # @example creating a Hash with Integer key and Array[Integer] element type
@@ -2,7 +2,7 @@ module Puppet::Pops::Binder::Config
2
2
  # Validates the consistency of a Binder::BinderConfig
3
3
  class BinderConfigChecker
4
4
  # Create an instance with a diagnostic producer that will receive the result during validation
5
- # @param diangostics [DiagnosticProducer] The producer that will receive the diagnostic
5
+ # @param diagnostics [DiagnosticProducer] The producer that will receive the diagnostic
6
6
  # @api public
7
7
  #
8
8
  def initialize(diagnostics)
@@ -320,7 +320,7 @@ module Puppet::Pops::Binder::Producers
320
320
  attr_reader :name
321
321
 
322
322
  # @param injector [Puppet::Pops::Binder::Injector] The injector where the lookup originates
323
- # @param binding [Puppet::Pops::Binder::Bindings::Binding, nil] The binding using this producer
323
+ # @param binder [Puppet::Pops::Binder::Bindings::Binding, nil] The binding using this producer
324
324
  # @param scope [Puppet::Parser::Scope] The scope to use for evaluation
325
325
  # @option options [Puppet::Pops::Model::LambdaExpression] :transformer (nil) a transformer of produced value
326
326
  # @option options [Puppet::Pops::Types::PObjectType] :type The type to lookup
@@ -349,7 +349,7 @@ module Puppet::Pops::Binder::Producers
349
349
  attr_reader :key
350
350
 
351
351
  # @param injector [Puppet::Pops::Binder::Injector] The injector where the lookup originates
352
- # @param binding [Puppet::Pops::Binder::Bindings::Binding, nil] The binding using this producer
352
+ # @param binder [Puppet::Pops::Binder::Bindings::Binding, nil] The binding using this producer
353
353
  # @param scope [Puppet::Parser::Scope] The scope to use for evaluation
354
354
  # @option options [Puppet::Pops::Model::LambdaExpression] :transformer (nil) a transformer of produced value
355
355
  # @option options [Puppet::Pops::Types::PObjectType] :type The type to lookup
@@ -183,6 +183,10 @@ class Puppet::Pops::Evaluator::AccessOperator
183
183
  t
184
184
  end
185
185
 
186
+ def access_PCallableType(o, scope, keys)
187
+ TYPEFACTORY.callable(*keys)
188
+ end
189
+
186
190
  def access_PStructType(o, scope, keys)
187
191
  assert_keys(keys, o, 1, 1, Hash)
188
192
  TYPEFACTORY.struct(keys[0])
@@ -439,18 +443,51 @@ class Puppet::Pops::Evaluator::AccessOperator
439
443
  #
440
444
  def access_PResourceType(o, scope, keys)
441
445
  blamed = keys.size == 0 ? @semantic : @semantic.keys[0]
442
- keys.flatten!
446
+
443
447
  if keys.size == 0
444
- max = o.type_name.nil? ? 2 : 1
445
448
  fail(Puppet::Pops::Issues::BAD_TYPE_SLICE_ARITY, blamed,
446
- :base_type => Puppet::Pops::Types::TypeCalculator.new().string(o), :min => 1, :max => max, :actual => 0)
449
+ :base_type => Puppet::Pops::Types::TypeCalculator.new().string(o), :min => 1, :max => -1, :actual => 0)
450
+ end
451
+
452
+ # Must know which concrete resource type to operate on in all cases.
453
+ # It is not allowed to specify the type in an array arg - e.g. Resource[[File, 'foo']]
454
+ # type_name is LHS type_name if set, else the first given arg
455
+ type_name = o.type_name || keys.shift
456
+ type_name = case type_name
457
+ when Puppet::Pops::Types::PResourceType
458
+ type_name.type_name
459
+ when String
460
+ type_name.downcase
461
+ else
462
+ # blame given left expression if it defined the type, else the first given key expression
463
+ blame = o.type_name.nil? ? @semantic.keys[0] : @semantic.left_expr
464
+ fail(Puppet::Pops::Issues::ILLEGAL_RESOURCE_SPECIALIZATION, blame, {:actual => type_name.class})
465
+ end
466
+
467
+ # The result is an array if multiple titles are given, or if titles are specified with an array
468
+ # (possibly multiple arrays, and nested arrays).
469
+ result_type_array = keys.size > 1 || keys[0].is_a?(Array)
470
+ keys_orig_size = keys.size
471
+
472
+ keys.flatten!
473
+ keys.compact!
474
+
475
+ # If given keys that were just a mix of empty/nil with empty array as a result.
476
+ # As opposed to calling the function the wrong way (without any arguments), (configurable issue),
477
+ # Return an empty array
478
+ #
479
+ if keys.empty? && keys_orig_size > 0
480
+ optionally_fail(Puppet::Pops::Issues::EMPTY_RESOURCE_SPECIALIZATION, blamed)
481
+ return result_type_array ? [] : nil
447
482
  end
483
+
448
484
  if !o.title.nil?
449
485
  # lookup resource and return one or more parameter values
450
486
  resource = find_resource(scope, o.type_name, o.title)
451
487
  unless resource
452
488
  fail(Puppet::Pops::Issues::UNKNOWN_RESOURCE, @semantic, {:type_name => o.type_name, :title => o.title})
453
489
  end
490
+
454
491
  result = keys.map do |k|
455
492
  unless is_parameter_of_resource?(scope, resource, k)
456
493
  fail(Puppet::Pops::Issues::UNKNOWN_RESOURCE_PARAMETER, @semantic,
@@ -458,21 +495,9 @@ class Puppet::Pops::Evaluator::AccessOperator
458
495
  end
459
496
  get_resource_parameter_value(scope, resource, k)
460
497
  end
461
- return result.size <= 1 ? result.pop : result
498
+ return result_type_array ? result : result.pop
462
499
  end
463
500
 
464
- # type_name is LHS type_name if set, else the first given arg
465
- keys_orig_size = keys.size
466
- type_name = o.type_name || keys.shift
467
- type_name = case type_name
468
- when Puppet::Pops::Types::PResourceType
469
- type_name.type_name
470
- when String
471
- type_name.downcase
472
- else
473
- blame = keys_orig_size != keys.size ? @semantic.keys[0] : @semantic.left_expr
474
- fail(Puppet::Pops::Issues::ILLEGAL_RESOURCE_SPECIALIZATION, blame, {:actual => type_name.class})
475
- end
476
501
 
477
502
  keys = [:no_title] if keys.size < 1 # if there was only a type_name and it was consumed
478
503
  result = keys.each_with_index.map do |t, i|
@@ -497,18 +522,35 @@ class Puppet::Pops::Evaluator::AccessOperator
497
522
  rtype.title = (t == :no_title ? nil : t)
498
523
  rtype
499
524
  end
500
- # returns single type as type, else an array of types
501
- result.size == 1 ? result.pop : result
525
+ # returns single type if request was for a single entity, else an array of types (possibly empty)
526
+ return result_type_array ? result : result.pop
502
527
  end
503
528
 
504
529
  def access_PHostClassType(o, scope, keys)
505
530
  blamed = keys.size == 0 ? @semantic : @semantic.keys[0]
531
+ keys_orig_size = keys.size
532
+
533
+ # The result is an array if multiple classnames are given, or if classnames are specified with an array
534
+ # (possibly multiple arrays, and nested arrays).
535
+ result_type_array = keys.size > 1 || keys[0].is_a?(Array)
506
536
 
507
537
  keys.flatten!
508
- if keys.size == 0
538
+ keys.compact!
539
+
540
+ if keys_orig_size == 0
509
541
  fail(Puppet::Pops::Issues::BAD_TYPE_SLICE_ARITY, blamed,
510
542
  :base_type => Puppet::Pops::Types::TypeCalculator.new().string(o), :min => 1, :max => -1, :actual => 0)
511
543
  end
544
+
545
+ # If given keys that were just a mix of empty/nil with empty array as a result.
546
+ # As opposed to calling the function the wrong way (without any arguments), (configurable issue),
547
+ # Return an empty array
548
+ #
549
+ if keys.empty? && keys_orig_size > 0
550
+ optionally_fail(Puppet::Pops::Issues::EMPTY_RESOURCE_SPECIALIZATION, blamed)
551
+ return result_type_array ? [] : nil
552
+ end
553
+
512
554
  if ! o.class_name.nil?
513
555
  # lookup class resource and return one or more parameter values
514
556
  resource = find_resource(scope, 'class', o.class_name)
@@ -522,12 +564,9 @@ class Puppet::Pops::Evaluator::AccessOperator
522
564
  end
523
565
  get_resource_parameter_value(scope, resource, k)
524
566
  end
525
- return result.size <= 1 ? result.pop : result
526
- # TODO: if [] is applied to specific class, it should be treated the same as getting
527
- # a resource parameter. Now it fails the operation
528
- #
529
- fail(Puppet::Pops::Issues::ILLEGAL_TYPE_SPECIALIZATION, semantic.left_expr, {:kind => 'Class'})
567
+ return result_type_array ? result : result.pop
530
568
  end
569
+
531
570
  # The type argument may be a Resource Type - the Puppet Language allows a reference such as
532
571
  # Class[Foo], and this is interpreted as Class[Resource[Foo]] - which is ok as long as the resource
533
572
  # does not have a title. This should probably be deprecated.
@@ -547,7 +586,8 @@ class Puppet::Pops::Evaluator::AccessOperator
547
586
  ctype.class_name = c.downcase.sub(/^::/,'')
548
587
  ctype
549
588
  end
589
+
550
590
  # returns single type as type, else an array of types
551
- result.size == 1 ? result.pop : result
591
+ return result_type_array ? result : result.pop
552
592
  end
553
593
  end