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
@@ -50,14 +50,14 @@ describe "Puppet Network Format" do
50
50
  end
51
51
 
52
52
  it "should be able to serialize a catalog" do
53
- cat = Puppet::Resource::Catalog.new('foo')
53
+ cat = Puppet::Resource::Catalog.new('foo', Puppet::Node::Environment.create(:testing, []))
54
54
  cat.add_resource(Puppet::Resource.new(:file, 'my_file'))
55
55
  catunpack = MessagePack.unpack(cat.to_msgpack)
56
56
  catunpack.should include(
57
57
  "tags"=>[],
58
58
  "name"=>"foo",
59
59
  "version"=>nil,
60
- "environment"=>"",
60
+ "environment"=>"testing",
61
61
  "edges"=>[],
62
62
  "classes"=>[]
63
63
  )
@@ -17,6 +17,27 @@ describe Puppet::Network::HttpPool do
17
17
  http.port.should == 54321
18
18
  end
19
19
 
20
+ it "should support using an alternate http client implementation" do
21
+ begin
22
+ class FooClient
23
+ def initialize(host, port, options = {})
24
+ @host = host
25
+ @port = port
26
+ end
27
+ attr_reader :host, :port
28
+ end
29
+
30
+ orig_class = Puppet::Network::HttpPool.http_client_class
31
+ Puppet::Network::HttpPool.http_client_class = FooClient
32
+ http = Puppet::Network::HttpPool.http_instance("me", 54321)
33
+ http.should be_an_instance_of FooClient
34
+ http.host.should == 'me'
35
+ http.port.should == 54321
36
+ ensure
37
+ Puppet::Network::HttpPool.http_client_class = orig_class
38
+ end
39
+ end
40
+
20
41
  it "should enable ssl on the http instance by default" do
21
42
  Puppet::Network::HttpPool.http_instance("me", 54321).should be_use_ssl
22
43
  end
@@ -355,11 +355,12 @@ describe Puppet::Network::Rights do
355
355
  end
356
356
 
357
357
  it "should allow setting an environment filters" do
358
- Puppet::Node::Environment.stubs(:new).with(:environment).returns(:env)
358
+ env = Puppet::Node::Environment.create(:acltest, [])
359
+ Puppet.override(:environments => Puppet::Environments::Static.new(env)) do
360
+ @acl.restrict_environment(:acltest)
359
361
 
360
- @acl.restrict_environment(:environment)
361
-
362
- @acl.environment.should == [:env]
362
+ @acl.environment.should == [env]
363
+ end
363
364
  end
364
365
 
365
366
  ["on", "yes", "true", true].each do |auth|
@@ -392,11 +393,12 @@ describe Puppet::Network::Rights do
392
393
  end
393
394
 
394
395
  it "should return :dunno if this right is not restricted to the given environment" do
395
- Puppet::Node::Environment.stubs(:new).returns(:production)
396
-
397
- @acl.restrict_environment(:production)
396
+ prod = Puppet::Node::Environment.create(:prod, [])
397
+ Puppet.override(:environments => Puppet::Environments::Static.new(prod)) do
398
+ @acl.restrict_environment(:production)
398
399
 
399
- @acl.allowed?("me","127.0.0.1", { :method => :save, :environment => :development }).should == :dunno
400
+ @acl.allowed?("me","127.0.0.1", { :method => :save, :environment => :development }).should == :dunno
401
+ end
400
402
  end
401
403
 
402
404
  it "should return :dunno if this right is not restricted to the given request authentication state" do
@@ -46,7 +46,7 @@ describe Puppet::Node::Environment do
46
46
  describe "overriding an existing environment" do
47
47
  let(:original_path) { [tmpdir('original')] }
48
48
  let(:new_path) { [tmpdir('new')] }
49
- let(:environment) { Puppet::Node::Environment.create(:overridden, original_path, 'orig.pp') }
49
+ let(:environment) { Puppet::Node::Environment.create(:overridden, original_path, 'orig.pp', '/config/script') }
50
50
 
51
51
  it "overrides modulepath" do
52
52
  overridden = environment.override_with(:modulepath => new_path)
@@ -54,6 +54,7 @@ describe Puppet::Node::Environment do
54
54
  expect(overridden.name).to eq(:overridden)
55
55
  expect(overridden.manifest).to eq(File.expand_path('orig.pp'))
56
56
  expect(overridden.modulepath).to eq(new_path)
57
+ expect(overridden.config_version).to eq('/config/script')
57
58
  end
58
59
 
59
60
  it "overrides manifest" do
