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
@@ -90,7 +90,10 @@ class Puppet::Configurer
90
90
  end
91
91
 
92
92
  def get_facts(options)
93
- download_plugins if options[:pluginsync]
93
+ if options[:pluginsync]
94
+ remote_environment_for_plugins = Puppet::Node::Environment.remote(@environment)
95
+ download_plugins(remote_environment_for_plugins)
96
+ end
94
97
 
95
98
  if Puppet::Resource::Catalog.indirection.terminus_class == :rest
96
99
  # This is a bit complicated. We need the serialized and escaped facts,
@@ -30,10 +30,9 @@ class Puppet::Configurer::Downloader
30
30
  end
31
31
 
32
32
  def catalog
33
- catalog = Puppet::Resource::Catalog.new
33
+ catalog = Puppet::Resource::Catalog.new("PluginSync", @environment)
34
34
  catalog.host_config = false
35
35
  catalog.add_resource(file)
36
- catalog.environment = @environment
37
36
  catalog
38
37
  end
39
38
 
@@ -48,23 +47,25 @@ class Puppet::Configurer::Downloader
48
47
  require 'sys/admin' if Puppet.features.microsoft_windows?
49
48
 
50
49
  def default_arguments
51
- {
50
+ defargs = {
52
51
  :path => path,
53
52
  :recurse => true,
54
53
  :source => source,
54
+ :source_permissions => :ignore,
55
55
  :tag => name,
56
56
  :purge => true,
57
57
  :force => true,
58
58
  :backup => false,
59
59
  :noop => false
60
- }.merge(
61
- Puppet.features.microsoft_windows? ? {
62
- :source_permissions => :ignore
63
- } :
64
- {
65
- :owner => Process.uid,
66
- :group => Process.gid
67
- }
68
- )
60
+ }
61
+ if !Puppet.features.microsoft_windows?
62
+ defargs.merge!(
63
+ {
64
+ :owner => Process.uid,
65
+ :group => Process.gid
66
+ }
67
+ )
68
+ end
69
+ return defargs
69
70
  end
70
71
  end
@@ -3,13 +3,13 @@
3
3
  # easier to test.
4
4
  module Puppet::Configurer::PluginHandler
5
5
  # Retrieve facts from the central server.
6
- def download_plugins
6
+ def download_plugins(environment)
7
7
  plugin_downloader = Puppet::Configurer::Downloader.new(
8
8
  "plugin",
9
9
  Puppet[:plugindest],
10
10
  Puppet[:pluginsource],
11
11
  Puppet[:pluginsignore],
12
- @environment
12
+ environment
13
13
  )
14
14
  if Puppet.features.external_facts?
15
15
  plugin_fact_downloader = Puppet::Configurer::Downloader.new(
@@ -17,7 +17,7 @@ module Puppet::Configurer::PluginHandler
17
17
  Puppet[:pluginfactdest],
18
18
  Puppet[:pluginfactsource],
19
19
  Puppet[:pluginsignore],
20
- @environment
20
+ environment
21
21
  )
22
22
  plugin_fact_downloader.evaluate
23
23
  end
@@ -3,6 +3,10 @@
3
3
  # and cannot be changed; however a child context can be created, using
4
4
  # {#override}, that provides a different value.
5
5
  #
6
+ # When binding a {Proc}, the proc is called when the value is looked up, and the result
7
+ # is memoized for subsequent lookups. This provides a lazy mechanism that can be used to
8
+ # delay expensive production of values until they are needed.
9
+ #
6
10
  # @api private
7
11
  class Puppet::Context
8
12
  require 'puppet/context/trusted_information'
@@ -36,7 +40,8 @@ class Puppet::Context
36
40
  # @api private
37
41
  def lookup(name, &block)
38
42
  if @table.include?(name)
39
- @table[name]
43
+ value = @table[name]
44
+ value.is_a?(Proc) ? (@table[name] = value.call) : value
40
45
  elsif block
41
46
  block.call
42
47
  else
@@ -52,6 +52,12 @@ module Puppet
52
52
  :owner => "service",
