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
@@ -15,6 +15,9 @@ require 'rgen/metamodel_builder'
15
15
  # @api public
16
16
  #
17
17
  module Puppet::Pops::Types
18
+ # Used as end in a range
19
+ INFINITY = 1.0 / 0.0
20
+ NEGATIVE_INFINITY = -INFINITY
18
21
 
19
22
  class PAbstractType < Puppet::Pops::Model::PopsObject
20
23
  abstract
@@ -134,15 +137,15 @@ module Puppet::Pops::Types
134
137
 
135
138
  # Returns Float.Infinity if one end of the range is unbound
136
139
  def size
137
- return 1.0 / 0.0 if from.nil? || to.nil?
140
+ return INFINITY if from.nil? || to.nil?
138
141
  1+(to-from).abs
139
142
  end
140
143
 
141
144
  # Returns the range as an array ordered so the smaller number is always first.
142
145
  # The number may be Infinity or -Infinity.
143
146
  def range
144
- f = from || -(1.0 / 0.0)
145
- t = to || (1.0 / 0.0)
147
+ f = from || NEGATIVE_INFINITY
148
+ t = to || INFINITY
146
149
  if f < t
147
150
  [f, t]
148
151
  else
@@ -253,9 +256,23 @@ module Puppet::Pops::Types
253
256
  class PCollectionType < PObjectType
254
257
  contains_one_uni 'element_type', PAbstractType
255
258
  contains_one_uni 'size_type', PIntegerType
259
+
256
260
  module ClassModule
261
+ # Returns an array with from (min) size to (max) size
262
+ # A negative range value in from is
263
+ def size_range
264
+ return [0, INFINITY] if size_type.nil?
265
+ f = size_type.from || 0
266
+ t = size_type.to || INFINITY
267
+ if f < t
268
+ [f, t]
269
+ else
270
+ [t,f]
271
+ end
272
+ end
273
+
257
274
  def hash
258
- [self.class, element_type, size].hash
275
+ [self.class, element_type, size_type].hash
259
276
  end
260
277
 
261
278
  def ==(o)
@@ -344,6 +361,50 @@ module Puppet::Pops::Types
344
361
  end
345
362
  end
346
363
 
364
+ class PCallableType < PObjectType
365
+ # Types of parameters and required/optional count
366
+ contains_one_uni 'param_types', PTupleType, :lowerBound => 1
367
+
368
+ # Although being an abstract type reference, only PAbstractCallable, and Optional[Callable] are supported
369
+ # If not set, the meaning is that block is not supported.
370
+ #
371
+ contains_one_uni 'block_type', PAbstractType, :lowerBound => 0
372
+
373
+ module ClassModule
374
+ # Returns the number of accepted arguments [min, max]
375
+ def size_range
376
+ param_types.size_range
377
+ end
378
+
379
+ # Returns the number of accepted arguments for the last parameter type [min, max]
380
+ #
381
+ def last_range
382
+ param_types.repeat_last_range
383
+ end
384
+
385
+ # Range [0,0], [0,1], or [1,1] for the block
386
+ #
387
+ def block_range
388
+ case block_type
389
+ when Puppet::Pops::Types::POptionalType
390
+ [0,1]
391
+ when Puppet::Pops::Types::PVariantType, Puppet::Pops::Types::PCallableType
392
+ [1,1]
393
+ else
394
+ [0,0]
395
+ end
396
+ end
397
+
398
+ def hash
399
+ [self.class, Set.new(param_types), block_type].hash
400
+ end
401
+
402
+ def ==(o)
403
+ self.class == o.class && args_type == o.args_type && block_type == o.block_type
404
+ end
405
+ end
406
+ end
407
+
347
408
  # @api public
348
409
  class PArrayType < PCollectionType
349
410
  module ClassModule
@@ -210,7 +210,7 @@ class Puppet::Pops::Validation::Checker4_0
210
210
  end
211
211
  end
212
212
 
213
- # for 'class' and 'define'
213
+ # for 'class', 'define', and function
214
214
  def check_NamedDefinition(o)
215
215
  top(o.eContainer, o)
