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
@@ -7,6 +7,8 @@ require 'puppet/settings/ini_file'
7
7
  #
8
8
  class Puppet::Settings::ConfigFile
9
9
 
10
+ ALLOWED_SECTION_NAMES = ['main', 'master', 'agent', 'user'].freeze
11
+
10
12
  ##
11
13
  # @param value_converter [Proc] a function that will convert strings into ruby types
12
14
  #
@@ -76,6 +78,9 @@ private
76
78
  if section.name == "application_defaults" || section.name == "global_defaults"
77
79
  raise Puppet::Error, "Illegal section '#{section.name}' in config file #{file} at line #{section.line_number}"
78
80
  end
81
+ if !ALLOWED_SECTION_NAMES.include?(section.name)
82
+ Puppet.deprecation_warning("Sections other than #{ALLOWED_SECTION_NAMES.join(', ')} are deprecated in puppet.conf. Please use the directory environments feature to specify environments. (See http://docs.puppetlabs.com/puppet/latest/reference/environments.html)")
83
+ end
79
84
  section.name
80
85
  end.uniq
81
86
  end
@@ -0,0 +1,147 @@
1
+ # Configuration settings for a single directory Environment.
2
+ # @api private
3
+ class Puppet::Settings::EnvironmentConf
4
+ VALID_SETTINGS = [:modulepath, :manifest, :config_version, :environment_timeout].freeze
5
+
6
+ # Given a path to a directory environment, attempts to load and parse an
7
+ # environment.conf in ini format, and return an EnvironmentConf instance.
8
+ #
9
+ # An environment.conf is optional, so if the file itself is missing, or
10
+ # empty, an EnvironmentConf with default values will be returned.
11
+ #
12
+ # @note logs warnings if the environment.conf contains any ini sections,
13
+ # or has settings other than the three handled for directory environments
14
+ # (:manifest, :modulepath, :config_version)
15
+ #
16
+ # @param path_to_env [String] path to the directory environment
17
+ # @param global_module_path [Array<String>] the installation's base modulepath
18
+ # setting, appended to default environment modulepaths
19
+ # @return [EnvironmentConf] the parsed EnvironmentConf object
20
+ def self.load_from(path_to_env, global_module_path)
21
+ path_to_env = File.expand_path(path_to_env)
22
+ conf_file = File.join(path_to_env, 'environment.conf')
23
+ config = nil
24
+
25
+ begin
26
+ config = Puppet.settings.parse_file(conf_file)
27
+ validate(conf_file, config)
28
+ section = config.sections[:main]
29
+ rescue Errno::ENOENT
30
+ # environment.conf is an optional file
31
+ end
32
+
33
+ new(path_to_env, section, global_module_path)
34
+ end
35
+
36
+ # Provides a configuration object tied directly to the passed environment.
37
+ # Configuration values are exactly those returned by the environment object,
38
+ # without interpolation. This is a special case for the default configured
39
+ # environment returned by the Puppet::Environments::StaticPrivate loader.
40
+ def self.static_for(environment)
41
+ Static.new(environment)
42
+ end
43
+
44
+ attr_reader :section
45
+
46
+ # Create through EnvironmentConf.load_from()
47
+ def initialize(path_to_env, section, global_module_path)
48
+ @path_to_env = path_to_env
49
+ @section = section
50
+ @global_module_path = global_module_path
51
+ end
52
+
53
+ def manifest
54
+ get_setting(:manifest, File.join(@path_to_env, "manifests")) do |manifest|
55
+ absolute(manifest)
56
+ end
57
+ end
58
+
59
+ def environment_timeout
60
+ # gen env specific config or use the default value
61
+ get_setting(:environment_timeout, Puppet.settings.value(:environment_timeout)) do |ttl|
62
+ # munges the string form statically without really needed the settings system, only
63
+ # its ability to munge "4s, 3m, 5d, and 'unlimited' into seconds - if already munged into
64
+ # numeric form, the TTLSetting handles that.
65
+ Puppet::Settings::TTLSetting.munge(ttl, 'environment_timeout')
66
+ end
67
+ end
68
+
69
+ def modulepath
70
+ default_modulepath = [File.join(@path_to_env, "modules")] + @global_module_path
71
+ get_setting(:modulepath, default_modulepath) do |modulepath|
72
+ path = modulepath.kind_of?(String) ?
73
+ modulepath.split(File::PATH_SEPARATOR) :
74
+ modulepath
75
+ path.map { |p| absolute(p) }.join(File::PATH_SEPARATOR)
76
+ end
77
+ end
78
+
79
+ def config_version
80
+ get_setting(:config_version) do |config_version|
81
+ absolute(config_version)
82
+ end
83
+ end
84
+
85
+ private
86
+
87
+ def self.validate(path_to_conf_file, config)
88
+ valid = true
89
+ section_keys = config.sections.keys
90
+ main = config.sections[:main]
91
+ if section_keys.size > 1
92
+ Puppet.warning("Invalid sections in environment.conf at '#{path_to_conf_file}'. Environment conf may not have sections. The following sections are being ignored: '#{(section_keys - [:main]).join(',')}'")
93
+ valid = false
94
+ end
95
+
96
+ extraneous_settings = main.settings.map(&:name) - VALID_SETTINGS
97
+ if !extraneous_settings.empty?
98
+ Puppet.warning("Invalid settings in environment.conf at '#{path_to_conf_file}'. The following unknown setting(s) are being ignored: #{extraneous_settings.join(', ')}")
99
+ valid = false
100
+ end
101
+
102
+ return valid
103
+ end
104
+
105
+ def get_setting(setting_name, default = nil)
106
+ setting = section.setting(setting_name) if section
107
+ value = setting.value if setting
108
+ value ||= default
109
+ yield value
110
+ end
111
+
112
+ def absolute(path)
113
+ return nil if path.nil?
114
+ if path =~ /^\$/
115
+ # Path begins with $something interpolatable
116
+ path
117
+ else
118
+ File.expand_path(path, @path_to_env)
119
+ end
120
+ end
121
+
122
+ # Models configuration for an environment that is not loaded from a directory.
123
+ #
124
+ # @api private
125
+ class Static
126
+ def initialize(environment)
127
+ @environment = environment
128
+ end
129
+
130
+ def manifest
131
+ @environment.manifest
132
+ end
133
+
134
+ def modulepath
135
+ @environment.modulepath.join(File::PATH_SEPARATOR)
136
+ end
137
+
138
+ def config_version
139
+ @environment.config_version
140
+ end
141
+
142
+ def environment_timeout
143
+ 0
144
+ end
145
+ end
146
+
147
+ end
@@ -0,0 +1,48 @@
1
+ # A setting that represents a span of time to live, and evaluates to Numeric
2
+ # seconds to live where 0 means shortest possible time to live, a positive numeric value means time
3
+ # to live in seconds, and the symbolic entry 'unlimited' is an infinite amount of time.
4
+ #
5
+ class Puppet::Settings::TTLSetting < Puppet::Settings::BaseSetting
6
+ INFINITY = 1.0 / 0.0
7
+
8
+ # How we convert from various units to seconds.
9
+ UNITMAP = {
10
+ # 365 days isn't technically a year, but is sufficient for most purposes
11
+ "y" => 365 * 24 * 60 * 60,
12
+ "d" => 24 * 60 * 60,
13
+ "h" => 60 * 60,
14
+ "m" => 60,
15
+ "s" => 1
16
+ }
17
+
18
+ # A regex describing valid formats with groups for capturing the value and units
19
+ FORMAT = /^(\d+)(y|d|h|m|s)?$/
20
+
21
+ def type
22
+ :ttl
23
+ end
24
+
25
+ # Convert the value to Numeric, parsing numeric string with units if necessary.
26
+ def munge(value)
27
+ self.class.munge(value, @name)
28
+ end
29
+
30
+ # Convert the value to Numeric, parsing numeric string with units if necessary.
31
+ def self.munge(value, param_name)
32
+ case
33
+ when value.is_a?(Numeric)
34
+ if value < 0
35
+ raise Puppet::Settings::ValidationError, "Invalid negative 'time to live' #{value.inspect} - did you mean 'unlimited'?"
36
+ end
37
+ value
38
+
39
+ when value == 'unlimited'
40
+ INFINITY
41
+
42
+ when (value.is_a?(String) and value =~ FORMAT)
43
+ $1.to_i * UNITMAP[$2 || 's']
44
+ else
45
+ raise Puppet::Settings::ValidationError, "Invalid 'time to live' format '#{value.inspect}' for parameter: #{param_name}"
46
+ end
47
+ end
48
+ end
@@ -80,9 +80,9 @@ class Puppet::SSL::CertificateAuthority
80
80
  auto = Puppet[:autosign]