53
53
  :group => "service",
54
54
  :desc => "The directory in which to store log files",
55
+ },
56
+ :log_level => {
57
+ :default => 'notice',
58
+ :type => :enum,
59
+ :values => ["debug","info","notice","warning","err","alert","emerg","crit"],
60
+ :desc => "Default logging level",
55
61
  }
56
62
  )
57
63
 
@@ -198,8 +204,13 @@ module Puppet
198
204
  },
199
205
  :environmentpath => {
200
206
  :default => "",
201
- :desc => "A search path for environment directories, as a list of directories separated by the system
202
- path separator character.",
207
+ :desc => "A search path for directory environments, as a list of directories
208
+ separated by the system path separator character. (The POSIX path separator
209
+ is ':', and the Windows path separator is ';'.)
210
+
211
+ This setting must have a value set to enable **directory environments.** The
212
+ recommended value is `$confdir/environments`. For more details, see
213
+ http://docs.puppetlabs.com/puppet/latest/reference/environments.html",
203
214
  :type => :path,
204
215
  },
205
216
  :diff_args => {
@@ -344,6 +355,12 @@ module Puppet
344
355
  configuration files. This timeout determines how quickly Puppet checks whether
345
356
  a file (such as manifests or templates) has changed on disk. #{AS_DURATION}",
346
357
  },
358
+ :environment_timeout => {
359
+ :default => "5s",
360
+ :type => :ttl,
361
+ :desc => "The time to live for a cached environment. The time is either given #{AS_DURATION}, or
362
+ the word 'unlimited' which causes the environment to be cached until the master is restarted."
363
+ },
347
364
  :queue_type => {
348
365
  :default => "stomp",
349
366
  :desc => "Which type of queue to use for asynchronous processing.",
@@ -392,7 +409,11 @@ module Puppet
392
409
  :desc => "How to determine the configuration version. By default, it will be the
393
410
  time that the configuration is parsed, but you can provide a shell script to override how the
394
411
  version is determined. The output of this script will be added to every log message in the
395
- reports, allowing you to correlate changes on your hosts to the source version on the server.",
412
+ reports, allowing you to correlate changes on your hosts to the source version on the server.
413
+
414
+ Setting a global value for config_version in puppet.conf is deprecated. Please set a
415
+ per-environment value in environment.conf instead. For more info, see
416
+ http://docs.puppetlabs.com/puppet/latest/reference/environments.html",
396
417
  },
397
418
  :zlib => {
398
419
  :default => true,
@@ -437,7 +458,7 @@ module Puppet
437
458
  )
438
459
  Puppet.define_settings(:module_tool,
439
460
  :module_repository => {
440
- :default => 'https://forge.puppetlabs.com',
461
+ :default => 'https://forgeapi.puppetlabs.com',
441
462
  :desc => "The module repository",
442
463
  },
443
464
  :module_working_dir => {
@@ -680,6 +701,13 @@ EOT
680
701
  :type => :duration,
681
702
  :desc => "The window of time leading up to a certificate's expiration that a notification
682
703
  will be logged. This applies to CA, master, and agent certificates. #{AS_DURATION}"
704
+ },
705
+ :digest_algorithm => {
706
+ :default => 'md5',
707
+ :type => :enum,
708
+ :values => ["md5", "sha256"],
709
+ :desc => 'Which digest algorithm to use for file resources and the filebucket.
710
+ Valid values are md5, sha256. Default is md5.',
683
711
  }
684
712
  )
685
713
 
@@ -867,14 +895,22 @@ EOT
867
895
  :manifestdir => {
868
896
  :default => "$confdir/manifests",
869
897
  :type => :directory,
870
- :desc => "Where puppet master looks for its manifests.",
898
+ :desc => "Used to build the default value of the `manifest` setting. Has no other purpose.
899
+
900
+ This setting is deprecated."
871
901
  },