216
216
  if o.name !~ Puppet::Pops::Patterns::CLASSREF
@@ -25,7 +25,7 @@ class Puppet::Pops::Validation::ValidatorFactory_4_0 < Puppet::Pops::Validation:
25
25
 
26
26
  p[Issues::NAME_WITH_HYPHEN] = :error
27
27
  p[Issues::DEPRECATED_NAME_AS_TYPE] = :error
28
-
28
+ p[Issues::EMPTY_RESOURCE_SPECIALIZATION] = :ignore
29
29
  p
30
30
  end
31
31
  end
@@ -54,7 +54,7 @@ module Puppet
54
54
 
55
55
  def retrieve
56
56
  #ok, some 'convention' if the list property is named groups, provider should implement a groups method
57
- if tmp = provider.send(name) and tmp != :absent
57
+ if provider and tmp = provider.send(name) and tmp != :absent
58
58
  return tmp.split(delimiter)
59
59
  else
60
60
  return :absent
@@ -393,8 +393,8 @@ Puppet::Type.type(:augeas).provide(:augeas) do
393
393
  root = resource[:root].sub(/^\/$/, "")
394
394
  saved_files.map! {|key| @aug.get(key).sub(/^\/files/, root) }
395
395
  saved_files.uniq.each do |saved_file|
396
- if Puppet[:show_diff]
397
- notice "\n" + diff(saved_file, saved_file + ".augnew")
396
+ if Puppet[:show_diff] && @resource[:show_diff]
397
+ self.send(@resource[:loglevel], "\n" + diff(saved_file, saved_file + ".augnew"))
398
398
  end
399
399
  File.delete(saved_file + ".augnew")
400
400
  end
