puppet 3.5.1-x86-mingw32 → 3.6.0.rc1-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (342) hide show
  1. data/CONTRIBUTING.md +5 -0
  2. data/Gemfile +17 -9
  3. data/README.md +1 -0
  4. data/conf/fileserver.conf +4 -3
  5. data/ext/README.environment +8 -0
  6. data/ext/build_defaults.yaml +1 -1
  7. data/ext/debian/control +2 -2
  8. data/ext/debian/puppet-common.dirs +4 -0
  9. data/ext/debian/rules +4 -0
  10. data/ext/emacs/puppet-mode-init.el +1 -1
  11. data/ext/emacs/puppet-mode.el +36 -17
  12. data/ext/redhat/client.init +3 -3
  13. data/ext/redhat/puppet.spec.erb +9 -0
  14. data/ext/systemd/puppet.service +3 -4
  15. data/ext/systemd/puppetmaster.service +1 -3
  16. data/install.rb +1 -1
  17. data/lib/puppet.rb +2 -1
  18. data/lib/puppet/agent.rb +1 -1
  19. data/lib/puppet/application.rb +17 -17
  20. data/lib/puppet/application/doc.rb +1 -1
  21. data/lib/puppet/configurer.rb +4 -1
  22. data/lib/puppet/configurer/downloader.rb +13 -12
  23. data/lib/puppet/configurer/plugin_handler.rb +3 -3
  24. data/lib/puppet/context.rb +6 -1
  25. data/lib/puppet/defaults.rb +82 -12
  26. data/lib/puppet/environments.rb +169 -13
  27. data/lib/puppet/external/nagios/grammar.ry +2 -0
  28. data/lib/puppet/external/nagios/parser.rb +28 -19
  29. data/lib/puppet/face/config.rb +19 -6
  30. data/lib/puppet/face/module/generate.rb +209 -7
  31. data/lib/puppet/face/module/install.rb +17 -16
  32. data/lib/puppet/face/module/list.rb +83 -82
  33. data/lib/puppet/face/module/search.rb +1 -1
  34. data/lib/puppet/face/module/upgrade.rb +10 -9
  35. data/lib/puppet/face/parser.rb +3 -2
  36. data/lib/puppet/face/plugin.rb +8 -4
  37. data/lib/puppet/file_bucket/dipper.rb +6 -3
  38. data/lib/puppet/file_bucket/file.rb +4 -2
  39. data/lib/puppet/file_serving/metadata.rb +1 -1
  40. data/lib/puppet/file_system/memory_file.rb +27 -1
  41. data/lib/puppet/file_system/memory_impl.rb +15 -1
  42. data/lib/puppet/forge.rb +148 -52
  43. data/lib/puppet/forge/cache.rb +5 -1
  44. data/lib/puppet/forge/errors.rb +10 -0
  45. data/lib/puppet/forge/repository.rb +61 -26
  46. data/lib/puppet/functions.rb +548 -0
  47. data/lib/puppet/functions/assert_type.rb +42 -0
  48. data/lib/puppet/functions/import.rb +7 -0
  49. data/lib/puppet/indirector/facts/facter.rb +1 -1
  50. data/lib/puppet/indirector/file_bucket_file/file.rb +3 -2
  51. data/lib/puppet/indirector/rest.rb +18 -0
  52. data/lib/puppet/loaders.rb +20 -0
  53. data/lib/puppet/module.rb +2 -2
  54. data/lib/puppet/module_tool.rb +40 -14
  55. data/lib/puppet/module_tool/applications.rb +0 -1
  56. data/lib/puppet/module_tool/applications/application.rb +35 -26
  57. data/lib/puppet/module_tool/applications/builder.rb +16 -6
  58. data/lib/puppet/module_tool/applications/checksummer.rb +25 -19
  59. data/lib/puppet/module_tool/applications/installer.rb +196 -35
  60. data/lib/puppet/module_tool/applications/searcher.rb +1 -0
  61. data/lib/puppet/module_tool/applications/uninstaller.rb +7 -1
  62. data/lib/puppet/module_tool/applications/unpacker.rb +57 -31
  63. data/lib/puppet/module_tool/applications/upgrader.rb +221 -65
  64. data/lib/puppet/module_tool/checksums.rb +5 -8
  65. data/lib/puppet/module_tool/errors/installer.rb +12 -44
  66. data/lib/puppet/module_tool/errors/shared.rb +84 -11
  67. data/lib/puppet/module_tool/errors/upgrader.rb +16 -45
  68. data/lib/puppet/module_tool/install_directory.rb +7 -6
  69. data/lib/puppet/module_tool/installed_modules.rb +92 -0
  70. data/lib/puppet/module_tool/local_tarball.rb +91 -0
  71. data/lib/puppet/module_tool/metadata.rb +119 -115
  72. data/lib/puppet/module_tool/modulefile.rb +9 -9
  73. data/lib/puppet/module_tool/shared_behaviors.rb +19 -7
  74. data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +79 -0
  75. data/lib/puppet/module_tool/skeleton/templates/generator/Rakefile +18 -0
  76. data/lib/puppet/module_tool/skeleton/templates/generator/metadata.json.erb +1 -0
  77. data/lib/puppet/module_tool/skeleton/templates/generator/spec/classes/init_spec.rb.erb +7 -0
  78. data/lib/puppet/module_tool/tar.rb +3 -7
  79. data/lib/puppet/module_tool/tar/gnu.rb +21 -9
  80. data/lib/puppet/module_tool/tar/mini.rb +2 -8
  81. data/lib/puppet/network/http/api/v1.rb +1 -1
  82. data/lib/puppet/network/http/api/v2/authorization.rb +4 -2
  83. data/lib/puppet/network/http/issues.rb +1 -0
  84. data/lib/puppet/network/http_pool.rb +15 -6
  85. data/lib/puppet/node/environment.rb +91 -20
  86. data/lib/puppet/parser/ast/pops_bridge.rb +44 -3
  87. data/lib/puppet/parser/collector.rb +1 -1
  88. data/lib/puppet/parser/compiler.rb +50 -7
  89. data/lib/puppet/parser/functions.rb +6 -0
  90. data/lib/puppet/parser/functions/generate.rb +1 -1
  91. data/lib/puppet/parser/resource.rb +1 -1
  92. data/lib/puppet/pops.rb +22 -1
  93. data/lib/puppet/pops/adapters.rb +8 -1
  94. data/lib/puppet/pops/binder/bindings_composer.rb +1 -1
  95. data/lib/puppet/pops/binder/bindings_factory.rb +1 -1
  96. data/lib/puppet/pops/binder/config/binder_config_checker.rb +1 -1
  97. data/lib/puppet/pops/binder/producers.rb +2 -2
  98. data/lib/puppet/pops/evaluator/access_operator.rb +65 -25
  99. data/lib/puppet/pops/evaluator/callable_signature.rb +101 -0
  100. data/lib/puppet/pops/evaluator/closure.rb +57 -2
  101. data/lib/puppet/pops/evaluator/compare_operator.rb +1 -1
  102. data/lib/puppet/pops/evaluator/evaluator_impl.rb +9 -11
  103. data/lib/puppet/pops/evaluator/runtime3_support.rb +72 -21
  104. data/lib/puppet/pops/functions/dispatch.rb +71 -0
  105. data/lib/puppet/pops/functions/dispatcher.rb +237 -0
  106. data/lib/puppet/pops/functions/function.rb +77 -0
  107. data/lib/puppet/pops/issues.rb +12 -0
  108. data/lib/puppet/pops/loader/base_loader.rb +102 -0
  109. data/lib/puppet/pops/loader/dependency_loader.rb +60 -0
  110. data/lib/puppet/pops/loader/gem_support.rb +49 -0
  111. data/lib/puppet/pops/loader/loader.rb +180 -0
  112. data/lib/puppet/pops/loader/loader_paths.rb +137 -0
  113. data/lib/puppet/pops/loader/module_loaders.rb +242 -0
  114. data/lib/puppet/pops/loader/null_loader.rb +44 -0
  115. data/lib/puppet/pops/loader/ruby_function_instantiator.rb +34 -0
  116. data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +109 -0
  117. data/lib/puppet/pops/loader/simple_environment_loader.rb +20 -0
  118. data/lib/puppet/pops/loader/static_loader.rb +69 -0
  119. data/lib/puppet/pops/loader/uri_helper.rb +22 -0
  120. data/lib/puppet/pops/loaders.rb +240 -0
  121. data/lib/puppet/pops/model/factory.rb +13 -5
  122. data/lib/puppet/pops/model/model_tree_dumper.rb +12 -4
  123. data/lib/puppet/pops/parser/egrammar.ra +31 -18
  124. data/lib/puppet/pops/parser/eparser.rb +1137 -1106
  125. data/lib/puppet/pops/parser/lexer2.rb +17 -16
  126. data/lib/puppet/pops/semantic_error.rb +17 -0
  127. data/lib/puppet/pops/types/type_calculator.rb +150 -15
  128. data/lib/puppet/pops/types/type_factory.rb +69 -0
  129. data/lib/puppet/pops/types/type_parser.rb +9 -0
  130. data/lib/puppet/pops/types/types.rb +65 -4
  131. data/lib/puppet/pops/validation/checker4_0.rb +1 -1
  132. data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -1
  133. data/lib/puppet/property/list.rb +1 -1
  134. data/lib/puppet/provider/augeas/augeas.rb +2 -2
  135. data/lib/puppet/provider/cron/crontab.rb +13 -2
  136. data/lib/puppet/provider/package.rb +24 -0
  137. data/lib/puppet/provider/package/apt.rb +6 -1
  138. data/lib/puppet/provider/package/gem.rb +8 -2
  139. data/lib/puppet/provider/package/msi.rb +0 -15
  140. data/lib/puppet/provider/package/openbsd.rb +0 -24
  141. data/lib/puppet/provider/package/rpm.rb +3 -29
  142. data/lib/puppet/provider/package/windows.rb +0 -15
  143. data/lib/puppet/provider/package/yum.rb +101 -24
  144. data/lib/puppet/provider/package/yumhelper.py +31 -1
  145. data/lib/puppet/provider/package/zypper.rb +10 -28
  146. data/lib/puppet/provider/service/debian.rb +1 -1
  147. data/lib/puppet/provider/service/init.rb +3 -0
  148. data/lib/puppet/provider/service/openbsd.rb +318 -0
  149. data/lib/puppet/provider/service/redhat.rb +6 -3
  150. data/lib/puppet/provider/service/systemd.rb +2 -2
  151. data/lib/puppet/provider/yumrepo/inifile.rb +115 -42
  152. data/lib/puppet/resource.rb +13 -9
  153. data/lib/puppet/resource/catalog.rb +12 -6
  154. data/lib/puppet/resource/type_collection.rb +3 -3
  155. data/lib/puppet/settings.rb +57 -36
  156. data/lib/puppet/settings/config_file.rb +5 -0
  157. data/lib/puppet/settings/environment_conf.rb +147 -0
  158. data/lib/puppet/settings/ttl_setting.rb +48 -0
  159. data/lib/puppet/ssl/certificate_authority.rb +2 -3
  160. data/lib/puppet/ssl/certificate_authority/autosign_command.rb +1 -1
  161. data/lib/puppet/ssl/certificate_request.rb +4 -4
  162. data/lib/puppet/ssl/validator/default_validator.rb +2 -2
  163. data/lib/puppet/status.rb +1 -1
  164. data/lib/puppet/test/test_helper.rb +1 -0
  165. data/lib/puppet/type/augeas.rb +13 -1
  166. data/lib/puppet/type/cron.rb +32 -18
  167. data/lib/puppet/type/file.rb +4 -2
  168. data/lib/puppet/type/file/checksum.rb +15 -5
  169. data/lib/puppet/type/file/content.rb +3 -1
  170. data/lib/puppet/type/file/source.rb +5 -5
  171. data/lib/puppet/type/package.rb +12 -17
  172. data/lib/puppet/type/resources.rb +3 -1
  173. data/lib/puppet/type/scheduled_task.rb +4 -5
  174. data/lib/puppet/type/service.rb +12 -2
  175. data/lib/puppet/type/user.rb +106 -0
  176. data/lib/puppet/type/yumrepo.rb +9 -1
  177. data/lib/puppet/util/checksums.rb +60 -1
  178. data/lib/puppet/util/diff.rb +3 -1
  179. data/lib/puppet/util/execution.rb +20 -16
  180. data/lib/puppet/util/feature.rb +3 -0
  181. data/lib/puppet/util/logging.rb +19 -12
  182. data/lib/puppet/util/rubygems.rb +10 -0
  183. data/lib/puppet/util/watched_file.rb +1 -1
  184. data/lib/puppet/util/windows/security.rb +5 -3
  185. data/lib/puppet/vendor/load_semantic.rb +1 -0
  186. data/lib/puppet/vendor/require_vendored.rb +2 -0
  187. data/lib/puppet/vendor/semantic/Gemfile +20 -0
  188. data/lib/puppet/vendor/semantic/Rakefile +69 -0
  189. data/lib/puppet/vendor/semantic/lib/semantic.rb +7 -0
  190. data/lib/puppet/vendor/semantic/lib/semantic/dependency.rb +181 -0
  191. data/lib/puppet/vendor/semantic/lib/semantic/dependency/graph.rb +60 -0
  192. data/lib/puppet/vendor/semantic/lib/semantic/dependency/graph_node.rb +117 -0
  193. data/lib/puppet/vendor/semantic/lib/semantic/dependency/module_release.rb +46 -0
  194. data/lib/puppet/vendor/semantic/lib/semantic/dependency/source.rb +25 -0
  195. data/lib/puppet/vendor/semantic/lib/semantic/dependency/unsatisfiable_graph.rb +31 -0
  196. data/lib/puppet/vendor/semantic/lib/semantic/version.rb +168 -0
  197. data/lib/puppet/vendor/semantic/lib/semantic/version_range.rb +424 -0
  198. data/lib/puppet/vendor/semantic/spec/spec_helper.rb +24 -0
  199. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_node_spec.rb +141 -0
  200. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/graph_spec.rb +162 -0
  201. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/module_release_spec.rb +143 -0
  202. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/source_spec.rb +5 -0
  203. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency/unsatisfiable_graph_spec.rb +44 -0
  204. data/lib/puppet/vendor/semantic/spec/unit/semantic/dependency_spec.rb +383 -0
  205. data/lib/puppet/vendor/semantic/spec/unit/semantic/version_range_spec.rb +307 -0
  206. data/lib/puppet/vendor/semantic/spec/unit/semantic/version_spec.rb +608 -0
  207. data/lib/puppet/version.rb +1 -1
  208. data/spec/fixtures/java.tgz +0 -0
  209. data/spec/fixtures/stdlib.tgz +0 -0
  210. data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/usee/lib/puppet/functions/usee/callee.rb +5 -0
  211. data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/user/lib/puppet/functions/user/caller.rb +5 -0
  212. data/spec/fixtures/unit/pops/loaders/loaders/dependent_modules_with_metadata/user/metadata.json +9 -0
  213. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/modulea/rb_func_a.rb +5 -0
  214. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/lib/puppet/functions/rb_func_a.rb +5 -0
  215. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/manifests/init.pp +3 -0
  216. data/spec/fixtures/unit/pops/loaders/loaders/single_module/modules/modulea/metadata.json +19 -0
  217. data/spec/fixtures/unit/pops/loaders/loaders/wo_metadata_module/modules/moduleb/lib/puppet/functions/moduleb/rb_func_b.rb +6 -0
  218. data/spec/fixtures/unit/pops/loaders/loaders/wo_metadata_module/modules/moduleb/manifests/init.pp +3 -0
  219. data/spec/fixtures/unit/provider/naginator/define_empty_param +6 -0
  220. data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services +7 -0
  221. data/spec/fixtures/unit/type/user/authorized_keys +5 -0
  222. data/spec/integration/application/apply_spec.rb +1 -2
  223. data/spec/integration/configurer_spec.rb +2 -2
  224. data/spec/integration/faces/plugin_spec.rb +62 -0
  225. data/spec/integration/indirector/catalog/compiler_spec.rb +1 -1
  226. data/spec/integration/indirector/catalog/queue_spec.rb +1 -1
  227. data/spec/integration/node/environment_spec.rb +2 -2
  228. data/spec/integration/parser/future_compiler_spec.rb +96 -142
  229. data/spec/integration/parser/ruby_manifest_spec.rb +0 -5
  230. data/spec/integration/provider/cron/crontab_spec.rb +35 -0
  231. data/spec/integration/type/file_spec.rb +74 -72
  232. data/spec/integration/util/windows/security_spec.rb +17 -0
  233. data/spec/lib/matchers/resource.rb +45 -13
  234. data/spec/lib/puppet_spec/files.rb +18 -0
  235. data/spec/lib/puppet_spec/module_tool/shared_functions.rb +56 -0
  236. data/spec/lib/puppet_spec/module_tool/stub_source.rb +133 -0
  237. data/spec/shared_contexts/checksums.rb +55 -0
  238. data/spec/unit/application/apply_spec.rb +10 -7
  239. data/spec/unit/application/doc_spec.rb +17 -10
  240. data/spec/unit/application/indirection_base_spec.rb +18 -10
  241. data/spec/unit/application/inspect_spec.rb +22 -20
  242. data/spec/unit/configurer/downloader_spec.rb +7 -6
  243. data/spec/unit/configurer/plugin_handler_spec.rb +5 -8
  244. data/spec/unit/configurer_spec.rb +1 -1
  245. data/spec/unit/context_spec.rb +23 -0
  246. data/spec/unit/environments_spec.rb +274 -16
  247. data/spec/unit/face/config_spec.rb +111 -11
  248. data/spec/unit/face/module/install_spec.rb +14 -85
  249. data/spec/unit/face/module/list_spec.rb +108 -62
  250. data/spec/unit/face/module/search_spec.rb +1 -1
  251. data/spec/unit/face/module/uninstall_spec.rb +21 -42
  252. data/spec/unit/face/parser_spec.rb +5 -2
  253. data/spec/unit/file_bucket/dipper_spec.rb +92 -86
  254. data/spec/unit/file_bucket/file_spec.rb +23 -75
  255. data/spec/unit/file_serving/metadata_spec.rb +74 -74
  256. data/spec/unit/forge/module_release_spec.rb +131 -0
  257. data/spec/unit/forge/repository_spec.rb +21 -20
  258. data/spec/unit/forge_spec.rb +99 -23
  259. data/spec/unit/functions/assert_type_spec.rb +59 -0
  260. data/spec/unit/functions4_spec.rb +671 -0
  261. data/spec/unit/indirector/catalog/static_compiler_spec.rb +2 -2
  262. data/spec/unit/indirector/facts/facter_spec.rb +9 -3
  263. data/spec/unit/indirector/file_bucket_file/file_spec.rb +156 -155
  264. data/spec/unit/indirector/rest_spec.rb +8 -0
  265. data/spec/unit/interface/face_collection_spec.rb +35 -23
  266. data/spec/unit/module_spec.rb +20 -8
  267. data/spec/unit/module_tool/applications/builder_spec.rb +40 -12
  268. data/spec/unit/module_tool/applications/checksummer_spec.rb +86 -105
  269. data/spec/unit/module_tool/applications/installer_spec.rb +293 -261
  270. data/spec/unit/module_tool/applications/searcher_spec.rb +1 -1
  271. data/spec/unit/module_tool/applications/uninstaller_spec.rb +90 -154
  272. data/spec/unit/module_tool/applications/unpacker_spec.rb +12 -12
  273. data/spec/unit/module_tool/applications/upgrader_spec.rb +286 -18
  274. data/spec/unit/module_tool/metadata_spec.rb +223 -14
  275. data/spec/unit/module_tool/tar/gnu_spec.rb +12 -9
  276. data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
  277. data/spec/unit/module_tool/tar_spec.rb +4 -18
  278. data/spec/unit/module_tool_spec.rb +123 -27
  279. data/spec/unit/network/formats_spec.rb +2 -2
  280. data/spec/unit/network/http_pool_spec.rb +21 -0
  281. data/spec/unit/network/rights_spec.rb +10 -8
  282. data/spec/unit/node/environment_spec.rb +27 -2
  283. data/spec/unit/parser/collector_spec.rb +1 -1
  284. data/spec/unit/parser/compiler_spec.rb +1 -1
  285. data/spec/unit/parser/functions/generate_spec.rb +4 -0
  286. data/spec/unit/pops/evaluator/access_ops_spec.rb +50 -11
  287. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +25 -0
  288. data/spec/unit/pops/loaders/dependency_loader_spec.rb +44 -0
  289. data/spec/unit/pops/loaders/loader_paths_spec.rb +66 -0
  290. data/spec/unit/pops/loaders/loaders_spec.rb +105 -0
  291. data/spec/unit/pops/loaders/module_loaders_spec.rb +119 -0
  292. data/spec/unit/pops/loaders/static_loader_spec.rb +46 -0
  293. data/spec/unit/pops/types/type_calculator_spec.rb +145 -10
  294. data/spec/unit/pops/types/type_factory_spec.rb +101 -0
  295. data/spec/unit/pops/types/type_parser_spec.rb +22 -0
  296. data/spec/unit/property/list_spec.rb +9 -1
  297. data/spec/unit/provider/augeas/augeas_spec.rb +58 -11
  298. data/spec/unit/provider/cron/crontab_spec.rb +1 -0
  299. data/spec/unit/provider/cron/parsed_spec.rb +15 -0
  300. data/spec/unit/provider/naginator_spec.rb +14 -0
  301. data/spec/unit/provider/package/apt_spec.rb +78 -64
  302. data/spec/unit/provider/package/gem_spec.rb +15 -0
  303. data/spec/unit/provider/package/rpm_spec.rb +6 -6
  304. data/spec/unit/provider/package/windows_spec.rb +1 -1
  305. data/spec/unit/provider/package/yum_spec.rb +199 -104
  306. data/spec/unit/provider/package/zypper_spec.rb +41 -15
  307. data/spec/unit/provider/service/openbsd_spec.rb +129 -22
  308. data/spec/unit/provider/service/redhat_spec.rb +18 -4
  309. data/spec/unit/provider/service/systemd_spec.rb +5 -9
  310. data/spec/unit/provider/service/upstart_spec.rb +1 -1
  311. data/spec/unit/provider/user/directoryservice_spec.rb +10 -0
  312. data/spec/unit/provider/yumrepo/inifile_spec.rb +171 -15
  313. data/spec/unit/resource/catalog_spec.rb +20 -104
  314. data/spec/unit/resource/type_collection_spec.rb +10 -9
  315. data/spec/unit/settings/config_file_spec.rb +29 -6
  316. data/spec/unit/settings/environment_conf_spec.rb +51 -0
  317. data/spec/unit/settings_spec.rb +97 -12
  318. data/spec/unit/ssl/certificate_authority_spec.rb +2 -0
  319. data/spec/unit/type/augeas_spec.rb +1 -1
  320. data/spec/unit/type/cron_spec.rb +6 -7
  321. data/spec/unit/type/file/checksum_spec.rb +6 -0
  322. data/spec/unit/type/file/content_spec.rb +277 -207
  323. data/spec/unit/type/file_spec.rb +9 -7
  324. data/spec/unit/type/user_spec.rb +106 -18
  325. data/spec/unit/type/yumrepo_spec.rb +8 -0
  326. data/spec/unit/util/checksums_spec.rb +12 -5
  327. data/spec/unit/util/diff_spec.rb +8 -0
  328. data/spec/unit/util/execution_spec.rb +4 -4
  329. data/spec/unit/util/feature_spec.rb +2 -0
  330. data/spec/unit/util/logging_spec.rb +14 -4
  331. data/spec/unit/util/rdoc/parser_spec.rb +5 -4
  332. data/spec/unit/util/rubygems_spec.rb +14 -0
  333. data/tasks/parallel.rake +2 -2
  334. metadata +154 -21
  335. checksums.yaml +0 -7
  336. data/lib/puppet/module_tool/applications/generator.rb +0 -142
  337. data/lib/puppet/module_tool/skeleton.rb +0 -37
  338. data/lib/puppet/module_tool/skeleton/templates/generator/Modulefile.erb +0 -11
  339. data/lib/puppet/module_tool/skeleton/templates/generator/README.erb +0 -16
  340. data/lib/puppet/module_tool/tar/solaris.rb +0 -5
  341. data/spec/fixtures/unit/provider/service/systemd/list_units_services +0 -17
  342. data/spec/unit/module_tool/tar/solaris_spec.rb +0 -22
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
  module Puppet
