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
@@ -2,23 +2,25 @@
2
2
  require 'spec_helper'
3
3
  require 'puppet/face'
4
4
 
5
+ module PuppetFaceSpecs
5
6
  describe Puppet::Face[:config, '0.0.1'] do
7
+
8
+ FS = Puppet::FileSystem
9
+
6
10
  it "prints a single setting without the name" do
7
11
  Puppet[:trace] = true
8
12
 
9
- subject.expects(:puts).with(true)
10
-
11
- subject.print("trace").should be_nil
13
+ expect { subject.print("trace") }.to have_printed('true')
12
14
  end
13
15
 
14
16
  it "prints multiple settings with the names" do
15
17
  Puppet[:trace] = true
16
18
  Puppet[:syslogfacility] = "file"
17
19
 
18
- subject.expects(:puts).with("trace = true")
19
- subject.expects(:puts).with("syslogfacility = file")
20
-
21
- subject.print("trace", "syslogfacility")
20
+ expect { subject.print("trace", "syslogfacility") }.to have_printed(<<-OUTPUT)
21
+ trace = true
22
+ syslogfacility = file
23
+ OUTPUT
22
24
  end
23
25
 
24
26
  it "prints the setting from the selected section" do
@@ -27,12 +29,10 @@ describe Puppet::Face[:config, '0.0.1'] do
27
29
  syslogfacility = file
28
30
  CONF
29
31
 
30
- subject.expects(:puts).with("file")
31
-
32
- subject.print("syslogfacility", :section => "other")
32
+ expect { subject.print("syslogfacility", :section => "other") }.to have_printed('file')
33
33
  end
34
34
 
35
- it "should default to all when no arguments are given" do
35
+ it "defaults to all when no arguments are given" do
36
36
  subject.expects(:puts).times(Puppet.settings.to_a.length)
37
37
 
38
38
  subject.print
@@ -43,4 +43,104 @@ describe Puppet::Face[:config, '0.0.1'] do
43
43
 
44
44
  subject.print('all')
45
45
  end