81
81
 
82
82
  decider = case auto
83
- when 'false', false, nil
83
+ when false
84
84
  AutosignNever.new
85
- when 'true', true
85
+ when true
86
86
  AutosignAlways.new
87
87
  else
88
88
  file = Puppet::FileSystem.pathname(auto)
@@ -197,7 +197,6 @@ class Puppet::SSL::CertificateAuthority
197
197
  # Created to prevent the case of reading all certs from disk, getting
198
198
  # just their names and verifying the cert for each name, which then
199
199
  # causes the cert to again be read from disk.
200
- # @param name [Array<string>] filter to cerificate names
201
200
  #
202
201
  # @author Jeff Weiss <jeff.weiss@puppetlabs.com>
203
202
  # @api Puppet Enterprise Licensing
@@ -15,7 +15,7 @@ class Puppet::SSL::CertificateAuthority::AutosignCommand
15
15
  # Run the autosign command with the given CSR name as an argument and the
16
16
  # CSR body on stdin.
17
17
  #
18
- # @param name [String] The CSR name to check for autosigning
18
+ # @param csr [String] The CSR name to check for autosigning
19
19
  # @return [true, false] If the CSR should be autosigned
20
20
  def allowed?(csr)
21
21
  name = csr.name
@@ -61,12 +61,12 @@ DOC
61
61
  #
