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
@@ -0,0 +1,79 @@
1
+ # <%= metadata.name %>
2
+
3
+ #### Table of Contents
4
+
5
+ 1. [Overview](#overview)
6
+ 2. [Module Description - What the module does and why it is useful](#module-description)
7
+ 3. [Setup - The basics of getting started with <%= metadata.name %>](#setup)
8
+ * [What <%= metadata.name %> affects](#what-<%= metadata.name %>-affects)
9
+ * [Setup requirements](#setup-requirements)
10
+ * [Beginning with <%= metadata.name %>](#beginning-with-<%= metadata.name %>)
11
+ 4. [Usage - Configuration options and additional functionality](#usage)
12
+ 5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
13
+ 5. [Limitations - OS compatibility, etc.](#limitations)
14
+ 6. [Development - Guide for contributing to the module](#development)
15
+
16
+ ## Overview
17
+
18
+ A one-maybe-two sentence summary of what the module does/what problem it solves.
19
+ This is your 30 second elevator pitch for your module. Consider including
20
+ OS/Puppet version it works with.
21
+
22
+ ## Module Description
23
+
24
+ If applicable, this section should have a brief description of the technology
25
+ the module integrates with and what that integration enables. This section
26
+ should answer the questions: "What does this module *do*?" and "Why would I use
27
+ it?"
28
+
29
+ If your module has a range of functionality (installation, configuration,
30
+ management, etc.) this is the time to mention it.
31
+
32
+ ## Setup
33
+
34
+ ### What <%= metadata.name %> affects
35
+
36
+ * A list of files, packages, services, or operations that the module will alter,
37
+ impact, or execute on the system it's installed on.
38
+ * This is a great place to stick any warnings.
39
+ * Can be in list or paragraph form.
40
+
41
+ ### Setup Requirements **OPTIONAL**
42
+
43
+ If your module requires anything extra before setting up (pluginsync enabled,
44
+ etc.), mention it here.
45
+
46
+ ### Beginning with <%= metadata.name %>
47
+
48
+ The very basic steps needed for a user to get the module up and running.
49
+
50
+ If your most recent release breaks compatibility or requires particular steps
51
+ for upgrading, you may wish to include an additional section here: Upgrading
52
+ (For an example, see http://forge.puppetlabs.com/puppetlabs/firewall).
53
+
54
+ ## Usage
55
+
56
+ Put the classes, types, and resources for customizing, configuring, and doing
57
+ the fancy stuff with your module here.
58
+
59
+ ## Reference
60
+
61
+ Here, list the classes, types, providers, facts, etc contained in your module.
62
+ This section should include all of the under-the-hood workings of your module so
63
+ people know what the module is touching on their system but don't need to mess
64
+ with things. (We are working on automating this section!)
65
+
66
+ ## Limitations
67
+
68
+ This is where you list OS compatibility, version compatibility, etc.
69
+
70
+ ## Development
71
+
72
+ Since your module is awesome, other users will want to play with it. Let them
73
+ know what the ground rules for contributing are.
74
+
75
+ ## Release Notes/Contributors/Etc **Optional**
76
+
77
+ If you aren't using changelog, put your release notes here (though you should
78
+ consider using changelog). You may also add any additional sections you feel are
79
+ necessary or important to include here. Please use the `## ` header.
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'puppetlabs_spec_helper/rake_tasks'
3
+ require 'puppet-lint/tasks/puppet-lint'
4
+ PuppetLint.configuration.send('disable_80chars')
5
+ PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]
6
+
7
+ desc "Validate manifests, templates, and ruby files"
8
+ task :validate do
9
+ Dir['manifests/**/*.pp'].each do |manifest|
10
+ sh "puppet parser validate --noop #{manifest}"
11
+ end
12
+ Dir['spec/**/*.rb','lib/**/*.rb'].each do |ruby_file|
13
+ sh "ruby -c #{ruby_file}" unless ruby_file =~ /spec\/fixtures/
14
+ end
15
+ Dir['templates/**/*.erb'].each do |template|
16
+ sh "erb -P -x -T '-' #{template} | ruby -c"
17
+ end
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+ describe '<%= metadata.name %>' do
3
+
4
+ context 'with defaults for all parameters' do
5
+ it { should contain_class('<%= metadata.name %>') }
6
+ end
7
+ end
@@ -3,17 +3,13 @@ require 'puppet/util'
3
3
 
4
4
  module Puppet::ModuleTool::Tar
5
5
  require 'puppet/module_tool/tar/gnu'
6
- require 'puppet/module_tool/tar/solaris'
7
6
  require 'puppet/module_tool/tar/mini'
8
7
 
9
- def self.instance(module_name)
10
- gtar_platforms = ['Solaris', 'OpenBSD']
11
- if gtar_platforms.include?(Facter.value('osfamily')) && Puppet::Util.which('gtar')
12
- Solaris.new
13
- elsif Puppet::Util.which('tar') && ! Puppet::Util::Platform.windows?
8
+ def self.instance
9
+ if Puppet::Util.which('tar') && ! Puppet::Util::Platform.windows?
14
10
  Gnu.new
15
11
  elsif Puppet.features.minitar? && Puppet.features.zlib?
16
- Mini.new(module_name)
12
+ Mini.new
17
13
  else
18
14
  raise RuntimeError, 'No suitable tar implementation found'
19
15
  end
@@ -1,16 +1,28 @@
1
1
  class Puppet::ModuleTool::Tar::Gnu
2
- def initialize(command = "tar")
3
- @command = command
4
- end
5
-
6
2
  def unpack(sourcefile, destdir, owner)
7
- Puppet::Util::Execution.execute("#{@command} xzf #{sourcefile} --no-same-owner -C #{destdir}")
8
- Puppet::Util::Execution.execute("find #{destdir} -type d -exec chmod 755 {} +")
9
- Puppet::Util::Execution.execute("find #{destdir} -type f -exec chmod a-wst {} +")
10
- Puppet::Util::Execution.execute("chown -R #{owner} #{destdir}")
3
+ sourcefile = File.expand_path(sourcefile)
4
+ destdir = File.expand_path(destdir)
5
+
6
+ Dir.chdir(destdir) do
7
+ tarball = Puppet::Util::Execution.execute(['gzip', '-dc', sourcefile])
8
+ Puppet::Util::Execution.execpipe(['tar', 'xof', '-'], true, 'w+') do |pipe|
9
+ pipe.write(tarball)
10
+ end
11
+
12
+ Puppet::Util::Execution.execute(['find', destdir] + %w[-type d -exec chmod 755 {} +])
13
+ Puppet::Util::Execution.execute(['find', destdir] + %w[-type f -exec chmod a-wst {} +])
14
+ Puppet::Util::Execution.execute(['chown', '-R', owner, destdir])
15
+ end
11
16
  end
12
17
 
13
18
  def pack(sourcedir, destfile)
14
- Puppet::Util::Execution.execute("tar cf - #{sourcedir} | gzip -c > #{destfile}")
19
+ tarball = Puppet::Util::Execution.execute(['tar', 'cf', '-', sourcedir])
20
+ Puppet::Util::Execution.execpipe(['gzip', '-c'], true, 'w+') do |pipe|
21
+ pipe.write(tarball)
22
+ pipe.close_write
23
+ File.open(destfile, 'w+') do |file|
24
+ file.write(pipe.read)
25
+ end
26
+ end
15
27
  end
16
28
  end
@@ -1,8 +1,4 @@
1
1
  class Puppet::ModuleTool::Tar::Mini
2
- def initialize(module_name)
3
- @module_name = module_name
4
- end
5
-
6
2
  def unpack(sourcefile, destdir, _)
7
3
  Zlib::GzipReader.open(sourcefile) do |reader|
8
4
  Archive::Tar::Minitar.unpack(reader, destdir) do |action, name, stats|
@@ -27,15 +23,13 @@ class Puppet::ModuleTool::Tar::Mini
27
23
 
28
24
  def validate_entry(destdir, path)
29
25
  if Pathname.new(path).absolute?
30
- raise Puppet::ModuleTool::Errors::InvalidPathInPackageError,
31
- :requested_package => @module_name, :entry_path => path, :directory => destdir
26
+ raise Puppet::ModuleTool::Errors::InvalidPathInPackageError, :entry_path => path, :directory => destdir
32
27
  end
33
28
 
34
29
  path = File.expand_path File.join(destdir, path)
35
30
 
36
31
  if path !~ /\A#{Regexp.escape destdir}/
37
- raise Puppet::ModuleTool::Errors::InvalidPathInPackageError,
38
- :requested_package => @module_name, :entry_path => path, :directory => destdir
32
+ raise Puppet::ModuleTool::Errors::InvalidPathInPackageError, :entry_path => path, :directory => destdir
39
33
  end
40
34
  end
41
35
  end
@@ -65,7 +65,7 @@ class Puppet::Network::HTTP::API::V1
65
65
 
66
66
  configured_environment = Puppet.lookup(:environments).get(environment)
67
67
  if configured_environment.nil?
68
- raise Puppet::Network::HTTP::Error::HTTPNotFoundError.new("Could not find #{environment}", Puppet::Network::HTTP::Issues::ENVIRONMENT_NOT_FOUND)
68
+ raise Puppet::Network::HTTP::Error::HTTPNotFoundError.new("Could not find environment '#{environment}'", Puppet::Network::HTTP::Issues::ENVIRONMENT_NOT_FOUND)
69
69
  else
70
70
  configured_environment = configured_environment.override_from_commandline(Puppet.settings)
71
71
  params[:environment] = configured_environment
@@ -2,12 +2,14 @@ class Puppet::Network::HTTP::API::V2::Authorization
2
2
  include Puppet::Network::Authorization
3
3
 
4
4
  def call(request, response)
5
- raise Puppet::Network::HTTP::Error::HTTPNotAuthorizedError, "Only GET requests are authorized for V2 endpoints" unless request.method == "GET"
5
+ if request.method != "GET"
6
+ raise Puppet::Network::HTTP::Error::HTTPNotAuthorizedError.new("Only GET requests are authorized for V2 endpoints", Puppet::Network::HTTP::Issues::UNSUPPORTED_METHOD)
7
+ end
6
8
 
7
9
  begin
8
10
  check_authorization(:find, request.path, request.params)
9
11
  rescue Puppet::Network::AuthorizationError => e
10
- raise Puppet::Network::HTTP::Error::HTTPNotAuthorizedError, e.message, e.backtrace
12
+ raise Puppet::Network::HTTP::Error::HTTPNotAuthorizedError.new(e.message, Puppet::Network::HTTP::Issues::FAILED_AUTHORIZATION)
11
13
  end
12
14
  end
13
15
  end
@@ -7,4 +7,5 @@ module Puppet::Network::HTTP::Issues
7
7
  MISSING_HEADER_FIELD = :MISSING_HEADER_FIELD
8
8
  UNSUPPORTED_FORMAT = :UNSUPPORTED_FORMAT
9
9
  UNSUPPORTED_METHOD = :UNSUPPORTED_METHOD
10
+ FAILED_AUTHORIZATION = :FAILED_AUTHORIZATION
10
11
  end
@@ -12,6 +12,15 @@ module Puppet::Network; end
12
12
  #
13
13
  module Puppet::Network::HttpPool
14
14
 
15
+ @http_client_class = Puppet::Network::HTTP::Connection
16
+
17
+ def self.http_client_class
18
+ @http_client_class
19
+ end
20
+ def self.http_client_class=(klass)
21
+ @http_client_class = klass
22
+ end
23
+
15
24
  # Retrieve a connection for the given host and port.
16
25
  #
17
26
  # @param host [String] The hostname to connect to
@@ -29,9 +38,9 @@ module Puppet::Network::HttpPool
29
38
  Puppet::SSL::Validator.no_validator()
30
39
  end
31
40
 
32
- Puppet::Network::HTTP::Connection.new(host, port,
33
- :use_ssl => use_ssl,
34
- :verify => verifier)
41
+ http_client_class.new(host, port,
42
+ :use_ssl => use_ssl,
43
+ :verify => verifier)
35
44
  end
36
45
 
37
46
  # Get an http connection that will be secured with SSL and have the
@@ -46,8 +55,8 @@ module Puppet::Network::HttpPool
46
55
  # @api public
47
56
  #
48
57
  def self.http_ssl_instance(host, port, verifier = Puppet::SSL::Validator.default_validator())
49
- Puppet::Network::HTTP::Connection.new(host, port,
50
- :use_ssl => true,
51
- :verify => verifier)
58
+ http_client_class.new(host, port,
59
+ :use_ssl => true,
60
+ :verify => verifier)
52
61
  end
53
62
  end
@@ -65,7 +65,8 @@ class Puppet::Node::Environment
65
65
 
66
66
  obj = self.create(symbol,
67
67
  split_path(Puppet.settings.value(:modulepath, symbol)),
68
- Puppet.settings.value(:manifest, symbol))
68
+ Puppet.settings.value(:manifest, symbol),
69
+ Puppet.settings.value(:config_version, symbol))
69
70
  seen[symbol] = obj
70
71
  end
71
72
 
@@ -75,18 +76,36 @@ class Puppet::Node::Environment
75
76
  # @param modulepath [Array<String>] the list of paths from which to load modules
76
77
  # @param manifest [String] the path to the manifest for the environment or
77
78
  # the constant Puppet::Node::Environment::NO_MANIFEST if there is none.
79
+ # @param config_version [String] path to a script whose output will be added
80
+ # to report logs (optional)
78
81
  # @return [Puppet::Node::Environment]
79
82
  #
80
83
  # @api public
81
- def self.create(name, modulepath, manifest = NO_MANIFEST)
84
+ def self.create(name, modulepath, manifest = NO_MANIFEST, config_version = nil)
82
85
  obj = self.allocate
83
86
  obj.send(:initialize,
84
87
  name,
85
88
  expand_dirs(extralibs() + modulepath),
86
- manifest == NO_MANIFEST ? manifest : File.expand_path(manifest))
89
+ manifest == NO_MANIFEST ? manifest : File.expand_path(manifest),
90
+ config_version)
87
91
  obj
88
92
  end
89
93
 
94
+ # A "reference" to a remote environment. The created environment instance
95
+ # isn't expected to exist on the local system, but is instead a reference to
96
+ # environment information on a remote system. For instance when a catalog is
97
+ # being applied, this will be used on the agent.
98
+ #
99
+ # @note This does not provide access to the information of the remote
100
+ # environment's modules, manifest, or anything else. It is simply a value
101
+ # object to pass around and use as an environment.
102
+ #
103
+ # @param name [Symbol] The name of the remote environment
104
+ #
105
+ def self.remote(name)
106
+ create(name, [], NO_MANIFEST)
107
+ end
108
+
90
109
  # Instantiate a new environment
91
110
  #
92
111
  # @note {Puppet::Node::Environment.new} is overridden to return memoized
@@ -94,38 +113,67 @@ class Puppet::Node::Environment
94
113
  # semantics.
95
114
  #
96
115
  # @param name [Symbol] The environment name
97
- def initialize(name, modulepath, manifest)
116
+ def initialize(name, modulepath, manifest, config_version)
98
117
  @name = name
99
118
  @modulepath = modulepath
100
119
  @manifest = manifest
120
+ @config_version = config_version
121
+ # set watching to true for legacy environments - the directory based environment loaders will set this to
122
+ # false for directory based environments after the environment has been created.
123
+ @watching = true
124
+ end
125
+
126
+ # Returns if files are being watched or not.
127
+ # @api private
128
+ #
129
+ def watching?
130
+ @watching
131
+ end
132
+
133
+ # Turns watching of files on or off
134
+ # @param flag [TrueClass, FalseClass] if files should be watched or not
135
+ # @ api private
136
+ def watching=(flag)
137
+ @watching = flag
101
138
  end
102
139
 
103
140
  # Creates a new Puppet::Node::Environment instance, overriding any of the passed
104
141
  # parameters.
105
142
  #
106
143
  # @param env_params [Hash<{Symbol => String,Array<String>}>] new environment
107
- # parameters (:modulepath, :manifest)
144
+ # parameters (:modulepath, :manifest, :config_version)
108
145
  # @return [Puppet::Node::Environment]
109
146
  def override_with(env_params)
110
147
  return self.class.create(name,
111
148
  env_params[:modulepath] || modulepath,
112
- env_params[:manifest] || manifest)
149
+ env_params[:manifest] || manifest,
150
+ env_params[:config_version] || config_version)
113
151
  end
114
152
 
115
153
  # Creates a new Puppet::Node::Environment instance, overriding manfiest
116
- # and modulepath from the passed settings if they were originally set from
117
- # the commandline, or returns self if there is nothing to override.
154
+ # modulepath, or :config_version from the passed settings if they were
155
+ # originally set from the commandline, or returns self if there is nothing to
156
+ # override.
118
157
  #
119
158
  # @param settings [Puppet::Settings] an initialized puppet settings instance
120
159
  # @return [Puppet::Node::Environment] new overridden environment or self if
121
160
  # there are no commandline changes from settings.
122
161
  def override_from_commandline(settings)
123
162
  overrides = {}
124
- overrides[:modulepath] = self.class.split_path(settings[:modulepath]) if settings.set_by_cli?(:modulepath)
163
+
164
+ if settings.set_by_cli?(:modulepath)
165
+ overrides[:modulepath] = self.class.split_path(settings.value(:modulepath))
166
+ end
167
+
168
+ if settings.set_by_cli?(:config_version)
169
+ overrides[:config_version] = settings.value(:config_version)
170
+ end
171
+
125
172
  if settings.set_by_cli?(:manifest) ||
126
- (settings.set_by_cli?(:manifestdir) && settings[:manifest].start_with?(settings[:manifestdir]))
127
- overrides[:manifest] = settings[:manifest]
173
+ (settings.set_by_cli?(:manifestdir) && settings.value(:manifest).start_with?(settings.value(:manifestdir)))
174
+ overrides[:manifest] = settings.value(:manifest)
128
175
  end
176
+
129
177
  overrides.empty? ?
130
178
  self :
131
179
  self.override_with(overrides)
@@ -183,6 +231,12 @@ class Puppet::Node::Environment
183
231
  # @return [String] path to the manifest file or directory.
184
232
  attr_reader :manifest
185
233
 
234
+ # @!attribute [r] config_version
235
+ # @api public
236
+ # @return [String] path to a script whose output will be added to report logs
237
+ # (optional)
238
+ attr_reader :config_version
239
+
186
240
  # Return an environment-specific Puppet setting.
187
241
  #
188
242
  # @api public
@@ -342,36 +396,47 @@ class Puppet::Node::Environment
342
396
  # for an explanation of the return value.
343
397
  def module_requirements
344
398
  deps = {}
399
+
345
400
  modules.each do |mod|
346
401
  next unless mod.forge_name
347
402
  deps[mod.forge_name] ||= []
403
+
348
404
  mod.dependencies and mod.dependencies.each do |mod_dep|
349
- deps[mod_dep['name']] ||= []
350
- dep_details = {
405
+ dep_name = mod_dep['name'].tr('-', '/')
406
+ (deps[dep_name] ||= []) << {
351
407
  'name' => mod.forge_name,
352
408
  'version' => mod.version,
353
409
  'version_requirement' => mod_dep['version_requirement']
354
410
  }
355
- deps[mod_dep['name']] << dep_details
356
411
  end
357
412
  end
413
+
358
414
  deps.each do |mod, mod_deps|
359
- deps[mod] = mod_deps.sort_by {|d| d['name']}
415
+ deps[mod] = mod_deps.sort_by { |d| d['name'] }
360
416
  end
417
+
361
418
  deps
362
419
  end
363
420
 
364
421
  # Set a periodic watcher on the file, so we can tell if it has changed.
365
- # @param filename [File,String] File instance or filename
422
+ # If watching has been turned off, this call has no effect.
423
+ # @param file[File,String] File instance or filename
366
424
  # @api private
367
425
  def watch_file(file)
368
- known_resource_types.watch_file(file.to_s)
426
+ if watching?
427
+ known_resource_types.watch_file(file.to_s)
428
+ end
369
429
  end
370
430
 
431
+ # Checks if a reparse is required (cache of files is stale).
432
+ # This call does nothing unless files are being watched.
433
+ #
371
434
  def check_for_reparse
372
- if (Puppet[:code] != @parsed_code) || (@known_resource_types && @known_resource_types.require_reparse?)
373
- @parsed_code = nil
374
- @known_resource_types = nil
435
+ if watching?
436
+ if (Puppet[:code] != @parsed_code) || (@known_resource_types && @known_resource_types.require_reparse?)
437
+ @parsed_code = nil
438
+ @known_resource_types = nil
439
+ end
375
440
  end
376
441
  end
377
442
 
@@ -493,4 +558,10 @@ class Puppet::Node::Environment
493
558
  def empty_parse_result
494
559
  return Puppet::Parser::AST::Hostclass.new('')
495
560
  end
561
+
562
+ # A special "null" environment
563
+ #
564
+ # This environment should be used when there is no specific environment in
565
+ # effect.
566
+ NONE = create(:none, [])
496
567
  end