@@ -62,6 +63,16 @@ describe Puppet::Node::Environment do
62
63
  expect(overridden.name).to eq(:overridden)
63
64
  expect(overridden.manifest).to eq(File.expand_path('new.pp'))
64
65
  expect(overridden.modulepath).to eq(original_path)
66
+ expect(overridden.config_version).to eq('/config/script')
67
+ end
68
+
69
+ it "overrides config_version" do
70
+ overridden = environment.override_with(:config_version => '/new/script')
71
+ expect(overridden).to_not be_equal(environment)
72
+ expect(overridden.name).to eq(:overridden)
73
+ expect(overridden.manifest).to eq(File.expand_path('orig.pp'))
74
+ expect(overridden.modulepath).to eq(original_path)
75
+ expect(overridden.config_version).to eq('/new/script')
65
76
  end
66
77
  end
67
78
 
@@ -149,6 +160,20 @@ describe Puppet::Node::Environment do
149
160
  env.should respond_to(:[])
150
161
  end
151
162
 
163
+ it "obtains its core values from the puppet settings instance as a legacy env" do
164
+ Puppet.settings.parse_config(<<-CONF)
165
+ [testing]
166
+ manifest = /some/manifest
167
+ modulepath = /some/modulepath
168
+ config_version = /some/script
169
+ CONF
170
+
171
+ env = Puppet::Node::Environment.new("testing")
172
+ expect(env.full_modulepath).to eq([File.expand_path('/some/modulepath')])
173
+ expect(env.manifest).to eq(File.expand_path('/some/manifest'))
174
+ expect(env.config_version).to eq('/some/script')
175
+ end
176
+
152
177
  it "should ask the Puppet settings instance for the setting qualified with the environment name" do
153
178
  Puppet.settings.parse_config(<<-CONF)
154
179
  [testing]
@@ -251,7 +276,7 @@ describe Puppet::Node::Environment do
251
276
  @first,
252
277
  :metadata => {
253
278
  :author => 'puppetlabs',
254
- :dependencies => [{ 'name' => 'puppetlabs/bar', "version_requirement" => "3.0.0" }]
279
+ :dependencies => [{ 'name' => 'puppetlabs-bar', "version_requirement" => "3.0.0" }]
255
280
  }
256
281
  )