10
- PUPPETVERSION = '3.5.1'
10
+ PUPPETVERSION = '3.6.0-rc1'
11
11
 
12
12
  ##
13
13
  # version is a public API method intended to always provide a fast and
Binary file
Binary file
@@ -0,0 +1,5 @@
1
+ Puppet::Functions.create_function(:'usee::callee') do
2
+ def callee(value)
3
+ "usee::callee() was told '#{value}'"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ Puppet::Functions.create_function(:'user::caller') do
2
+ def caller()
3
+ call_function('usee::callee', 'passed value') + " + I am user::caller()"
4
+ end
5
+ end
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "test-user",
3
+ "author": "test",
4
+ "description": "",
5
+ "license": "",
6
+ "source": "",
7
+ "version": "1.0.0",
8
+ "dependencies": [{ "name": "test/usee" }]
9
+ }
@@ -0,0 +1,5 @@
1
+ Puppet::Functions.create_function(:'modulea::rb_func_a') do
2
+ def rb_func_a()
3
+ "I am modulea::rb_func_a()"
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ Puppet::Functions.create_function(:rb_func_a) do
2
+ def rb_func_a()
3
+ "I am rb_func_a()"
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "test-modulea",
3
+ "author": "test",
4
+ "description": "",
5
+ "license": "",
6
+ "project_page": "",
7
+ "source": "",
8
+ "summary": "",
9
+ "version": "1.0.0",
10
+ "checksums": {
11
+ "Modulefile": "55ef13d250cf6c477561becd8f2edcbe",
12
+ "functions/func_a.pp": "4a1f48920cd37c487dbf7468a5e78364",
13
+ "functions/modulea/func_a.pp": "296a3330c602b919ae063d6d6fde2460",
14
+ "lib/puppet/functions/modulea/rb_func_a.rb": "d5b3b83f77b742292008cd06361d6673",
15
+ "lib/puppet/functions/rb_func_a.rb": "a255470197127a6e512c9ab9dbd914c1",
16
+ "manifests/init.pp": "e50d8b91b632fb8357f021e6e0b6e043"
17
+ },
18
+ "dependencies": []
19
+ }
@@ -0,0 +1,6 @@
1
+ Puppet::Functions.create_function(:'moduleb::rb_func_b') do
2
+ def rb_func_b()
3
+ # Should be able to call modulea::rb_func_a()
4
+ call_function('modulea::rb_func_a') + " + I am moduleb::rb_func_b()"
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ # fixture for the spec test for PUP-1041
2
+
3
+ define host {
4
+ parents
5
+ use linux-server
6
+ }
@@ -0,0 +1,7 @@
1
+ UNIT FILE STATE
2
+ arp-ethers.service disabled
3
+ auditd.service enabled
4
+ autovt@.service disabled
5
+ avahi-daemon.service enabled
6
+ blk-availability.service disabled
7
+ brandbot.service static
@@ -0,0 +1,5 @@
1
+ # fixture for testing ssh key purging
2
+
3
+ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTXvM7AslzjNUYrPLiNVBsF5VnqL2RmqrkzscdVdHzVxvieNwmLGeUkg8EfXPiz7j5F/Lr0J8oItTCWzyN2KmM+DhUMjvP4AbELO/VYbnVrZICRiUNYSO3EN9/uapKAuiev88d7ynbonCU0VZoTPg/ug4OondOrLCtcGri5ltF+mausGfAYiFAQVEWqXV+1tyejoawJ884etb3n4ilpsrH9JK6AtOkEWVD3TDrNi29O1mQQ/Cn88g472zAJ+DhsIn+iehtfX5nmOtDNN/1t1bGMIBzkSYEAYwUiRJbRXvbobT7qKZQPA3dh0m8AYQS5/hd4/c4pmlxL8kgr24SnBY5 key1 keyname1
4
+ ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTXvM7AslzjNUYrPLiNVBsF5VnqL2RmqrkzscdVdHzVxvieNwmLGeUkg8EfXPiz7j5F/Lr0J8oItTCWzyN2KmM+DhUMjvP4AbELO/VYbnVrZICRiUNYSO3EN9/uapKAuiev88d7ynbonCU0VZoTPg/ug4OondOrLCtcGri5ltF+mausGfAYiFAQVEWqXV+1tyejoawJ884etb3n4ilpsrH9JK6AtOkEWVD3TDrNi29O1mQQ/Cn88g472zAJ+DhsIn+iehtfX5nmOtDNN/1t1bGMIBzkSYEAYwUiRJbRXvbobT7qKZQPA3dh0m8AYQS5/hd4/c4pmlxL8kgr24SnBY5 keyname2
5
+ #ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDTXvM7AslzjNUYrPLiNVBsF5VnqL2RmqrkzscdVdHzVxvieNwmLGeUkg8EfXPiz7j5F/Lr0J8oItTCWzyN2KmM+DhUMjvP4AbELO/VYbnVrZICRiUNYSO3EN9/uapKAuiev88d7ynbonCU0VZoTPg/ug4OondOrLCtcGri5ltF+mausGfAYiFAQVEWqXV+1tyejoawJ884etb3n4ilpsrH9JK6AtOkEWVD3TDrNi29O1mQQ/Cn88g472zAJ+DhsIn+iehtfX5nmOtDNN/1t1bGMIBzkSYEAYwUiRJbRXvbobT7qKZQPA3dh0m8AYQS5/hd4/c4pmlxL8kgr24SnBY5 keyname3
@@ -13,14 +13,13 @@ describe "apply" do
13
13
  describe "when applying provided catalogs" do