62
62
  # @param key [OpenSSL::X509::Key, Puppet::SSL::Key] The key pair associated
63
63
  # with this CSR.
64
- # @param opts [Hash]
65
- # @options opts [String] :dns_alt_names A comma separated list of
64
+ # @param options [Hash]
65
+ # @option options [String] :dns_alt_names A comma separated list of
66
66
  # Subject Alternative Names to include in the CSR extension request.
67
- # @options opts [Hash<String, String, Array<String>>] :csr_attributes A hash
67
+ # @option options [Hash<String, String, Array<String>>] :csr_attributes A hash
68
68
  # of OIDs and values that are either a string or array of strings.
69
- # @options opts [Array<String, String>] :extension_requests A hash of
69
+ # @option options [Array<String, String>] :extension_requests A hash of
70
70
  # certificate extensions to add to the CSR extReq attribute, excluding
71
71
  # the Subject Alternative Names extension.
72
72
  #
@@ -12,8 +12,8 @@ class Puppet::SSL::Validator::DefaultValidator #< class Puppet::SSL::Validator
12
12
 
13
13
  # Creates a new DefaultValidator, optionally with an SSL Configuration and SSL Host.
14
14
  #
15
- # @param [Puppet::SSL::Configuration] (a default configuration) ssl_configuration the SSL configuration to use
16
- # @param [Puppet::SSL::Host] (Puppet::SSL::Host.localhost) the SSL host to use
15
+ # @param ssl_configuration [Puppet::SSL::Configuration] (a default configuration) ssl_configuration the SSL configuration to use
16
+ # @param ssl_host [Puppet::SSL::Host] (Puppet::SSL::Host.localhost) the SSL host to use
17
17
  #
18
18
  # @api private
19
19
  #