257
282
  PuppetSpec::Modules.create(
@@ -407,7 +407,7 @@ describe Puppet::Parser::Collector, "when collecting exported resources", :if =>
407
407
  @compiler.add_resource(@scope, local)
408
408
 
409
409
  expect { @collector.evaluate }.
410
- to raise_error Puppet::ParseError, /exists with the type and title/
410
+ to raise_error Puppet::ParseError, /A duplicate resource was found while collecting exported resources/
411
411
  end
412
412
 
413
413
  it "should ignore exported resources that match already-collected resources" do
@@ -646,7 +646,7 @@ describe Puppet::Parser::Compiler do
646
646
  @node.classes = klass
647
647
  klass = Puppet::Resource::Type.new(:hostclass, 'foo', :arguments => {})
648
648
  @compiler.topscope.known_resource_types.add klass
649
- lambda { @compiler.compile }.should raise_error(Puppet::ParseError, "Invalid parameter 3")
649
+ lambda { @compiler.compile }.should raise_error(Puppet::ParseError, "Invalid parameter 3 on Class[Foo]")
650
650
  end
651
651
 
652
652
  it "should ensure class is in catalog without params" do
@@ -110,6 +110,10 @@ describe "the generate function" do
110
110
  File.delete(command) if Puppet::FileSystem.exist?(command)
111
111
  end
112
112
 
113
+ it "returns the output as a String" do
114
+ scope.function_generate([command]).class.should == String
115
+ end
116
+
113
117
  it "should call generator with no arguments" do
114
118
  scope.function_generate([command]).should == "a- b-\n"
115
119
  end
@@ -276,10 +276,26 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl/AccessOperator' do
276
276
  expect(evaluate(expr)).to be_the_type(types.host_class('apache'))
277
277
  expr = fqr('Class')[literal('apache')]
278
278
  expect(evaluate(expr)).to be_the_type(types.host_class('apache'))
279
+ end
279
280
 
281
+ it 'produces an array of Class when args are in an array' do
280
282
  # arguments are flattened
281
283
  expr = fqr('Class')[[fqn('apache')]]
282
- expect(evaluate(expr)).to be_the_type(types.host_class('apache'))
284
+ expect(evaluate(expr)[0]).to be_the_type(types.host_class('apache'))
285
+ end
286
+
287
+ it 'produces undef for Class if arg is undef' do
288
+ # arguments are flattened
289
+ expr = fqr('Class')[nil]
290
+ expect(evaluate(expr)).to be_nil
291
+ end
292
+
293
+ it 'produces empty array for Class if arg is [undef]' do
294
+ # arguments are flattened
295
+ expr = fqr('Class')[[]]
296
+ expect(evaluate(expr)).to be_eql([])
297
+ expr = fqr('Class')[[nil]]
298
+ expect(evaluate(expr)).to be_eql([])
283
299
  end
284
300
 
285
301
  it 'raises error if access is to no keys' do
@@ -304,21 +320,28 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl/AccessOperator' do
304
320
  expect { evaluate(expr) }.to raise_error(/Illegal name/)
305
321
  end
306
322
 
307
- it 'gives an error if an empty array is given as argument' do
308
- expr = fqr('Class')[literal([])]
323
+ it 'gives an error if no keys are given as argument' do
324
+ expr = fqr('Class')[]
309
325
  expect {evaluate(expr)}.to raise_error(/Evaluation Error: Class\[\] accepts 1 or more arguments. Got 0/)
310
326
  end
311
327
 
328
+ it 'produces an empty array if the keys reduce to empty array' do
329
+ expr = fqr('Class')[literal([[],[]])]
330
+ expect(evaluate(expr)).to be_eql([])
331
+ end
332
+
312
333
  # Resource
313
334
  it 'produces a specific resource type from Resource[type]' do
314
335
  expr = fqr('Resource')[fqr('File')]
315
336
  expect(evaluate(expr)).to be_the_type(types.resource('File'))
316
337
  expr = fqr('Resource')[literal('File')]
317
338
  expect(evaluate(expr)).to be_the_type(types.resource('File'))
339
+ end
318
340
 
341
+ it 'does not allow the type to be specified in an array' do
319
342
  # arguments are flattened
320
343
  expr = fqr('Resource')[[fqr('File')]]
321
- expect(evaluate(expr)).to be_the_type(types.resource('File'))
344
+ expect{evaluate(expr)}.to raise_error(Puppet::ParseError, /must be a resource type or a String/)
322
345
  end
323
346
 
324
347
  it 'produces a specific resource reference type from File[title]' do
@@ -340,14 +363,30 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl/AccessOperator' do
340
363
  expect(result[1]).to be_the_type(types.resource('File', 'y'))
341
364
  end
342
365
 
343
- it 'gives an error if an empty array is given as argument' do
344
- expr = fqr('Resource')[literal([])]
345
- expect {evaluate(expr)}.to raise_error(/Evaluation Error: Resource\[\] accepts 1 to 2 arguments. Got 0/)
366
+ it 'produces undef for Resource if arg is undef' do
367
+ # arguments are flattened
368
+ expr = fqr('File')[nil]
369
+ expect(evaluate(expr)).to be_nil
370
+ end
371
+
372
+ it 'gives an error if no keys are given as argument to Resource' do
373
+ expr = fqr('Resource')[]
374
+ expect {evaluate(expr)}.to raise_error(/Evaluation Error: Resource\[\] accepts 1 or more arguments. Got 0/)
375
+ end
376
+
377
+ it 'produces an empty array if the type is given, and keys reduce to empty array for Resource' do
378
+ expr = fqr('Resource')[fqr('File'),literal([[],[]])]
379
+ expect(evaluate(expr)).to be_eql([])
380
+ end
381
+
382
+ it 'gives an error i no keys are given as argument to a specific Resource type' do
383
+ expr = fqr('File')[]
384
+ expect {evaluate(expr)}.to raise_error(/Evaluation Error: File\[\] accepts 1 or more arguments. Got 0/)
346
385
  end
347
386
 
348
- it 'gives an error if an empty array is given as argument' do
349
- expr = fqr('File')[literal([])]
350
- expect {evaluate(expr)}.to raise_error(/Evaluation Error: File\[\] accepts 1 argument. Got 0/)
387
+ it 'produces an empty array if the keys reduce to empty array for a specific Resource tyoe' do
388
+ expr = fqr('File')[literal([[],[]])]
389
+ expect(evaluate(expr)).to be_eql([])
351
390
  end
352
391
 
353
392
  it 'gives an error if resource is not found' do
@@ -389,7 +428,7 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl/AccessOperator' do
389
428
  end
390
429
 
391
430
  failure_message_for_should do |actual|
392
- "expected #{calc.string(type)}, but was #{calc.string(actual)}"
431
+ "expected #{type.to_s}, but was #{actual.to_s}"
393
432
  end
394
433
  end
395
434
 
@@ -181,6 +181,7 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
181
181
  "'1' < 1.1" => true,
182
182
  "1.0 == 1 " => true,
183
183
  "1.0 < 2 " => true,
184
+ "1.0 < 'a'" => true,
184
185
  "'1.0' < 1.1" => true,
185
186
  "'1.0' < 'a'" => true,
186
187
  "'1.0' < '' " => true,
@@ -659,6 +660,9 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
659
660
  "notify { id: message=>explicit} Notify[id][message]" => "explicit",
660
661
  "Notify { message=>by_default} notify {foo:} Notify[foo][message]" => "by_default",
661
662
  "notify {foo:} Notify[foo]{message =>by_override} Notify[foo][message]" => "by_override",
663
+ "notify { foo: tag => evoe} Notify[foo][tag]" => "evoe",
664
+ # Does not produce the defaults for tag
665
+ "notify { foo: } Notify[foo][tag]" => nil,
662
666
  }.each do |source, result|