14
14
  it "can apply catalogs provided in a file in pson" do
15
15
  file_to_create = tmpfile("pson_catalog")
16
- catalog = Puppet::Resource::Catalog.new
16
+ catalog = Puppet::Resource::Catalog.new('mine', Puppet.lookup(:environments).get(Puppet[:environment]))
17
17
  resource = Puppet::Resource.new(:file, file_to_create, :parameters => {:content => "my stuff"})
18
18
  catalog.add_resource resource
19
19
 
20
20
  manifest = tmpfile("manifest")
21
21
 
22
22
  File.open(manifest, "w") { |f| f.print catalog.to_pson }
23
-
24
23
  puppet = Puppet::Application[:apply]
25
24
  puppet.options[:catalog] = manifest
26
25
 
@@ -16,13 +16,13 @@ describe Puppet::Configurer do
16
16
 
17
17
  configurer = Puppet::Configurer.new
18
18
  configurer.stubs(:download_plugins?).returns true
19
- configurer.download_plugins
19
+ configurer.download_plugins(Puppet::Node::Environment.remote(:testing))
20
20
  end
21
21
  end
22
22
 
23
23
  describe "when running" do
24
24
  before(:each) do
25
- @catalog = Puppet::Resource::Catalog.new
25
+ @catalog = Puppet::Resource::Catalog.new("testing", Puppet.lookup(:environments).get(Puppet[:environment]))
26
26
  @catalog.add_resource(Puppet::Type.type(:notify).new(:title => "testing"))