872
902
  :manifest => {
873
903
  :default => "$manifestdir/site.pp",
874
904
  :type => :file_or_directory,
875
- :desc => "The entry-point manifest file for puppet master or a directory of manifests
876
- to be evaluated in alphabetical order. Puppet manages this path as a directory
877
- if it exists or if the path ends with a / or \\.",
905
+ :desc => "The entry-point manifest for puppet master. This can be one file
906
+ or a directory of manifests to be evaluated in alphabetical order. Puppet manages
907
+ this path as a directory if one exists or if the path ends with a / or \\.
908
+
909
+ Setting a global value for `manifest` in puppet.conf is deprecated. Please use
910
+ directory environments instead. If you need to use something other than the
911
+ environment's `manifests` directory as the main manifest, you can set
912
+ `manifest` in environment.conf. For more info, see
913
+ http://docs.puppetlabs.com/puppet/latest/reference/environments.html",
878
914
  },
879
915
  :code => {
880
916
  :default => "",
@@ -938,15 +974,30 @@ EOT
938
974
  :basemodulepath => {
939
975
  :default => "$confdir/modules#{File::PATH_SEPARATOR}/usr/share/puppet/modules",
940
976
  :type => :path,
941
- :desc => "The base non-environment specific search path for modules, included
942
- also in all directory environment and default legacy environment modulepaths.",
977
+ :desc => "The search path for **global** modules. Should be specified as a
978
+ list of directories separated by the system path separator character. (The
979
+ POSIX path separator is ':', and the Windows path separator is ';'.)
980
+
981
+ If you are using directory environments, these are the modules that will
982
+ be used by _all_ environments. Note that the `modules` directory of the active
983
+ environment will have priority over any global directories. For more info, see
984
+ http://docs.puppetlabs.com/puppet/latest/reference/environments.html
985
+
986
+ This setting also provides the default value for the deprecated `modulepath`
987
+ setting, which is used when directory environments are disabled.",
943
988
  },
944
989
  :modulepath => {
945
990
  :default => "$basemodulepath",
946
991
  :type => :path,
947
992
  :desc => "The search path for modules, as a list of directories separated by the system
948
993
  path separator character. (The POSIX path separator is ':', and the
949
- Windows path separator is ';'.)",
994
+ Windows path separator is ';'.)
995
+
996
+ Setting a global value for `modulepath` in puppet.conf is deprecated. Please use
997
+ directory environments instead. If you need to use something other than the
998
+ default modulepath of `<ACTIVE ENVIRONMENT'S MODULES DIR>:$basemodulepath`,
999
+ you can set `modulepath` in environment.conf. For more info, see
1000
+ http://docs.puppetlabs.com/puppet/latest/reference/environments.html",
950
1001
  },
951
1002
  :ssl_client_header => {
952
1003
  :default => "HTTP_X_CLIENT_DN",
@@ -1772,7 +1823,9 @@ EOT
1772
1823
  :default => "$vardir/templates",
1773
1824
  :type => :directory,
1774
1825
  :desc => "Where Puppet looks for template files. Can be a list of colon-separated
1775
- directories.",
1826
+ directories.
1827
+
1828
+ This setting is deprecated. Please put your templates in modules instead."
1776
1829
  },
1777
1830
 
1778
1831
  :allow_variables_with_dashes => {
@@ -1833,6 +1886,23 @@ EOT
1833
1886
  Available Since Puppet 3.5.
1834
1887
  EOT
1835
1888
  },