663
667
  it "should parse and evaluate the expression '#{source}' to #{result}" do
664
668
  parser.evaluate_string(scope, source, __FILE__).should == result
@@ -669,6 +673,9 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
669
673
  {
670
674
  "notify { xid: message=>explicit} Notify[id][message]" => /Resource not found/,
671
675
  "notify { id: message=>explicit} Notify[id][mustard]" => /does not have a parameter called 'mustard'/,
676
+ # NOTE: these meta-esque parameters are not recognized as such
677
+ "notify { id: message=>explicit} Notify[id][title]" => /does not have a parameter called 'title'/,
678
+ "notify { id: message=>explicit} Notify[id]['type']" => /does not have a parameter called 'type'/,
672
679
  }.each do |source, result|
673
680
  it "should parse '#{source}' and raise error matching #{result}" do
674
681
  expect { parser.evaluate_string(scope, source, __FILE__)}.to raise_error(result)
@@ -760,6 +767,10 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
760
767
  expect { parser.evaluate_string(scope, source, __FILE__) }.to raise_error(Puppet::ParseError)
761
768
  end
762
769
  end
770
+
771
+ it "provides location information on error in unparenthesized call logic" do
772
+ expect{parser.evaluate_string(scope, "include non_existing_class", __FILE__)}.to raise_error(Puppet::ParseError, /line 1\:1/)
773
+ end
763
774
  end
764
775
 
765
776
  context "When evaluator performs string interpolation" do
@@ -961,6 +972,20 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
961
972
  end
962
973
 
963
974
  end
975
+ context "Handles Deprecations and Discontinuations" do
976
+ around(:each) do |example|
977
+ Puppet.override({:loaders => Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, []))}, 'test') do
978
+ example.run
979
+ end
980
+ end
981
+
982
+ it 'of import statements' do
983
+ source = "\nimport foo"
984
+ # Error references position 5 at the opening '{'
985
+ # Set file to nil to make it easier to match with line number (no file name in output)
986
+ expect { parser.evaluate_string(scope, source) }.to raise_error(/'import' has been discontinued.*line 2:1/)
987
+ end
988
+ end
964
989
 
965
990
  context "Detailed Error messages are reported" do
966
991
  it 'for illegal type references' do