46
+
47
+ shared_examples_for :config_printing_a_section do |section|
48
+
49
+ def add_section_option(args, section)
50
+ args << { :section => section } if section
51
+ args
52
+ end
53
+
54
+ it "prints directory env settings for an env that exists" do
55
+ FS.overlay(
56
+ FS::MemoryFile.a_directory(File.expand_path("/dev/null/environments"), [
57
+ FS::MemoryFile.a_directory("production", [
58
+ FS::MemoryFile.a_missing_file("environment.conf"),
59
+ ]),
60
+ ])
61
+ ) do
62
+ args = "environmentpath","manifest","modulepath","environment","basemodulepath"
63
+ expect { subject.print(*add_section_option(args, section)) }.to have_printed(<<-OUTPUT)
64
+ environmentpath = #{File.expand_path("/dev/null/environments")}
65
+ manifest = #{File.expand_path("/dev/null/environments/production/manifests")}
66
+ modulepath = #{File.expand_path("/dev/null/environments/production/modules")}#{File::PATH_SEPARATOR}#{File.expand_path("/some/base")}
67
+ environment = production
68
+ basemodulepath = #{File.expand_path("/some/base")}
69
+ OUTPUT
70
+ end
71
+ end
72
+
73
+ it "interpolates settings in environment.conf" do
74
+ FS.overlay(
75
+ FS::MemoryFile.a_directory(File.expand_path("/dev/null/environments"), [
76
+ FS::MemoryFile.a_directory("production", [
77
+ FS::MemoryFile.a_regular_file_containing("environment.conf", <<-CONTENT),
78
+ modulepath=/custom/modules#{File::PATH_SEPARATOR}$basemodulepath
79
+ CONTENT
80
+ ]),
81
+ ])
82
+ ) do
83
+ args = "environmentpath","manifest","modulepath","environment","basemodulepath"
84
+ expect { subject.print(*add_section_option(args, section)) }.to have_printed(<<-OUTPUT)
85
+ environmentpath = #{File.expand_path("/dev/null/environments")}
86
+ manifest = #{File.expand_path("/dev/null/environments/production/manifests")}
87
+ modulepath = #{File.expand_path("/custom/modules")}#{File::PATH_SEPARATOR}#{File.expand_path("/some/base")}
88
+ environment = production
89
+ basemodulepath = #{File.expand_path("/some/base")}
90
+ OUTPUT
91
+ end
92
+ end
93
+
94
+ it "prints the default configured env settings for an env that does not exist" do
95
+ Puppet[:environment] = 'doesnotexist'
96
+
97
+ FS.overlay(
98
+ FS::MemoryFile.a_directory(File.expand_path("/dev/null/environments"), [
99
+ FS::MemoryFile.a_missing_file("doesnotexist")
100
+ ])
101
+ ) do
102
+ args = "environmentpath","manifest","modulepath","environment","basemodulepath"
103
+ expect { subject.print(*add_section_option(args, section)) }.to have_printed(<<-OUTPUT)
104
+ environmentpath = #{File.expand_path("/dev/null/environments")}
105
+ manifest = no_manifest
106
+ modulepath =
107
+ environment = doesnotexist
108
+ basemodulepath = #{File.expand_path("/some/base")}
109
+ OUTPUT
110
+ end
111
+ end
112
+ end
113
+
114
+ context "when printing environment settings" do
115
+ before(:each) do
116
+ Puppet.settings.stubs(:global_defaults_initialized?).returns(:true)
117
+ end
118
+
119
+ context "from main section" do
120
+ before(:each) do
121
+ Puppet.settings.parse_config(<<-CONF)
122
+ [main]
123
+ environmentpath=$confdir/environments
124
+ basemodulepath=/some/base
125
+ CONF
126
+ end
127
+
128
+ it_behaves_like :config_printing_a_section
129
+ end
130
+
131
+ context "from master section" do
132
+
133
+ before(:each) do
134
+ Puppet.settings.parse_config(<<-CONF)
135
+ [master]
136
+ environmentpath=$confdir/environments
137
+ basemodulepath=/some/base
138
+ CONF
139
+ Puppet.settings.stubs(:global_defaults_initialized?).returns(:true)
140
+ end
141
+
142
+ it_behaves_like :config_printing_a_section, :master
143
+ end
144
+ end
145
+ end
46
146
  end
@@ -5,84 +5,28 @@ require 'puppet/module_tool'
5
5
  describe "puppet module install" do
6
6
  include PuppetSpec::Files
7
7
 
8
- subject { Puppet::Face[:module, :current] }
8
+ describe "action" do
9
+ let(:name) { stub(:name) }
10
+ let(:target_dir) { stub(:target_dir) }
11
+ let(:target_path) { stub(:target_path) }
12
+ let(:install_dir) { stub(:install_dir) }
13
+ let(:options) { { :target_dir => target_dir } }
9
14
 
10
- describe "option validation" do
11
- let(:sep) { File::PATH_SEPARATOR }
12
- let(:fakefirstpath) { make_absolute("/my/fake/modpath") }
13
- let(:fakesecondpath) { make_absolute("/other/fake/path") }
14
- let(:fakemodpath) { "#{fakefirstpath}#{sep}#{fakesecondpath}" }
15
- let(:fakedirpath) { make_absolute("/my/fake/path") }
16
- let(:options) { {} }
17
- let(:environment) do
18
- Puppet::Node::Environment.create(:env, [fakefirstpath, fakesecondpath])
19
- end
20
- let(:expected_options) do
21
- {
22
- :target_dir => fakefirstpath,
23
- :environment_instance => environment,
24
- }
25
- end
26
-
27
- around(:each) do |example|
28
- Puppet.override(:current_environment => environment) do
29
- example.run
30
- end
31
- end
32
-
33
- context "without any options" do
34
- it "requires a name" do
35
- pattern = /wrong number of arguments/
36
- expect { subject.install }.to raise_error ArgumentError, pattern
37
- end
38
-
39
- it "does not require any options" do
40
- expects_installer_run_with("puppetlabs-apache", expected_options)
41
-
42
- subject.install("puppetlabs-apache")
43
- end
44
- end
45
-
46
- it "accepts the --force option" do
47
- options[:force] = true
48
- expected_options.merge!(options)
49
-
50
- expects_installer_run_with("puppetlabs-apache", expected_options)
15
+ it 'should invoke the Installer app' do
16
+ args = [ name, install_dir, options ]
51
17
 