1889
+ :biff => {
1890
+ :default => false,
1891
+ :type => :boolean,
1892
+ :hook => proc do |value|
1893
+ if Puppet.settings[:parser] != 'future'
1894
+ Puppet.settings.override_default(:parser, 'future')
1895
+ end
1896
+ if Puppet.settings[:evaluator] != 'future'
1897
+ Puppet.settings.override_default(:evaluator, 'future')
1898
+ end
1899
+ end,
1900
+ :desc => <<-EOT
1901
+ Turns on Biff the catalog builder, future parser, and future evaluator.
1902
+ This is an experimental feature - and this setting may go away before
1903
+ release of Pupet 3.6.
1904
+ EOT
1905
+ },
1836
1906
  :max_errors => {
1837
1907
  :default => 10,
1838
1908
  :desc => <<-'EOT'
@@ -31,6 +31,15 @@ module Puppet::Environments
31
31
  # @param name [String,Symbol] The name of environment to find
32
32
  # @return [Puppet::Node::Environment, nil] the requested environment or nil
33
33
  # if it wasn't found
34
+ #
35
+ # @!macro [new] loader_get_conf
36
+ # Attempt to obtain the initial configuration for the environment. Not all
37
+ # loaders can provide this.
38
+ #
39
+ # @param name [String,Symbol] The name of the environment whose configuration
40
+ # we are looking up
41
+ # @return [Puppet::Setting::EnvironmentConf, nil] the configuration for the
42
+ # requested environment, or nil if not found or no configuration is available
34
43
 
35
44
  # A source of pre-defined environments.
36
45
  #
@@ -58,6 +67,19 @@ module Puppet::Environments
58
67
  env.name == name.intern
59
68
  end
60
69
  end
70
+
71
+ # Returns a basic environment configuration object tied to the environment's
72
+ # implementation values. Will not interpolate.
73
+ #
74
+ # @!macro loader_get_conf
75
+ def get_conf(name)
76
+ env = get(name)
77
+ if env
78
+ Puppet::Settings::EnvironmentConf.static_for(env)
79
+ else
80
+ nil
81
+ end
82
+ end
61
83
  end
62
84
 
63
85
  # A source of unlisted pre-defined environments.
@@ -113,6 +135,14 @@ module Puppet::Environments
113
135
  def get(name)
114
136
  Puppet::Node::Environment.new(name)
115
137
  end
138
+
139
+ # @note we could return something here, but since legacy environments
140
+ # are deprecated, there is no point.
141
+ #
142
+ # @!macro loader_get_conf
143
+ def get_conf(name)
144
+ nil
145
+ end
116
146
  end
117
147
 
118
148
  # Reads environments from a directory on disk. Each environment is
@@ -131,7 +161,7 @@ module Puppet::Environments
131
161
 
132
162
  # Generate an array of directory loaders from a path string.
133
163
  # @param path [String] path to environment directories
134
- # @param global_module_path [String] the global modulepath setting
164
+ # @param global_module_path [Array<String>] the global modulepath setting
135
165
  # @return [Array<Puppet::Environments::Directories>] An array
136
166
  # of configured directory loaders.
137
167
  def self.from_path(path, global_module_path)
@@ -148,29 +178,50 @@ module Puppet::Environments
148
178
 
149
179
  # @!macro loader_list
150
180
  def list
151
- base = Puppet::FileSystem.path_string(@environment_dir)
181
+ valid_directories.collect do |envdir|
182
+ name = Puppet::FileSystem.basename_string(envdir)
183
+
184
+ setting_values = Puppet.settings.values(name, Puppet.settings.preferred_run_mode)
185
+ env = Puppet::Node::Environment.create(
186
+ name.intern,
187
+ Puppet::Node::Environment.split_path(setting_values.interpolate(:modulepath)),
188
+ setting_values.interpolate(:manifest),
189
+ setting_values.interpolate(:config_version)
190
+ )
191
+ env.watching = false
192
+ env
193
+ end
194
+ end
195
+
196
+ # @!macro loader_get
197
+ def get(name)
198
+ list.find { |env| env.name == name.intern }
199
+ end
152
200
 
201
+ # @!macro loader_get_conf
202
+ def get_conf(name)
203
+ valid_directories.each do |envdir|
204
+ envname = Puppet::FileSystem.basename_string(envdir)
205
+ if envname == name.to_s
206
+ return Puppet::Settings::EnvironmentConf.load_from(envdir, @global_module_path)
207
+ end
208
+ end
209
+ nil
210
+ end
211
+
212
+ private
213
+
214
+ def valid_directories
153
215
  if Puppet::FileSystem.directory?(@environment_dir)
154
216
  Puppet::FileSystem.children(@environment_dir).select do |child|
155
217
  name = Puppet::FileSystem.basename_string(child)
156
218
  Puppet::FileSystem.directory?(child) &&
157
219
  Puppet::Node::Environment.valid_name?(name)
158
- end.collect do |child|
159
- name = Puppet::FileSystem.basename_string(child)
160
- Puppet::Node::Environment.create(
161
- name.intern,
162
- [File.join(base, name, "modules")] + @global_module_path,
163
- File.join(base, name, "manifests"))
164
220
  end
165
221
  else
166
222
  []
167
223
  end
168
224
  end
169
-
170
- # @!macro loader_get
171
- def get(name)
172
- list.find { |env| env.name == name.intern }
173
- end
174
225
  end
175
226
 
176
227
  # Combine together multiple loaders to act as one.
@@ -199,5 +250,110 @@ module Puppet::Environments
199
250
  end
200
251
  nil
201
252
  end
253
+
254
+ # @!macro loader_get_conf
255
+ def get_conf(name)
256
+ @loaders.each do |loader|
257
+ if conf = loader.get_conf(name)
258
+ return conf
259
+ end
260
+ end
261
+ nil
262
+ end
263
+
264
+ end
265
+
266
+ class Cached < Combined
267
+ INFINITY = 1.0 / 0.0
268
+
269
+ def initialize(*loaders)
270
+ super
271
+ @cache = {}
272
+ end
273
+
274
+ def get(name)
275
+ evict_if_expired(name)
276
+ if result = @cache[name]
277
+ return result.value
278
+ elsif (result = super(name))
279
+ @cache[name] = entry(result)
280
+ result
281
+ end
282
+ end
283
+
284
+ # Clears the cache of the environment with the given name.
285
+ # (The intention is that this could be used from a MANUAL cache eviction command (TBD)
286
+ def clear(name)
287
+ @cache.delete(name)
288
+ end
289
+
290
+ # Clears all cached environments.
291
+ # (The intention is that this could be used from a MANUAL cache eviction command (TBD)
292
+ def clear_all()
293
+ @cache = {}
294
+ end
295
+
296
+ # This implementation evicts the cache, and always gets the current configuration of the environment
297
+ # TODO: While this is wasteful since it needs to go on a search for the conf, it is too disruptive to optimize
298
+ # this.
299
+ #
300
+ def get_conf(name)
301
+ evict_if_expired(name)
302
+ super name
303
+ end
304
+
305
+ # Creates a suitable cache entry given the time to live for one environment
306
+ #
307
+ def entry(env)
308
+ ttl = (conf = get_conf(env.name)) ? conf.environment_timeout : Puppet.settings.value(:environment_timeout)
309
+ case ttl
310
+ when 0
311
+ NotCachedEntry.new(env) # Entry that is always expired (avoids syscall to get time)
312
+ when INFINITY
313
+ Entry.new(env) # Entry that never expires (avoids syscall to get time)
314
+ else
315
+ TTLEntry.new(env, ttl)
316
+ end
317
+ end
318
+
319
+ # Evicts the entry if it has expired
320
+ #
321
+ def evict_if_expired(name)
322
+ if (result = @cache[name]) && result.expired?
323
+ @cache.delete(name)
324
+ end
325
+ end
326
+
327
+ # Never evicting entry
328
+ class Entry
329
+ attr_reader :value
330
+
331
+ def initialize(value)
332
+ @value = value
333
+ end
334
+
335
+ def expired?
336
+ false
337
+ end
338
+ end
339
+
340
+ # Always evicting entry
341
+ class NotCachedEntry < Entry
342
+ def expired?
343
+ true
344
+ end
345
+ end
346
+
347
+ # Time to Live eviction policy entry
348
+ class TTLEntry < Entry
349
+ def initialize(value, ttl_seconds)
350
+ super value
351
+ @ttl = Time.now + ttl_seconds
352
+ end
353
+
354
+ def expired?
355
+ Time.now > @ttl
356
+ end
357
+ end
202
358
  end
203
359
  end