@@ -4,7 +4,7 @@ class Puppet::Status
4
4
  extend Puppet::Indirector
5
5
  indirects :status, :terminus_class => :local
6
6
 
7
- attr :status, true
7
+ attr_accessor :status
8
8
 
9
9
  def initialize( status = nil )
10
10
  @status = status || {"is_alive" => true}
@@ -203,6 +203,7 @@ module Puppet::Test
203
203
  # having to deal with a missing environmentpath we can just set it right
204
204
  # here.
205
205
  Puppet[:environmentpath] = @environmentpath
206
+ Puppet[:environment_timeout] = 0
206
207
  end
207
208
  private_class_method :initialize_settings_before_each
208
209
  end
@@ -13,6 +13,8 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
 
16
+ require 'puppet/parameter/boolean'
17
+
16
18
  Puppet::Type.newtype(:augeas) do
17
19
  include Puppet::Util
18
20
 
@@ -83,7 +85,7 @@ Puppet::Type.newtype(:augeas) do
83
85
  where:
84
86
 
85
87
  * `AUGEAS_PATH` is a valid path scoped by the context
86
- * `MATCH_PATH` is a valid match synatx scoped by the context
88
+ * `MATCH_PATH` is a valid match syntax scoped by the context
87
89
  * `COMPARATOR` is one of `>, >=, !=, ==, <=,` or `<`
88
90
  * `STRING` is a string
89
91
  * `INT` is a number
@@ -155,6 +157,16 @@ Puppet::Type.newtype(:augeas) do
155
157
  self.fail "You must specify both the lens and incl parameters, or neither." if has_lens != has_incl
156
158
  end
157
159
 
160
+ newparam(:show_diff, :boolean => true, :parent => Puppet::Parameter::Boolean) do
161
+ desc "Whether to display differences when the file changes, defaulting to
162
+ true. This parameter is useful for files that may contain passwords or
163
+ other secret data, which might otherwise be included in Puppet reports or
164
+ other insecure outputs. If the global `show_diff` setting
165
+ is false, then no diffs will be shown even if this parameter is true."
166
+
167
+ defaultto :true
168
+ end
169
+
158
170
  # This is the actual meat of the code. It forces
159
171
  # augeas to be run and fails or not based on the augeas return
160
172
  # code.
@@ -4,12 +4,12 @@ require 'puppet/util/filetype'
4
4
 
5
5
  Puppet::Type.newtype(:cron) do
6
6
  @doc = <<-'EOT'
7
- Installs and manages cron jobs. Every cron resource requires a command
8
- and user attribute, as well as at least one periodic attribute (hour,
9
- minute, month, monthday, weekday, or special). While the name of the cron
10
- job is not part of the actual job, the name is stored in a comment beginning with
11
- `# Puppet Name: `. These comments are used to match crontab entries created by
12
- Puppet with cron resources.
7
+ Installs and manages cron jobs. Every cron resource created by Puppet
8
+ requires a command and at least one periodic attribute (hour, minute,
9
+ month, monthday, weekday, or special). While the name of the cron job is
10
+ not part of the actual job, the name is stored in a comment beginning with
11
+ `# Puppet Name: `. These comments are used to match crontab entries created
12
+ by Puppet with cron resources.
13
13
 
14
14
  If an existing crontab entry happens to match the scheduling and command of a
15
15
  cron resource that has never been synched, Puppet will defer to the existing
@@ -49,6 +49,10 @@ Puppet::Type.newtype(:cron) do
49
49
  These changes must be expressed by setting the parameter to
50
50
  `minute => absent` because Puppet only manages parameters that are out of
51
51
  sync with manifest entries.
52
+
53
+ **Autorequires:** If Puppet is managing the user account specified by the
54
+ `user` property of a cron resource, then the cron resource will autorequire
55
+ that user.
52
56
  EOT
53
57
  ensurable
54
58
 
@@ -368,15 +372,20 @@ Puppet::Type.newtype(:cron) do
368
372
  end
369
373
 