52
- subject.install("puppetlabs-apache", options)
53
- end
54
-
55
- it "accepts the --target-dir option" do
56
- options[:target_dir] = make_absolute("/foo/puppet/modules")
57
- expected_options.merge!(options)
58
- expected_options[:environment_instance] = environment.override_with(:modulepath => [options[:target_dir], fakefirstpath, fakesecondpath])
18
+ Puppet::ModuleTool.expects(:set_option_defaults).with(options)
59
19
 
60
- expects_installer_run_with("puppetlabs-apache", expected_options)
20
+ Pathname.expects(:new).with(target_dir).returns(target_path)
21
+ Puppet::ModuleTool::InstallDirectory.expects(:new).with(target_path).returns(install_dir)
22
+ Puppet::ModuleTool::Applications::Installer.expects(:run).with(*args)
61
23
 
62
- subject.install("puppetlabs-apache", options)
63
- end
64
-
65
- it "accepts the --version option" do
66
- options[:version] = "0.0.1"
67
- expected_options.merge!(options)
68
-
69
- expects_installer_run_with("puppetlabs-apache", expected_options)
70
-
71
- subject.install("puppetlabs-apache", options)
72
- end
73
-
74
- it "accepts the --ignore-dependencies option" do
75
- options[:ignore_dependencies] = true
76
- expected_options.merge!(options)
77
-
78
- expects_installer_run_with("puppetlabs-apache", expected_options)
79
-
80
- subject.install("puppetlabs-apache", options)
24
+ Puppet::Face[:module, :current].install(name, options)
81
25
  end
82
26
  end
83
27
 
84
28
  describe "inline documentation" do
85
- subject { Puppet::Face[:module, :current].get_action :install }
29
+ subject { Puppet::Face.find_action(:module, :install) }
86
30
 
87
31
  its(:summary) { should =~ /install.*module/im }
88
32
  its(:description) { should =~ /install.*module/im }
@@ -95,19 +39,4 @@ describe "puppet module install" do
95
39
  end
96
40
  end
97
41
  end
98
-
99
- def expects_installer_run_with(name, options)
100
- installer = mock("Installer")
101
- install_dir = mock("InstallDir")
102
- forge = mock("Forge")
103
-
104
- Puppet::Forge.expects(:new).with("PMT", subject.version).returns(forge)
105
- Puppet::ModuleTool::InstallDirectory.expects(:new).
106
- with(Pathname.new(expected_options[:target_dir])).
107
- returns(install_dir)
108
- Puppet::ModuleTool::Applications::Installer.expects(:new).
109
- with("puppetlabs-apache", forge, install_dir, expected_options).
110
- returns(installer)
111
- installer.expects(:run)
112
- end
113
42
  end
@@ -8,27 +8,21 @@ require 'puppet_spec/modules'
8
8
  describe "puppet module list" do
9
9
  include PuppetSpec::Files
10
10
 
11
- before do
11
+ around do |example|
12
12
  dir = tmpdir("deep_path")
13
13
 
14
- @modpath1 = File.join(dir, "modpath1")
15
- @modpath2 = File.join(dir, "modpath2")
16
- @modulepath = "#{@modpath1}#{File::PATH_SEPARATOR}#{@modpath2}"
17
- Puppet.settings[:modulepath] = @modulepath
18
-
19
- FileUtils.mkdir_p(@modpath1)
20
- FileUtils.mkdir_p(@modpath2)
21
- end
14
+ FileUtils.mkdir_p(@modpath1 = File.join(dir, "modpath1"))
15
+ FileUtils.mkdir_p(@modpath2 = File.join(dir, "modpath2"))
16
+ FileUtils.mkdir_p(@modpath3 = File.join(dir, "modpath3"))
22
17
 