27
27
 
28
28
  # Make sure we don't try to persist the local state after the transaction ran,
@@ -0,0 +1,62 @@
1
+ require 'spec_helper'
2
+ require 'puppet/face'
3
+ require 'puppet/file_serving/metadata'
4
+ require 'puppet/file_serving/content'
5
+ require 'puppet/indirector/memory'
6
+
7
+ module PuppetFaceIntegrationSpecs
8
+ describe "Puppet plugin face" do
9
+ INDIRECTORS = [
10
+ Puppet::Indirector::FileMetadata,
11
+ Puppet::Indirector::FileContent,
12
+ ]
13
+
14
+ INDIRECTED_CLASSES = [
15
+ Puppet::FileServing::Metadata,
16
+ Puppet::FileServing::Content,
17
+ Puppet::Node::Facts,
18
+ ]
19
+
20
+ INDIRECTORS.each do |indirector|
21
+ class indirector::Memory < Puppet::Indirector::Memory
22
+ def find(request)
23
+ model.new('/dev/null', { 'type' => 'directory' })
24
+ end
25
+ end
26
+ end
27
+
28
+ before do
29
+ FileUtils.mkdir(Puppet[:vardir])
30
+ FileUtils.mkdir(File.join(Puppet[:vardir], 'lib'))
31
+ FileUtils.mkdir(File.join(Puppet[:vardir], 'facts.d'))
32
+ @termini_classes = {}
33
+ INDIRECTED_CLASSES.each do |indirected|
34
+ @termini_classes[indirected] = indirected.indirection.terminus_class
35
+ indirected.indirection.terminus_class = :memory
36
+ end
37
+ end
38
+
39
+ after do
40
+ FileUtils.rmdir(File.join(Puppet[:vardir],'lib'))
41
+ FileUtils.rmdir(File.join(Puppet[:vardir],'facts.d'))
42
+ FileUtils.rmdir(Puppet[:vardir])
43
+ INDIRECTED_CLASSES.each do |indirected|
44
+ indirected.indirection.terminus_class = @termini_classes[indirected]
45
+ indirected.indirection.termini.clear
46
+ end
47
+ end
48
+
49
+ def init_cli_args_and_apply_app(args = ["download"])
50
+ Puppet::Application.find(:plugin).new(stub('command_line', :subcommand_name => :plugin, :args => args))
51
+ end
52
+
53
+ it "processes a download request" do
54
+ app = init_cli_args_and_apply_app
55
+ expect do
56
+ expect {
57
+ app.run
58
+ }.to exit_with(0)
59
+ end.to have_printed(/No plugins downloaded/)
60
+ end
61
+ end
62
+ end
@@ -8,7 +8,7 @@ Puppet::Resource::Catalog.indirection.terminus(:compiler)
8
8
  describe Puppet::Resource::Catalog::Compiler do