370
374
  newproperty(:user) do
371
- desc "The user to run the command as. This user must
375
+ desc "The user who owns the cron job. This user must
372
376
  be allowed to run cron jobs, which is not currently checked by
373
377
  Puppet.
374
378
 
375
- The user defaults to whomever Puppet is running as."
379
+ This property defaults to the user running Puppet or `root`.
380
+
381
+ The default crontab provider executes the system `crontab` using
382
+ the user account specified by this property."
376
383
 
377
384
  defaultto {
378
- struct = Etc.getpwuid(Process.uid)
379
- struct.respond_to?(:name) && struct.name or 'root'
385
+ if not provider.is_a?(@resource.class.provider(:crontab))
386
+ struct = Etc.getpwuid(Process.uid)
387
+ struct.respond_to?(:name) && struct.name or 'root'
388
+ end
380
389
  }
381
390
  end
382
391
 
@@ -386,17 +395,23 @@ Puppet::Type.newtype(:cron) do
386
395
  end
387
396
 
388
397
  newproperty(:target) do
389
- desc "The username that will own the cron entry. Defaults to
390
- the value of $USER for the shell that invoked Puppet, or root if $USER
391
- is empty."
398
+ desc "The name of the crontab file in which the cron job should be stored.
399
+
400
+ This property defaults to the value of the `user` property if set, the
401
+ user running Puppet or `root`.
402
+
403
+ For the default crontab provider, this property is functionally
404
+ equivalent to the `user` property and should be avoided. In particular,
405
+ setting both `user` and `target` to different values will result in
406
+ undefined behavior."
392
407
 
393
408
  defaultto {
394
409
  if provider.is_a?(@resource.class.provider(:crontab))
395
410
  if val = @resource.should(:user)
396
411
  val
397
412
  else
398
- raise ArgumentError,
399
- "You must provide a username with crontab entries"
413
+ struct = Etc.getpwuid(Process.uid)
414
+ struct.respond_to?(:name) && struct.name or 'root'
400
415
  end
401
416
  elsif provider.class.ancestors.include?(Puppet::Provider::ParsedFile)
402
417
  provider.class.default_target
@@ -438,8 +453,8 @@ Puppet::Type.newtype(:cron) do
438
453
  # property, unpurged file content (such as comments) can end up
439
454
  # being written to the default target (i.e. the current login name).
440
455
  def purging
441
- self[:target] = provider.property_hash[:target]
442
- self[:user] = provider.property_hash[:target]
456
+ self[:target] = provider.target
457
+ self[:user] = provider.target
443
458
  super
444
459
  end
445
460
 
@@ -459,7 +474,6 @@ Puppet::Type.newtype(:cron) do
459
474
  unless ret
460
475
  case name
461
476
  when :command
462
- devfail "No command, somehow" unless @parameters[:ensure].value == :absent
463
477
  when :special
464
478
  # nothing
465
479
  else
@@ -250,7 +250,7 @@ Puppet::Type.newtype(:file) do
250
250
  desc "Whether to display differences when the file changes, defaulting to
251
251
  true. This parameter is useful for files that may contain passwords or
252
252
  other secret data, which might otherwise be included in Puppet reports or
253
- other insecure outputs. If the global ``show_diff` setting
253
+ other insecure outputs. If the global `show_diff` setting
254
254
  is false, then no diffs will be shown even if this parameter is true."
255
255
 
256
256
  defaultto :true
@@ -613,7 +613,9 @@ Puppet::Type.newtype(:file) do
613
613
  end
614
614
  children[meta.relative_path] ||= newchild(meta.relative_path)
615
615
  children[meta.relative_path][:source] = meta.source
616
- children[meta.relative_path][:checksum] = :md5 if meta.ftype == "file"
616
+ if meta.ftype == "file"
617
+ children[meta.relative_path][:checksum] = Puppet[:digest_algorithm].to_sym
618
+ end
617
619
 
618
620
  children[meta.relative_path].parameter(:source).metadata = meta
619
621
  end