23
- around do |example|
24
- Puppet.override(:environments => Puppet::Environments::Legacy.new()) do
18
+ env = Puppet::Node::Environment.create(:env, [@modpath1, @modpath2])
19
+ Puppet.override(:current_environment => env) do
25
20
  example.run
26
21
  end
27
22
  end
28
23
 
29
24
  it "should return an empty list per dir in path if there are no modules" do
30
- Puppet.settings[:modulepath] = @modulepath
31
- Puppet::Face[:module, :current].list.should == {
25
+ Puppet::Face[:module, :current].list[:modules_by_path].should == {
32
26
  @modpath1 => [],
33
27
  @modpath2 => []
34
28
  }
@@ -39,15 +33,16 @@ describe "puppet module list" do
39
33
  barmod1 = PuppetSpec::Modules.create('bar', @modpath1)
40
34
  foomod2 = PuppetSpec::Modules.create('foo', @modpath2)
41
35
 
42
- usedenv = Puppet::Node::Environment.create(:useme, [@modpath1, @modpath2])
36
+ usedenv = Puppet::Node::Environment.create(:useme, [@modpath1, @modpath2, @modpath3])
43
37
 
44
38
  Puppet.override(:environments => Puppet::Environments::Static.new(usedenv)) do
45
- Puppet::Face[:module, :current].list(:environment => 'useme').should == {
39
+ Puppet::Face[:module, :current].list(:environment => 'useme')[:modules_by_path].should == {
46
40
  @modpath1 => [
47
41
  Puppet::Module.new('bar', barmod1.path, usedenv),
48
42
  Puppet::Module.new('foo', foomod1.path, usedenv)
49
43
  ],
50
- @modpath2 => [Puppet::Module.new('foo', foomod2.path, usedenv)]
44
+ @modpath2 => [Puppet::Module.new('foo', foomod2.path, usedenv)],
45
+ @modpath3 => [],
51
46
  }
52
47
  end
53
48
  end
@@ -56,15 +51,16 @@ describe "puppet module list" do
56
51
  foomod = PuppetSpec::Modules.create('foo', @modpath1)
57
52
  barmod = PuppetSpec::Modules.create('bar', @modpath1)
58
53
 
59
- usedenv = Puppet::Node::Environment.create(:useme, [@modpath1, @modpath2])
54
+ usedenv = Puppet::Node::Environment.create(:useme, [@modpath1, @modpath2, @modpath3])
60
55
 
61
56
  Puppet.override(:environments => Puppet::Environments::Static.new(usedenv)) do
62
- Puppet::Face[:module, :current].list(:environment => 'useme').should == {
57
+ Puppet::Face[:module, :current].list(:environment => 'useme')[:modules_by_path].should == {
63
58
  @modpath1 => [
64
59
  Puppet::Module.new('bar', barmod.path, usedenv),
65
60
  Puppet::Module.new('foo', foomod.path, usedenv)
66
61
  ],
67
- @modpath2 => []
62
+ @modpath2 => [],
63
+ @modpath3 => [],
68
64
  }
69
65
  end
70
66
  end
@@ -73,7 +69,7 @@ describe "puppet module list" do
73
69
  foomod = PuppetSpec::Modules.create('foo', @modpath1)
74
70
  barmod = PuppetSpec::Modules.create('bar', @modpath2)
75
71
 
76
- modules = Puppet::Face[:module, :current].list(:modulepath => "#{@modpath1}#{File::PATH_SEPARATOR}#{@modpath2}")
72
+ modules = Puppet::Face[:module, :current].list(:modulepath => "#{@modpath1}#{File::PATH_SEPARATOR}#{@modpath2}")[:modules_by_path]
77
73
 
78
74
  expect(modules[@modpath1].first.name).to eq('foo')
79
75
  expect(modules[@modpath1].first.path).to eq(foomod.path)
@@ -88,9 +84,8 @@ describe "puppet module list" do
88
84
  foomod = PuppetSpec::Modules.create('foo', @modpath1)
89
85
  barmod = PuppetSpec::Modules.create('bar', @modpath2)
90
86
  env = Puppet::Node::Environment.create(:myenv, ['/tmp/notused'])
91
- Puppet[:modulepath] = ""
92
87
 
93
- modules = Puppet::Face[:module, :current].list(:environment => 'myenv', :modulepath => "#{@modpath1}#{File::PATH_SEPARATOR}#{@modpath2}")
88
+ modules = Puppet::Face[:module, :current].list(:environment => 'myenv', :modulepath => "#{@modpath1}#{File::PATH_SEPARATOR}#{@modpath2}")[:modules_by_path]
94
89
 
95
90
  expect(modules[@modpath1].first.name).to eq('foo')
96
91
  expect(modules[@modpath1].first.path).to eq(foomod.path)
@@ -104,7 +99,7 @@ describe "puppet module list" do
104
99
  end
105
100
 
106
101
  describe "inline documentation" do
107
- subject { Puppet::Face[:module, :current].get_action :list }
102
+ subject { Puppet::Face[:module, :current].get_action(:list) }
108
103
 
109
104
  its(:summary) { should =~ /list.*module/im }
110
105
  its(:description) { should =~ /list.*module/im }
@@ -112,33 +107,41 @@ describe "puppet module list" do
112
107
  its(:examples) { should_not be_empty }
113
108
  end
114
109
 
115
- describe "when rendering" do
110
+ describe "when rendering to console" do
111
+ let(:face) { Puppet::Face[:module, :current] }
112
+ let(:action) { face.get_action(:list) }
113
+
114
+ def console_output(options={})
115
+ result = face.list(options)
116
+ action.when_rendering(:console).call(result, options)
117
+ end
118
+
116
119
  it "should explicitly state when a modulepath is empty" do
117
120
  empty_modpath = tmpdir('empty')
118
- Puppet::Face[:module, :current].list_when_rendering_console(
119
- { empty_modpath => [] },
120
- {:modulepath => empty_modpath}
121
- ).should == <<-HEREDOC.gsub(' ', '')
121
+
122
+ expected = <<-HEREDOC.gsub(' ', '')
122
123
  #{empty_modpath} (no modules installed)
123
124
  HEREDOC
125
+
126
+ console_output(:modulepath => empty_modpath).should == expected
124
127
  end
125
128
 
126
129
  it "should print both modules with and without metadata" do
127
130
  modpath = tmpdir('modpath')
128
- Puppet.settings[:modulepath] = modpath
131
+
129
132
  PuppetSpec::Modules.create('nometadata', modpath)
130
133
  PuppetSpec::Modules.create('metadata', modpath, :metadata => {:author => 'metaman'})
131
134
 
132
- dependency_tree = Puppet::Face[:module, :current].list
133
-
134
- output = Puppet::Face[:module, :current].
135
- list_when_rendering_console(dependency_tree, {})
136
-
137
- output.should == <<-HEREDOC.gsub(' ', '')
138
- #{modpath}
139
- ├── metaman-metadata (\e[0;36mv9.9.9\e[0m)
140
- └── nometadata (\e[0;36m???\e[0m)
135
+ env = Puppet::Node::Environment.create(:environ, [modpath])
136
+ Puppet.override(:current_environment => env) do
137
+ expected = <<-HEREDOC.gsub(' ', '')
138
+ #{modpath}
139
+ ├── metaman-metadata (\e[0;36mv9.9.9\e[0m)
140
+ └── nometadata (\e[0;36m???\e[0m)
141
141
  HEREDOC
142
+
143
+ console_output.should == expected
144
+ end
142
145
  end
143
146
 
144
147
  it "should print the modulepaths in the order they are in the modulepath setting" do
@@ -146,21 +149,16 @@ describe "puppet module list" do
146
149
  path2 = tmpdir('c')
147
150
  path3 = tmpdir('a')
148
151
 
149
- sep = File::PATH_SEPARATOR
150
- Puppet.settings[:modulepath] = "#{path1}#{sep}#{path2}#{sep}#{path3}"
151
-
152
- Puppet::Face[:module, :current].list_when_rendering_console(
153
- {
154
- path2 => [],
155
- path3 => [],
156
- path1 => [],
157
- },
158
- {}
159
- ).should == <<-HEREDOC.gsub(' ', '')
160
- #{path1} (no modules installed)
161
- #{path2} (no modules installed)
162
- #{path3} (no modules installed)
163
- HEREDOC
152
+ env = Puppet::Node::Environment.create(:environ, [path1, path2, path3])
153
+ Puppet.override(:current_environment => env) do
154
+ expected = <<-HEREDOC.gsub(' ', '')
155
+ #{path1} (no modules installed)
156
+ #{path2} (no modules installed)
157
+ #{path3} (no modules installed)
158
+ HEREDOC
159
+
160
+ console_output.should == expected
161
+ end
164
162
  end
165
163
 
166
164
  it "should print dependencies as a tree" do
@@ -177,19 +175,67 @@ describe "puppet module list" do
177
175
  }
178
176
  )
179
177
 
180
- dependency_tree = Puppet::Face[:module, :current].list
181
-
182
- output = Puppet::Face[:module, :current].list_when_rendering_console(
183
- dependency_tree,
184
- {:tree => true}
185
- )
186
-
187
- output.should == <<-HEREDOC.gsub(' ', '')
178
+ expected = <<-HEREDOC.gsub(' ', '')
188
179
  #{@modpath1}
189
180
  └─┬ puppetlabs-other_mod (\e[0;36mv1.0.0\e[0m)
190
181
  └── puppetlabs-dependable (\e[0;36mv0.0.5\e[0m)
191
182
  #{@modpath2} (no modules installed)
192
- HEREDOC
183
+ HEREDOC
184
+
185
+ console_output(:tree => true).should == expected
186
+ end
187
+
188
+ it "should print both modules with and without metadata as a tree" do
189
+ PuppetSpec::Modules.create('nometadata', @modpath1)
190
+ PuppetSpec::Modules.create('metadata', @modpath1, :metadata => {:author => 'metaman'})
191
+
192
+ expected = <<-HEREDOC.gsub(' ', '')
193
+ #{@modpath1}
194
+ ├── metaman-metadata (\e[0;36mv9.9.9\e[0m)
195
+ └── nometadata (\e[0;36m???\e[0m)
196
+ #{@modpath2} (no modules installed)
197
+ HEREDOC
198
+
199
+ console_output.should == expected
200
+ end
201
+
202
+ it "should warn about missing dependencies" do
203
+ PuppetSpec::Modules.create('depender', @modpath1, :metadata => {
204
+ :version => '1.0.0',
205
+ :dependencies => [{
206
+ "version_requirement" => ">= 0.0.5",
207
+ "name" => "puppetlabs/dependable"
208
+ }]
209
+ })
210
+
211
+ warning_expectations = [
212
+ regexp_matches(/Missing dependency 'puppetlabs-dependable'/),
213
+ regexp_matches(/'puppetlabs-depender' \(v1\.0\.0\) requires 'puppetlabs-dependable' \(>= 0\.0\.5\)/)
214
+ ]
215
+
216
+ Puppet.expects(:warning).with(all_of(*warning_expectations))
217
+
218
+ console_output(:tree => true)
219
+ end
220
+
221
+ it "should warn about out of range dependencies" do
222
+ PuppetSpec::Modules.create('dependable', @modpath1, :metadata => { :version => '0.0.1'})
223
+ PuppetSpec::Modules.create('depender', @modpath1, :metadata => {
224
+ :version => '1.0.0',
225
+ :dependencies => [{
226
+ "version_requirement" => ">= 0.0.5",
227
+ "name" => "puppetlabs/dependable"
228
+ }]
229
+ })
230
+
231
+ warning_expectations = [
232
+ regexp_matches(/Module 'puppetlabs-dependable' \(v0\.0\.1\) fails to meet some dependencies/),
233
+ regexp_matches(/'puppetlabs-depender' \(v1\.0\.0\) requires 'puppetlabs-dependable' \(>= 0\.0\.5\)/)
234
+ ]
235
+
236
+ Puppet.expects(:warning).with(all_of(*warning_expectations))
237
+
238
+ console_output(:tree => true)
193
239
  end
194
240
  end
195
241
  end