9
9
  before do
10
10
  Facter.stubs(:value).returns "something"
11
- @catalog = Puppet::Resource::Catalog.new
11
+ @catalog = Puppet::Resource::Catalog.new("testing", Puppet::Node::Environment::NONE)
12
12
  @catalog.add_resource(@one = Puppet::Resource.new(:file, "/one"))
13
13
  @catalog.add_resource(@two = Puppet::Resource.new(:file, "/two"))
14
14
  end
@@ -6,7 +6,7 @@ require 'puppet/resource/catalog'
6
6
  describe "Puppet::Resource::Catalog::Queue" do
7
7
  before do
8
8
  Puppet::Resource::Catalog.indirection.terminus(:queue)
9
- @catalog = Puppet::Resource::Catalog.new("foo")
9
+ @catalog = Puppet::Resource::Catalog.new("foo", Puppet::Node::Environment::NONE)
10
10
 
11
11
  @one = Puppet::Resource.new(:file, "/one")
12
12
  @two = Puppet::Resource.new(:file, "/two")
@@ -74,8 +74,8 @@ describe Puppet::Node::Environment do
74
74
 
75
75
  catalog = Puppet::Parser::Compiler.compile(node)
76
76
 
77
- expect(catalog).to have_resource('Class[a]')
78
- expect(catalog).to have_resource('Class[b]')
77
+ expect(catalog).to have_resource('Class[A]')
78
+ expect(catalog).to have_resource('Class[B]')
79
79
  expect(catalog).to have_resource('Notify[variables]').with_parameter(:message, "a: 10, b: 10")