@@ -0,0 +1,44 @@
1
+ require 'spec_helper'
2
+ require 'puppet_spec/files'
3
+ require 'puppet/pops'
4
+ require 'puppet/loaders'
5
+
6
+ describe 'dependency loader' do
7
+ include PuppetSpec::Files
8
+
9
+ let(:static_loader) { Puppet::Pops::Loader::StaticLoader.new() }
10
+ let(:loaders) { Puppet::Pops::Loaders.new(Puppet::Node::Environment.create(:testing, [])) }
11
+
12
+ describe 'FileBased module loader' do
13
+ it 'load something in global name space raises an error' do
14
+ module_dir = dir_containing('testmodule', {
15
+ 'lib' => { 'puppet' => { 'functions' => { 'testmodule' => {
16
+ 'foo.rb' => 'Puppet::Functions.create_function("foo") { def foo; end; }'
17
+ }}}}})
18
+
19
+ module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, loaders, 'testmodule', module_dir, 'test1')
20
+ dep_loader = Puppet::Pops::Loader::DependencyLoader.new(static_loader, 'test-dep', [module_loader])
21
+ expect do
22
+ dep_loader.load_typed(typed_name(:function, 'testmodule::foo')).value
23
+ end.to raise_error(ArgumentError, /produced mis-matched name, expected 'testmodule::foo', got foo/)
24
+ end
25
+
26
+ it 'can load something in a qualified name space' do
27
+ module_dir = dir_containing('testmodule', {
28
+ 'lib' => { 'puppet' => { 'functions' => { 'testmodule' => {
29
+ 'foo.rb' => 'Puppet::Functions.create_function("testmodule::foo") { def foo; end; }'
30
+ }}}}})
31
+ module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, loaders, 'testmodule', module_dir, 'test1')
32
+ dep_loader = Puppet::Pops::Loader::DependencyLoader.new(static_loader, 'test-dep', [module_loader])
33
+
34
+ function = dep_loader.load_typed(typed_name(:function, 'testmodule::foo')).value
35
+
36
+ expect(function.class.name).to eq('testmodule::foo')
37
+ expect(function.is_a?(Puppet::Functions::Function)).to eq(true)
38
+ end
39
+ end
40
+
41
+ def typed_name(type, name)
42
+ Puppet::Pops::Loader::Loader::TypedName.new(type, name)
43
+ end
44
+ end
@@ -0,0 +1,66 @@
1
+ require 'spec_helper'
2
+ require 'puppet_spec/files'
3
+ require 'puppet/pops'
4
+ require 'puppet/loaders'
5
+
6
+ describe 'loader paths' do
7
+ include PuppetSpec::Files
8
+ before(:each) { Puppet[:biff] = true }
9
+
10
+ let(:static_loader) { Puppet::Pops::Loader::StaticLoader.new() }
11
+ let(:unused_loaders) { nil }
12
+
13
+ describe 'the relative_path_for_types method' do
14
+ it 'produces paths to load in precendence order' do
15
+ module_dir = dir_containing('testmodule', {
16
+ 'functions' => {},
17
+ 'lib' => {
18
+ 'puppet' => {
19
+ 'functions' => {},
20
+ 'parser' => {
21
+ 'functions' => {},
22
+ }
23
+ }}})
24
+ module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, unused_loaders, 'testmodule', module_dir, 'test1')
25
+
26
+ effective_paths = Puppet::Pops::Loader::LoaderPaths.relative_paths_for_type(:function, module_loader)
27
+
28
+ expect(effective_paths.collect(&:generic_path)).to eq([
29
+ File.join(module_dir, 'lib', 'puppet', 'functions'), # 4x functions
30
+ File.join(module_dir, 'lib', 'puppet','parser', 'functions') # 3x functions
31
+ ])
32
+ end
33
+
34
+ it 'module loader has smart-paths that prunes unavailable paths' do
35
+ module_dir = dir_containing('testmodule', {'lib' => {'puppet' => {'functions' => {'foo.rb' => 'Puppet::Functions.create_function("testmodule::foo") { def foo; end; }' }}}})
36
+ module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, unused_loaders, 'testmodule', module_dir, 'test1')
37
+
38
+ effective_paths = module_loader.smart_paths.effective_paths(:function)
39
+
40
+ expect(effective_paths.size).to be_eql(1)
41
+ expect(effective_paths[0].generic_path).to be_eql(File.join(module_dir, 'lib', 'puppet', 'functions'))
42
+ expect(module_loader.path_index.size).to be_eql(1)
43
+ expect(module_loader.path_index.include?(File.join(module_dir, 'lib', 'puppet', 'functions', 'foo.rb'))).to be(true)
44
+ end
45
+
46
+ it 'all function smart-paths produces entries if they exist' do
47
+ module_dir = dir_containing('testmodule', {
48
+ 'lib' => {
49
+ 'puppet' => {
50
+ 'functions' => {'foo4x.rb' => 'ignored in this test'},
51
+ 'parser' => {
52
+ 'functions' => {'foo3x.rb' => 'ignored in this test'},
53
+ }
54
+ }}})
55
+ module_loader = Puppet::Pops::Loader::ModuleLoaders::FileBased.new(static_loader, unused_loaders, 'testmodule', module_dir, 'test1')
56
+
57
+ effective_paths = module_loader.smart_paths.effective_paths(:function)
58
+
59
+ expect(effective_paths.size).to eq(2)
60
+ expect(module_loader.path_index.size).to eq(2)
61
+ path_index = module_loader.path_index
62
+ expect(path_index.include?(File.join(module_dir, 'lib', 'puppet', 'functions', 'foo4x.rb'))).to eq(true)
63
+ expect(path_index.include?(File.join(module_dir, 'lib', 'puppet', 'parser', 'functions', 'foo3x.rb'))).to eq(true)
64
+ end
65
+ end
66
+ end