@@ -89,6 +89,14 @@ Puppet::Type.type(:cron).provide(:crontab, :parent => Puppet::Provider::ParsedFi
89
89
  end
90
90
  end
91
91
 
92
+ def create
93
+ if resource.should(:command) then
94
+ super
95
+ else
96
+ resource.err "no command specified, cannot create"
97
+ end
98
+ end
99
+
92
100
  # Look up a resource with a given name whose user matches a record target
93
101
  #
94
102
  # @api private
@@ -105,8 +113,11 @@ Puppet::Type.type(:cron).provide(:crontab, :parent => Puppet::Provider::ParsedFi
105
113
  def self.resource_for_record(record, resources)
106
114
  resource = super
107
115
 
108
- if resource and record[:target] == resource[:user]
109
- resource
116
+ if resource
117
+ target = resource[:target] || resource[:user]
118
+ if record[:target] == target
119
+ resource
120
+ end
110
121
  end
111
122
  end
112
123
 
@@ -25,4 +25,28 @@ class Puppet::Provider::Package < Puppet::Provider
25
25
  def validate_source(value)
26
26
  true
27
27
  end
28
+
29
+ # Turns a array of options into flags to be passed to a command.
30
+ # The options can be passed as a string or hash. Note that passing a hash
31
+ # should only be used in case --foo=bar must be passed,
32
+ # which can be accomplished with:
33
+ # install_options => [ { '--foo' => 'bar' } ]
34
+ # Regular flags like '--foo' must be passed as a string.
35
+ # @param options [Array]
36
+ # @return Concatenated list of options
37
+ # @api private
38
+ def join_options(options)
39
+ return unless options
40
+
41
+ options.collect do |val|
42
+ case val
43
+ when Hash
44
+ val.keys.sort.collect do |k|
45
+ "#{k}=#{val[k]}"
46
+ end
47
+ else
48
+ val
49
+ end
50
+ end.flatten
51
+ end
28
52
  end
@@ -4,7 +4,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
4
4
 
5
5
  desc "Package management via `apt-get`."
6
6
 
7
- has_feature :versionable
7
+ has_feature :versionable, :install_options
8
8
 
9
9
  commands :aptget => "/usr/bin/apt-get"
10
10
  commands :aptcache => "/usr/bin/apt-cache"
@@ -63,6 +63,7 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
63
63
  cmd << "--force-yes"
64
64
  end
65
65
 
66
+ cmd += install_options if @resource[:install_options]
66
67
  cmd << :install << str
67
68
 
68
69
  aptget(*cmd)
@@ -104,4 +105,8 @@ Puppet::Type.type(:package).provide :apt, :parent => :dpkg, :source => :dpkg do
104
105
  # workaround a "bug" in apt, that already removed packages are not purged
105
106
  super
106
107
  end
108
+
109
+ def install_options
110
+ join_options(@resource[:install_options])
111
+ end
107
112
  end
@@ -8,7 +8,7 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
8
8
  interpreted as the path to a local gem file. If source is not present at all,
9
9
  the gem will be installed from the default gem repositories."
10
10
 
11
- has_feature :versionable
11
+ has_feature :versionable, :install_options
12
12
 
13
13
  commands :gemcmd => "gem"
14
14
 
@@ -97,6 +97,8 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
97
97
  command << "--no-rdoc" << "--no-ri" << resource[:name]
98
98
  end
99
99
 
100
+ command += install_options if resource[:install_options]
101
+
100
102
  output = execute(command)
101
103
  # Apparently some stupid gem versions don't exit non-0 on failure
102
104
  self.fail "Could not install: #{output.chomp}" if output.include?("ERROR")
@@ -122,4 +124,8 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
122
124
  def update
123
125
  self.install(false)
124
126
  end
125
- end
127
+
128
+ def install_options
129
+ join_options(resource[:install_options])
130
+ end
131
+ end
@@ -122,19 +122,4 @@ Puppet::Type.type(:package).provide(:msi, :parent => Puppet::Provider::Package)
122
122
  def shell_quote(value)
123
123
  value.include?(' ') ? %Q["#{value.gsub(/"/, '\"')}"] : value
124
124
  end
125
-
126
- def join_options(options)
127
- return unless options
128
-
129
- options.collect do |val|
130
- case val
131
- when Hash
132
- val.keys.sort.collect do |k|
133
- "#{k}=#{val[k]}"
134
- end.join(' ')
135
- else
136
- val
137
- end
138
- end
139
- end
140
125
  end
@@ -141,30 +141,6 @@ Puppet::Type.type(:package).provide :openbsd, :parent => Puppet::Provider::Packa
141
141
  join_options(resource[:uninstall_options])
142
142
  end
143
143
 
144
- # Turns a array of options into flags to be passed to pkg_add(8) and
145
- # pkg_delete(8). The options can be passed as a string or hash. Note
146
- # that passing a hash should only be used in case -Dfoo=bar must be passed,
147
- # which can be accomplished with:
148
- # install_options => [ { '-Dfoo' => 'bar' } ]
149
- # Regular flags like '-L' must be passed as a string.
150
- # @param options [Array]
151
- # @return Concatenated list of options
152
- # @api private
153
- def join_options(options)
154
- return unless options
155
-
156
- options.collect do |val|
157
- case val
158
- when Hash
159
- val.keys.sort.collect do |k|
160
- "#{k}=#{val[k]}"
161
- end.join(' ')
162
- else
163
- val
164
- end
165
- end
166
- end
167
-
168
144
  def uninstall
169
145
  pkgdelete uninstall_options.flatten.compact.join(' '), @resource[:name]
170
146
  end
@@ -111,7 +111,6 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
111
111
  end
112
112
 
113
113
  def install
114
- source = nil
115
114
  unless source = @resource[:source]
116
115
  @resource.fail "RPMs must specify a package source"
117
116
  end
@@ -124,8 +123,7 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
124
123
 
125
124
  flag = ["-i"]
126
125
  flag = ["-U", "--oldpackage"] if @property_hash[:ensure] and @property_hash[:ensure] != :absent
127
-
128
- flag = flag + install_options
126
+ flag += install_options if resource[:install_options]
129
127
  rpm flag, source
130
128
  end
131
129
 
@@ -149,7 +147,8 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
149
147
  end
150
148
  end
151
149
 
152
- flag = ["-e"] + uninstall_options
150
+ flag = ['-e']
151
+ flag += uninstall_options if resource[:uninstall_options]
153
152
  rpm flag, nvr
154
153
  end
155
154
 
@@ -166,31 +165,6 @@ Puppet::Type.type(:package).provide :rpm, :source => :rpm, :parent => Puppet::Pr
166
165
  end
167
166
 
168
167
  private
169
-
170
- # Turns a array of options into flags to be passed to rpm install(8) and
171
- # The options can be passed as a string or hash. Note that passing a hash
172
- # should only be used in case -Dfoo=bar must be passed,
173
- # which can be accomplished with:
174
- # install_options => [ { '-Dfoo' => 'bar' } ]
175
- # Regular flags like '-L' must be passed as a string.
176
- # @param options [Array]
177
- # @return Concatenated list of options
178
- # @api private
179
- def join_options(options)
180
- return [] unless options
181
-
182
- options.collect do |val|
183
- case val
184
- when Hash
185
- val.keys.sort.collect do |k|
186
- "#{k}=#{val[k]}"
187
- end.join(' ')
188
- else
189
- val
190
- end
191
- end
192
- end
193
-
194
168
  # @param line [String] one line of rpm package query information
195
169
  # @return [Hash] of NEVRA_FIELDS strings parsed from package info
196
170
  # or an empty hash if we failed to parse
@@ -105,19 +105,4 @@ Puppet::Type.type(:package).provide(:windows, :parent => Puppet::Provider::Packa
105
105
  def uninstall_options
106
106
  join_options(resource[:uninstall_options])
107
107
  end
108
-
109
- def join_options(options)
110
- return unless options
111
-
112
- options.collect do |val|
113
- case val
114
- when Hash
115
- val.keys.sort.collect do |k|
116
- "#{k}=#{val[k]}"
117
- end.join(' ')
118
- else
119
- val
120
- end
121
- end
122
- end
123
108
  end
@@ -7,14 +7,12 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
7
7
  remove dependent packages with this provider use the `purgeable` feature, but note this
8
8
  feature is destructive and should be used with the utmost care."
9
9
 
10
- has_feature :versionable
10
+ has_feature :install_options, :versionable
11
11
 
12
12
  commands :yum => "yum", :rpm => "rpm", :python => "python"
13
13
 
14
14
  self::YUMHELPER = File::join(File::dirname(__FILE__), "yumhelper.py")
15
15
 
16
- attr_accessor :latest_info
17
-
18
16
  if command('rpm')
19
17
  confine :true => begin
20
18
  rpm('--version')
@@ -30,28 +28,65 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
30
28
  def self.prefetch(packages)
31
29
  raise Puppet::Error, "The yum provider can only be used as root" if Process.euid != 0
32
30
  super
33
- return unless packages.detect { |name, package| package.should(:ensure) == :latest }
34
-
35
- # collect our 'latest' info
36
- updates = {}
37
- python(self::YUMHELPER).each_line do |l|
38
- l.chomp!
39
- next if l.empty?
40
- if l[0,4] == "_pkg"
41
- hash = nevra_to_hash(l[5..-1])
42
- [hash[:name], "#{hash[:name]}.#{hash[:arch]}"].each do |n|
43
- updates[n] ||= []
44
- updates[n] << hash
45
- end
46
- end
31
+ end
32
+
33
+ # Retrieve the latest package version information for a given package name
34
+ # and combination of repos to enable and disable.
35
+ #
36
+ # @note If multiple package versions are defined (such as in the case where a
37
+ # package is built for multiple architectures), the first package found
38
+ # will be used.
39
+ #
40
+ # @api private
41
+ # @param package [String] The name of the package to query
42
+ # @param enablerepo [Array<String>] A list of repositories to enable for this query
43
+ # @param disablerepo [Array<String>] A list of repositories to disable for this query
44
+ # @return [Hash<Symbol, String>]
45
+ def self.latest_package_version(package, enablerepo, disablerepo)
46
+
47
+ key = [enablerepo, disablerepo]
48
+
49
+ @latest_versions ||= {}
50
+ if @latest_versions[key].nil?
51
+ @latest_versions[key] = fetch_latest_versions(enablerepo, disablerepo)
47
52
  end
48
53
 
49
- # Add our 'latest' info to the providers.
50
- packages.each do |name, package|
51
- if info = updates[package[:name]]
52
- package.provider.latest_info = info[0]
53
- end
54
+ if @latest_versions[key][package]
55
+ @latest_versions[key][package].first
56
+ end
57
+ end
58
+
59
+ # Search for all installed packages that have newer versions, given a
60
+ # combination of repositories to enable and disable.
61
+ #
62
+ # @api private
63
+ # @param enablerepo [Array<String>] A list of repositories to enable for this query
64
+ # @param disablerepo [Array<String>] A list of repositories to disable for this query
65
+ # @return [Hash<String, Array<Hash<String, String>>>] All packages that were
66
+ # found with a list of found versions for each package.
67
+ def self.fetch_latest_versions(enablerepo, disablerepo)
68
+ latest_versions = Hash.new {|h, k| h[k] = []}
69
+
70
+ args = [self::YUMHELPER]
71
+ args.concat(enablerepo.map { |repo| ['-e', repo] }.flatten)
72
+ args.concat(disablerepo.map { |repo| ['-d', repo] }.flatten)
73
+
74
+ python(args).scan(/^_pkg (.*)$/) do |match|
75
+ hash = nevra_to_hash(match[0])
76
+
77
+ # Create entries for both the package name without a version and a
78
+ # version since yum considers those as mostly interchangeable.
79
+ short_name = hash[:name]
80
+ long_name = "#{hash[:name]}.#{hash[:arch]}"
81
+
82
+ latest_versions[short_name] << hash
83
+ latest_versions[long_name] << hash
54
84
  end
85
+ latest_versions
86
+ end
87
+
88
+ def self.clear
89
+ @latest_versions = nil
55
90
  end
56
91
 
57
92
  def install
@@ -74,7 +109,9 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
74
109
  end
75
110
  end
76
111
 
77
- yum "-d", "0", "-e", "0", "-y", operation, wanted
112
+ args = ["-d", "0", "-e", "0", "-y", install_options, operation, wanted].compact
113
+ yum *args
114
+
78
115
 
79
116
  is = self.query
80
117
  raise Puppet::Error, "Could not find package #{self.name}" unless is
@@ -86,7 +123,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
86
123
 
87
124
  # What's the latest package version available?
88
125
  def latest
89
- upd = latest_info
126
+ upd = self.class.latest_package_version(@resource[:name], enablerepo, disablerepo)
90
127
  unless upd.nil?
91
128
  # FIXME: there could be more than one update for a package
92
129
  # because of multiarch
@@ -107,4 +144,44 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
107
144
  def purge
108
145
  yum "-y", :erase, @resource[:name]
109
146
  end
147
+
148
+ # @deprecated
149
+ def latest_info
150
+ Puppet.deprecation_warning("#{self.class}##{__method__} is deprecated and is no longer used.")
151
+ @latest_info
152
+ end
153
+
154
+ # @deprecated
155
+ def latest_info=(latest)
156
+ Puppet.deprecation_warning("#{self.class}##{__method__} is deprecated and is no longer used.")
157
+ @latest_info = latest
158
+ end
159
+
160
+ private
161
+
162
+ def enablerepo
163
+ scan_options(resource[:install_options], '--enablerepo')
164
+ end
165
+
166
+ def disablerepo
167
+ scan_options(resource[:install_options], '--disablerepo')
168
+ end
169
+
170
+ # Scan a structure that looks like the package type 'install_options'
171
+ # structure for all hashes that have a specific key.
172
+ #
173
+ # @api private
174
+ # @param options [Array<String | Hash>, nil] The options structure. If the
175
+ # options are nil an empty array will be returned.
176
+ # @param key [String] The key to look for in all contained hashes
177
+ # @return [Array<String>] All hash values with the given key.
178
+ def scan_options(options, key)
179
+ return [] if options.nil?
180
+ options.inject([]) do |repos, opt|
181
+ if opt.is_a? Hash and opt[key]
182
+ repos << opt[key]
183
+ end
184
+ repos
185
+ end
186
+ end
110
187
  end