80
80
  end
81
81
  end
@@ -1,28 +1,19 @@
1
- #! /usr/bin/env ruby
2
1
  require 'spec_helper'
3
2
  require 'puppet/pops'
4
3
  require 'puppet/parser/parser_factory'
5
4
  require 'puppet_spec/compiler'
6
5
  require 'puppet_spec/pops'
7
6
  require 'puppet_spec/scope'
7
+ require 'matchers/resource'
8
8
  require 'rgen/metamodel_builder'
9
9
 
10
10
  # Test compilation using the future evaluator
11
- #
12
11
  describe "Puppet::Parser::Compiler" do
13
12
  include PuppetSpec::Compiler
13
+ include Matchers::Resource
14
14
 
15
15
  before :each do
16
16
  Puppet[:parser] = 'future'
17
-
18
- # This is in the original test - what is this for? Does not seem to make a difference at all
19
- @scope_resource = stub 'scope_resource', :builtin? => true, :finish => nil, :ref => 'Class[main]'
20
- @scope = stub 'scope', :resource => @scope_resource, :source => mock("source")
21
- end
22
-
23
-
24
- after do
25
- Puppet.settings.clear
26
17
  end
27
18
 
28
19
  describe "the compiler when using future parser and evaluator" do
@@ -34,14 +25,15 @@ describe "Puppet::Parser::Compiler" do
34
25
 
35
26
  Puppet.settings[:config_version] = 'git rev-parse HEAD'
36
27
 
37
- parser = Puppet::Parser::ParserFactory.parser "development"
38
28
  compiler = Puppet::Parser::Compiler.new(Puppet::Node.new("testnode"))
39
29
  compiler.catalog.version.should == version
40
30
  end
41
31
  end
42
32
 
43
33
  it "should not create duplicate resources when a class is referenced both directly and indirectly by the node classifier (4792)" do
44
- Puppet[:code] = <<-PP
34
+ node = Puppet::Node.new("testnodex")
35
+ node.classes = ['foo', 'bar']
36
+ catalog = compile_to_catalog(<<-PP, node)
45
37
  class foo
46
38
  {
47
39
  notify { foo_notify: }
@@ -53,17 +45,25 @@ describe "Puppet::Parser::Compiler" do
53
45
  }
54
46
  PP
55
47
 
56
- node = Puppet::Node.new("testnodex")
57
- node.classes = ['foo', 'bar']
58
48
  catalog = Puppet::Parser::Compiler.compile(node)
59
- node.classes = nil
60
- catalog.resource("Notify[foo_notify]").should_not be_nil
61
- catalog.resource("Notify[bar_notify]").should_not be_nil
49
+
50
+ expect(catalog).to have_resource("Notify[foo_notify]")
51
+ expect(catalog).to have_resource("Notify[bar_notify]")
52
+ end
53
+
54
+ it 'applies defaults for defines with qualified names (PUP-2302)' do
55
+ catalog = compile_to_catalog(<<-CODE)
56
+ define my::thing($msg = 'foo') { notify {'check_me': message => $msg } }
57
+ My::Thing { msg => 'evoe' }
58
+ my::thing { 'name': }
59
+ CODE
60
+
61
+ expect(catalog).to have_resource("Notify[check_me]").with_parameter(:message, "evoe")
62
62
  end
63
63
 
64
64
  describe "when resolving class references" do
65
65
  it "should favor local scope, even if there's an included class in topscope" do
66
- Puppet[:code] = <<-PP
66
+ catalog = compile_to_catalog(<<-PP)
67
67
  class experiment {
68
68
  class baz {
69
69
  }
@@ -76,15 +76,11 @@ describe "Puppet::Parser::Compiler" do
76
76
  include experiment::baz
77
77
  PP
78
78
 
79
- catalog = Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode"))
80
-
81
- notify_resource = catalog.resource( "Notify[x]" )
82
-
83
- notify_resource[:require].title.should == "Experiment::Baz"
79
+ expect(catalog).to have_resource("Notify[x]").with_parameter(:require, be_resource("Class[Experiment::Baz]"))
84
80
  end
85
81
 
86
82
  it "should favor local scope, even if there's an unincluded class in topscope" do
87
- Puppet[:code] = <<-PP
83
+ catalog = compile_to_catalog(<<-PP)
88
84
  class experiment {
89
85
  class baz {
90
86
  }
@@ -96,18 +92,15 @@ describe "Puppet::Parser::Compiler" do
96
92
  include experiment::baz
97
93
  PP
98
94
 
99
- catalog = Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode"))
100
-
101
- notify_resource = catalog.resource( "Notify[x]" )
102
-
103
- notify_resource[:require].title.should == "Experiment::Baz"
95
+ expect(catalog).to have_resource("Notify[x]").with_parameter(:require, be_resource("Class[Experiment::Baz]"))
104
96
  end
105
97
  end
98
+
106
99
  describe "(ticket #13349) when explicitly specifying top scope" do
107
100
  ["class {'::bar::baz':}", "include ::bar::baz"].each do |include|
108
101
  describe "with #{include}" do
109
102
  it "should find the top level class" do
110
- Puppet[:code] = <<-MANIFEST
103
+ catalog = compile_to_catalog(<<-MANIFEST)
111
104
  class { 'foo::test': }
112
105
  class foo::test {
113
106
  #{include}
@@ -120,12 +113,10 @@ describe "Puppet::Parser::Compiler" do
120
113
  }
121
114
  MANIFEST
122
115
 
123
- catalog = Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode"))
124
-
125
- catalog.resource("Class[Bar::Baz]").should_not be_nil
126
- catalog.resource("Notify[good!]").should_not be_nil
127
- catalog.resource("Class[Foo::Bar::Baz]").should be_nil
128
- catalog.resource("Notify[bad!]").should be_nil
116
+ expect(catalog).to have_resource("Class[Bar::Baz]")
117
+ expect(catalog).to have_resource("Notify[good!]")
118
+ expect(catalog).to_not have_resource("Class[Foo::Bar::Baz]")
119
+ expect(catalog).to_not have_resource("Notify[bad!]")
129
120
  end
130
121
  end
131
122
  end
@@ -144,39 +135,27 @@ describe "Puppet::Parser::Compiler" do
144
135
 
145
136
  ['define', 'class', 'node'].each do |thing|
146
137
  it "'#{thing}' is not allowed inside evaluated conditional constructs" do
147
- Puppet[:code] = <<-PP
148
- if true {
149
- #{thing} foo {
138
+ expect do
139
+ compile_to_catalog(<<-PP)
140
+ if true {
141
+ #{thing} foo {
142
+ }
143
+ notify { decoy: }
150
144
  }
151
- notify { decoy: }
152
- }
153
- PP
154
-
155
- begin
156
- catalog = Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode"))
157
- raise "compilation should have raised Puppet::Error"
158
- rescue Puppet::Error => e
159
- e.message.should =~ /Classes, definitions, and nodes may only appear at toplevel/
160
- end
145
+ PP
146
+ end.to raise_error(Puppet::Error, /Classes, definitions, and nodes may only appear at toplevel/)
161
147
  end
162
- end
163
148
 
164
- ['define', 'class', 'node'].each do |thing|
165
149
  it "'#{thing}' is not allowed inside un-evaluated conditional constructs" do
166
- Puppet[:code] = <<-PP
167
- if false {
168
- #{thing} foo {
150
+ expect do
151
+ compile_to_catalog(<<-PP)
152
+ if false {
153
+ #{thing} foo {
154
+ }
155
+ notify { decoy: }
169
156
  }
170
- notify { decoy: }
171
- }
172
- PP
173
-
174
- begin
175
- catalog = Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode"))
176
- raise "compilation should have raised Puppet::Error"
177
- rescue Puppet::Error => e
178
- e.message.should =~ /Classes, definitions, and nodes may only appear at toplevel/
179
- end
157
+ PP
158
+ end.to raise_error(Puppet::Error, /Classes, definitions, and nodes may only appear at toplevel/)
180
159
  end
181
160
  end
182
161
 
@@ -185,9 +164,8 @@ describe "Puppet::Parser::Compiler" do
185
164
  ref.sub(/File\[(\w+)\]/, '\1')
186
165
  end
187
166
 
188
- let(:node) { Puppet::Node.new('mynode') }
189
- let(:code) do
190
- <<-MANIFEST
167
+ def assert_creates_relationships(relationship_code, expectations)
168
+ base_manifest = <<-MANIFEST
191
169
  file { [a,b,c]:
192
170
  mode => 0644,
193
171
  }
@@ -195,17 +173,7 @@ describe "Puppet::Parser::Compiler" do
195
173
  mode => 0755,
196
174
  }
197
175
  MANIFEST
198
- end
199
- let(:expected_relationships) { [] }
200
- let(:expected_subscriptions) { [] }
201
-
202
- before :each do
203
- Puppet[:parser] = 'future'
204
- Puppet[:code] = code
205
- end
206
-
207
- after :each do
208
- catalog = Puppet::Parser::Compiler.compile(node)
176
+ catalog = compile_to_catalog(base_manifest + relationship_code)
209
177
 
210
178
  resources = catalog.resources.select { |res| res.type == 'File' }
211
179
 
@@ -216,63 +184,53 @@ describe "Puppet::Parser::Compiler" do
216
184
  end.inject(&:concat)
217
185
  end
218
186
 
219
- actual_relationships.should =~ expected_relationships
220
- actual_subscriptions.should =~ expected_subscriptions
187
+ actual_relationships.should =~ (expectations[:relationships] || [])
188
+ actual_subscriptions.should =~ (expectations[:subscriptions] || [])
221
189
  end
222
190
 
223
191
  it "of regular type" do
224
- code << "File[a] -> File[b]"
225
-
226
- expected_relationships << ['a','b']
192
+ assert_creates_relationships("File[a] -> File[b]",
193
+ :relationships => [['a','b']])
227
194
  end
228
195
 
229
196
  it "of subscription type" do
230
- code << "File[a] ~> File[b]"
231
-
232
- expected_subscriptions << ['a', 'b']
197
+ assert_creates_relationships("File[a] ~> File[b]",
198
+ :subscriptions => [['a', 'b']])
233
199
  end
234
200
 
235
201
  it "between multiple resources expressed as resource with multiple titles" do
236
- code << "File[a,b] -> File[c,d]"
237
-
238
- expected_relationships.concat [
239
- ['a', 'c'],
240
- ['b', 'c'],
241
- ['a', 'd'],
242
- ['b', 'd'],
243
- ]
202
+ assert_creates_relationships("File[a,b] -> File[c,d]",
203
+ :relationships => [['a', 'c'],
204
+ ['b', 'c'],
205
+ ['a', 'd'],
206
+ ['b', 'd']])
244
207
  end
245
208
 
246
209
  it "between collection expressions" do
247
- code << "File <| mode == 0644 |> -> File <| mode == 0755 |>"
248
-
249
- expected_relationships.concat [
250
- ['a', 'd'],
251
- ['b', 'd'],
252
- ['c', 'd'],
253
- ['a', 'e'],
254
- ['b', 'e'],
255
- ['c', 'e'],
256
- ]
210
+ assert_creates_relationships("File <| mode == 0644 |> -> File <| mode == 0755 |>",
211
+ :relationships => [['a', 'd'],
212
+ ['b', 'd'],
213
+ ['c', 'd'],
214
+ ['a', 'e'],
215
+ ['b', 'e'],
216
+ ['c', 'e']])
257
217
  end
258
218
 
259
219
  it "between resources expressed as Strings" do
260
- code << "'File[a]' -> 'File[b]'"
261
-
262
- expected_relationships << ['a', 'b']
220
+ assert_creates_relationships("'File[a]' -> 'File[b]'",
221
+ :relationships => [['a', 'b']])
263
222
  end
264
223
 
265
224
  it "between resources expressed as variables" do
266
- code << <<-MANIFEST
225
+ assert_creates_relationships(<<-MANIFEST, :relationships => [['a', 'b']])
267
226
  $var = File[a]
268
227
  $var -> File[b]
269
228
  MANIFEST
270
229
 
271
- expected_relationships << ['a', 'b']
272
230
  end
273
231
 
274
232
  it "between resources expressed as case statements" do
275
- code << <<-MANIFEST
233
+ assert_creates_relationships(<<-MANIFEST, :relationships => [['s1', 't2']])
276
234
  $var = 10
277
235
  case $var {
278
236
  10: {
@@ -292,63 +250,63 @@ describe "Puppet::Parser::Compiler" do
292
250
  }
293
251
  }
294
252
  MANIFEST
295
-
296
- expected_relationships << ['s1', 't2']
297
253
  end
298
254
 
299
255
  it "using deep access in array" do
300
- code << <<-MANIFEST
256
+ assert_creates_relationships(<<-MANIFEST, :relationships => [['a', 'b']])
301
257
  $var = [ [ [ File[a], File[b] ] ] ]
302
258
  $var[0][0][0] -> $var[0][0][1]
303
259
  MANIFEST
304
260
 
305
- expected_relationships << ['a', 'b']
306
261
  end
307
262
 
308
263
  it "using deep access in hash" do
309
- code << <<-MANIFEST
264
+ assert_creates_relationships(<<-MANIFEST, :relationships => [['a', 'b']])
310
265
  $var = {'foo' => {'bar' => {'source' => File[a], 'target' => File[b]}}}
311
266
  $var[foo][bar][source] -> $var[foo][bar][target]
312
267
  MANIFEST
313
268
 
314
- expected_relationships << ['a', 'b']
315
269
  end
316
270
 
317
271
  it "using resource declarations" do
318
- code << "file { l: } -> file { r: }"
319
-
320
- expected_relationships << ['l', 'r']
272
+ assert_creates_relationships("file { l: } -> file { r: }", :relationships => [['l', 'r']])
321
273
  end
322
274
 
323
275
  it "between entries in a chain of relationships" do
324
- code << "File[a] -> File[b] ~> File[c] <- File[d] <~ File[e]"
325
-
326
- expected_relationships << ['a', 'b'] << ['d', 'c']
327
- expected_subscriptions << ['b', 'c'] << ['e', 'd']
276
+ assert_creates_relationships("File[a] -> File[b] ~> File[c] <- File[d] <~ File[e]",
277
+ :relationships => [['a', 'b'], ['d', 'c']],
278
+ :subscriptions => [['b', 'c'], ['e', 'd']])
328
279
  end
329
280
  end
330
281
 
331
282
  context "when dealing with variable references" do
332
283
  it 'an initial underscore in a variable name is ok' do
333
- node = Puppet::Node.new("testing_x")
334
- catalog = compile_to_catalog(<<-MANIFEST, node)
284
+ catalog = compile_to_catalog(<<-MANIFEST)
335
285
  class a { $_a = 10}
336
286
  include a
337
287
  notify { 'test': message => $a::_a }
338
288
  MANIFEST
339
289
 
340
- catalog.resource("Notify[test]")[:message].should == 10
290
+ expect(catalog).to have_resource("Notify[test]").with_parameter(:message, 10)
341
291
  end
342
292
 
343
293
  it 'an initial underscore in not ok if elsewhere than last segment' do
344
- node = Puppet::Node.new("testing_x")
345
- expect {
346
- catalog = compile_to_catalog(<<-MANIFEST, node)
347
- class a { $_a = 10}
294
+ expect do
295
+ catalog = compile_to_catalog(<<-MANIFEST)
296
+ class a { $_a = 10}
297
+ include a
298
+ notify { 'test': message => $_a::_a }
299
+ MANIFEST
300
+ end.to raise_error(/Illegal variable name/)
301
+ end
302
+
303
+ it 'a missing variable as default value becomes undef' do
304
+ catalog = compile_to_catalog(<<-MANIFEST)
305
+ class a ($b=$x) { notify {$b: message=>'meh'} }
348
306
  include a
349
- notify { 'test': message => $_a::_a }
350
307
  MANIFEST
351
- }.to raise_error(/Illegal variable name/)
308
+
309
+ expect(catalog).to have_resource("Notify[undef]").with_parameter(:message, "meh")
352
310
  end
353
311
  end
354
312
 
@@ -366,7 +324,7 @@ describe "Puppet::Parser::Compiler" do
366
324
  notify { 'test': message => $trusted[data] }
367
325
  MANIFEST
368
326
 
369
- catalog.resource("Notify[test]")[:message].should == "value"
327
+ expect(catalog).to have_resource("Notify[test]").with_parameter(:message, "value")
370
328
  end
371
329
 
372
330
  it 'should not allow assignment to $trusted' do
@@ -374,11 +332,10 @@ describe "Puppet::Parser::Compiler" do
374
332
  node.trusted_data = { "data" => "value" }
375
333
 
376
334
  expect do
377
- catalog = compile_to_catalog(<<-MANIFEST, node)
335
+ compile_to_catalog(<<-MANIFEST, node)
378
336
  $trusted = 'changed'
379
337
  notify { 'test': message => $trusted == 'changed' }
380
338
  MANIFEST
381
- catalog.resource("Notify[test]")[:message].should == true
382
339
  end.to raise_error(Puppet::Error, /Attempt to assign to a reserved variable name: 'trusted'/)
383
340
  end
384
341
  end
@@ -396,21 +353,18 @@ describe "Puppet::Parser::Compiler" do
396
353
  notify { 'test': message => ($trusted == undef) }
397
354
  MANIFEST
398
355
 
399
- catalog.resource("Notify[test]")[:message].should == true
356
+ expect(catalog).to have_resource("Notify[test]").with_parameter(:message, true)
400
357
  end
401
358
 
402
359
  it 'should allow assignment to $trusted' do
403
- node = Puppet::Node.new("testing")
404
-
405
- catalog = compile_to_catalog(<<-MANIFEST, node)
360
+ catalog = compile_to_catalog(<<-MANIFEST)
406
361
  $trusted = 'changed'
407
362
  notify { 'test': message => $trusted == 'changed' }
408
363
  MANIFEST
409
364
 
410
- catalog.resource("Notify[test]")[:message].should == true
365
+ expect(catalog).to have_resource("Notify[test]").with_parameter(:message, true)
411
366
  end
412
367
  end
413
368
  end
414
369
  end
415
-
416
370
  end