puppet 4.2.3-x86-mingw32 → 4.3.0-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 (337) hide show
  1. data/Gemfile +3 -0
  2. data/README.md +1 -1
  3. data/ext/debian/puppet.init +0 -1
  4. data/ext/debian/puppet.logrotate +14 -5
  5. data/ext/osx/puppet.plist +0 -2
  6. data/ext/redhat/client.init +13 -5
  7. data/ext/redhat/logrotate +15 -3
  8. data/ext/redhat/puppet.spec.erb +5 -1
  9. data/ext/redhat/server.init +1 -1
  10. data/ext/systemd/puppet.service +1 -0
  11. data/lib/puppet.rb +12 -0
  12. data/lib/puppet/agent.rb +4 -4
  13. data/lib/puppet/agent/locker.rb +11 -2
  14. data/lib/puppet/application/agent.rb +5 -1
  15. data/lib/puppet/application/apply.rb +4 -0
  16. data/lib/puppet/application/filebucket.rb +78 -4
  17. data/lib/puppet/application/lookup.rb +356 -0
  18. data/lib/puppet/application/master.rb +3 -0
  19. data/lib/puppet/configurer.rb +9 -5
  20. data/lib/puppet/context.rb +16 -1
  21. data/lib/puppet/context/trusted_information.rb +21 -1
  22. data/lib/puppet/daemon.rb +17 -13
  23. data/lib/puppet/data_binding.rb +4 -2
  24. data/lib/puppet/data_providers.rb +12 -13
  25. data/lib/puppet/data_providers/data_adapter.rb +7 -68
  26. data/lib/puppet/data_providers/data_function_support.rb +5 -26
  27. data/lib/puppet/data_providers/function_env_data_provider.rb +0 -10
  28. data/lib/puppet/data_providers/function_module_data_provider.rb +0 -22
  29. data/lib/puppet/data_providers/hiera_config.rb +106 -0
  30. data/lib/puppet/data_providers/hiera_env_data_provider.rb +18 -0
  31. data/lib/puppet/data_providers/hiera_interpolate.rb +97 -0
  32. data/lib/puppet/data_providers/hiera_module_data_provider.rb +23 -0
  33. data/lib/puppet/data_providers/hiera_support.rb +37 -0
  34. data/lib/puppet/data_providers/json_data_provider_factory.rb +31 -0
  35. data/lib/puppet/data_providers/lookup_adapter.rb +200 -0
  36. data/lib/puppet/data_providers/yaml_data_provider_factory.rb +32 -0
  37. data/lib/puppet/defaults.rb +12 -2
  38. data/lib/puppet/error.rb +4 -0
  39. data/lib/puppet/face/module/changes.rb +2 -1
  40. data/lib/puppet/feature/cfacter.rb +1 -0
  41. data/lib/puppet/file_bucket/dipper.rb +58 -2
  42. data/lib/puppet/functions.rb +2 -4
  43. data/lib/puppet/functions/assert_type.rb +48 -12
  44. data/lib/puppet/functions/defined.rb +79 -48
  45. data/lib/puppet/functions/each.rb +85 -27
  46. data/lib/puppet/functions/filter.rb +58 -23
  47. data/lib/puppet/functions/hiera.rb +76 -3
  48. data/lib/puppet/functions/hiera_array.rb +65 -3
  49. data/lib/puppet/functions/hiera_hash.rb +74 -2
  50. data/lib/puppet/functions/hiera_include.rb +75 -2
  51. data/lib/puppet/functions/lookup.rb +19 -17
  52. data/lib/puppet/functions/map.rb +56 -21
  53. data/lib/puppet/functions/match.rb +29 -12
  54. data/lib/puppet/functions/reduce.rb +95 -58
  55. data/lib/puppet/functions/versioncmp.rb +36 -0
  56. data/lib/puppet/functions/with.rb +15 -7
  57. data/lib/puppet/indirector/catalog/compiler.rb +3 -3
  58. data/lib/puppet/indirector/catalog/static_compiler.rb +46 -30
  59. data/lib/puppet/indirector/data_binding/none.rb +4 -1
  60. data/lib/puppet/indirector/file_bucket_file/file.rb +58 -1
  61. data/lib/puppet/indirector/hiera.rb +4 -0
  62. data/lib/puppet/indirector/json.rb +1 -1
  63. data/lib/puppet/indirector/msgpack.rb +1 -1
  64. data/lib/puppet/indirector/request.rb +7 -8
  65. data/lib/puppet/indirector/resource_type/parser.rb +5 -3
  66. data/lib/puppet/info_service.rb +7 -0
  67. data/lib/puppet/info_service/class_information_service.rb +111 -0
  68. data/lib/puppet/module_tool/metadata.rb +32 -9
  69. data/lib/puppet/module_tool/skeleton/templates/generator/README.md.erb +42 -38
  70. data/lib/puppet/network/authconfig.rb +21 -1
  71. data/lib/puppet/network/authorization.rb +8 -1
  72. data/lib/puppet/network/http/api/master/v3.rb +7 -1
  73. data/lib/puppet/network/http/api/master/v3/environment.rb +59 -0
  74. data/lib/puppet/node/environment.rb +9 -2
  75. data/lib/puppet/parser.rb +3 -0
  76. data/lib/puppet/parser/ast/pops_bridge.rb +39 -1
  77. data/lib/puppet/parser/compiler.rb +302 -12
  78. data/lib/puppet/parser/compiler/catalog_validator.rb +33 -0
  79. data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +64 -0
  80. data/lib/puppet/parser/compiler/catalog_validator/relationship_validator.rb +38 -0
  81. data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +20 -0
  82. data/lib/puppet/parser/environment_compiler.rb +165 -0
  83. data/lib/puppet/parser/functions/assert_type.rb +46 -16
  84. data/lib/puppet/parser/functions/defined.rb +105 -68
  85. data/lib/puppet/parser/functions/each.rb +85 -27
  86. data/lib/puppet/parser/functions/filter.rb +59 -23
  87. data/lib/puppet/parser/functions/hiera.rb +83 -27
  88. data/lib/puppet/parser/functions/hiera_array.rb +71 -28
  89. data/lib/puppet/parser/functions/hiera_hash.rb +81 -30
  90. data/lib/puppet/parser/functions/hiera_include.rb +81 -40
  91. data/lib/puppet/parser/functions/map.rb +55 -20
  92. data/lib/puppet/parser/functions/match.rb +27 -12
  93. data/lib/puppet/parser/functions/reduce.rb +97 -60
  94. data/lib/puppet/parser/functions/with.rb +16 -8
  95. data/lib/puppet/parser/resource.rb +98 -19
  96. data/lib/puppet/plugins/configuration.rb +3 -2
  97. data/lib/puppet/plugins/data_providers.rb +12 -60
  98. data/lib/puppet/plugins/data_providers/data_provider.rb +283 -0
  99. data/lib/puppet/plugins/data_providers/registry.rb +84 -0
  100. data/lib/puppet/pops.rb +19 -17
  101. data/lib/puppet/pops/adapters.rb +12 -0
  102. data/lib/puppet/pops/binder/binder.rb +2 -2
  103. data/lib/puppet/pops/binder/bindings_checker.rb +1 -1
  104. data/lib/puppet/pops/binder/bindings_label_provider.rb +3 -1
  105. data/lib/puppet/pops/binder/bindings_loader.rb +6 -2
  106. data/lib/puppet/pops/binder/bindings_model_meta.rb +2 -2
  107. data/lib/puppet/pops/binder/config/binder_config.rb +1 -1
  108. data/lib/puppet/pops/binder/injector.rb +4 -4
  109. data/lib/puppet/pops/binder/key_factory.rb +3 -9
  110. data/lib/puppet/pops/binder/scheme_handler/module_scheme.rb +68 -9
  111. data/lib/puppet/pops/evaluator/access_operator.rb +27 -60
  112. data/lib/puppet/pops/evaluator/closure.rb +8 -8
  113. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -1
  114. data/lib/puppet/pops/evaluator/evaluator_impl.rb +5 -5
  115. data/lib/puppet/pops/evaluator/literal_evaluator.rb +87 -0
  116. data/lib/puppet/pops/evaluator/relationship_operator.rb +7 -1
  117. data/lib/puppet/pops/functions/dispatcher.rb +3 -3
  118. data/lib/puppet/pops/issues.rb +1 -1
  119. data/lib/puppet/pops/label_provider.rb +1 -1
  120. data/lib/puppet/pops/lookup.rb +25 -47
  121. data/lib/puppet/pops/lookup/explainer.rb +402 -0
  122. data/lib/puppet/pops/lookup/invocation.rb +117 -0
  123. data/lib/puppet/pops/merge_strategy.rb +73 -5
  124. data/lib/puppet/pops/model/factory.rb +34 -0
  125. data/lib/puppet/pops/model/model_label_provider.rb +10 -1
  126. data/lib/puppet/pops/model/model_meta.rb +15 -0
  127. data/lib/puppet/pops/model/model_tree_dumper.rb +18 -0
  128. data/lib/puppet/pops/parser/code_merger.rb +13 -1
  129. data/lib/puppet/pops/parser/egrammar.ra +56 -3
  130. data/lib/puppet/pops/parser/eparser.rb +1549 -1352
  131. data/lib/puppet/pops/parser/lexer2.rb +31 -6
  132. data/lib/puppet/pops/parser/locator.rb +1 -1
  133. data/lib/puppet/pops/parser/parser_support.rb +25 -13
  134. data/lib/puppet/pops/types/enumeration.rb +1 -2
  135. data/lib/puppet/pops/types/type_asserter.rb +16 -15
  136. data/lib/puppet/pops/types/type_assertion_error.rb +1 -0
  137. data/lib/puppet/pops/types/type_calculator.rb +171 -1020
  138. data/lib/puppet/pops/types/type_factory.rb +87 -148
  139. data/lib/puppet/pops/types/type_mismatch_describer.rb +743 -0
  140. data/lib/puppet/pops/types/type_parser.rb +116 -127
  141. data/lib/puppet/pops/types/types.rb +1394 -255
  142. data/lib/puppet/pops/types/types_meta.rb +0 -234
  143. data/lib/puppet/pops/validation.rb +7 -2
  144. data/lib/puppet/pops/validation/checker4_0.rb +28 -0
  145. data/lib/puppet/provider/augeas/augeas.rb +50 -0
  146. data/lib/puppet/provider/group/directoryservice.rb +10 -0
  147. data/lib/puppet/provider/package/dnf.rb +41 -0
  148. data/lib/puppet/provider/package/gem.rb +7 -2
  149. data/lib/puppet/provider/package/rpm.rb +1 -0
  150. data/lib/puppet/provider/package/windows/exe_package.rb +10 -8
  151. data/lib/puppet/provider/package/windows/msi_package.rb +4 -3
  152. data/lib/puppet/provider/package/windows/package.rb +9 -1
  153. data/lib/puppet/provider/package/yum.rb +14 -9
  154. data/lib/puppet/provider/service/bsd.rb +1 -1
  155. data/lib/puppet/provider/service/debian.rb +21 -0
  156. data/lib/puppet/provider/service/init.rb +6 -0
  157. data/lib/puppet/provider/service/rcng.rb +51 -0
  158. data/lib/puppet/provider/service/redhat.rb +2 -1
  159. data/lib/puppet/provider/service/smf.rb +43 -2
  160. data/lib/puppet/provider/service/src.rb +27 -0
  161. data/lib/puppet/provider/service/systemd.rb +15 -3
  162. data/lib/puppet/provider/sshkey/parsed.rb +19 -9
  163. data/lib/puppet/reference/report.rb +9 -12
  164. data/lib/puppet/reports.rb +5 -1
  165. data/lib/puppet/resource.rb +50 -73
  166. data/lib/puppet/resource/capability_finder.rb +95 -0
  167. data/lib/puppet/resource/catalog.rb +47 -7
  168. data/lib/puppet/resource/status.rb +0 -2
  169. data/lib/puppet/resource/type.rb +238 -44
  170. data/lib/puppet/resource/type_collection.rb +60 -2
  171. data/lib/puppet/settings.rb +2 -2
  172. data/lib/puppet/ssl/certificate_authority/interface.rb +2 -2
  173. data/lib/puppet/ssl/oids.rb +9 -1
  174. data/lib/puppet/transaction.rb +4 -1
  175. data/lib/puppet/transaction/additional_resource_generator.rb +71 -8
  176. data/lib/puppet/transaction/resource_harness.rb +9 -4
  177. data/lib/puppet/type.rb +74 -3
  178. data/lib/puppet/type/augeas.rb +8 -0
  179. data/lib/puppet/type/file/source.rb +14 -12
  180. data/lib/puppet/type/user.rb +4 -2
  181. data/lib/puppet/util/windows/security.rb +4 -1
  182. data/lib/puppet/util/windows/taskscheduler.rb +1 -1
  183. data/lib/puppet/version.rb +1 -1
  184. data/spec/fixtures/unit/application/environments/production/data/common.yaml +3 -0
  185. data/spec/fixtures/unit/application/environments/production/environment.conf +1 -0
  186. data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/data/bad.json +3 -0
  187. data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/environment.conf +2 -0
  188. data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/hiera.yaml +5 -0
  189. data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_json/manifests/site.pp +5 -0
  190. data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/data/bad.yaml +3 -0
  191. data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/environment.conf +2 -0
  192. data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/hiera.yaml +5 -0
  193. data/spec/fixtures/unit/data_providers/environments/hiera_bad_syntax_yaml/manifests/site.pp +5 -0
  194. data/spec/fixtures/unit/data_providers/environments/hiera_defaults/data/common.yaml +2 -0
  195. data/spec/fixtures/unit/data_providers/environments/hiera_defaults/environment.conf +2 -0
  196. data/spec/fixtures/unit/data_providers/environments/hiera_defaults/manifests/site.pp +1 -0
  197. data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/data/common.yaml +2 -0
  198. data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/manifests/init.pp +5 -0
  199. data/spec/fixtures/unit/data_providers/environments/hiera_defaults/modules/one/metadata.json +9 -0
  200. data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/first.json +3 -0
  201. data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/name.yaml +2 -0
  202. data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/second.json +3 -0
  203. data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data1/single.yaml +2 -0
  204. data/spec/fixtures/unit/data_providers/environments/hiera_env_config/data2/single.yaml +2 -0
  205. data/spec/fixtures/unit/data_providers/environments/hiera_env_config/environment.conf +2 -0
  206. data/spec/fixtures/unit/data_providers/environments/hiera_env_config/hiera.yaml +18 -0
  207. data/spec/fixtures/unit/data_providers/environments/hiera_env_config/manifests/site.pp +5 -0
  208. data/spec/fixtures/unit/data_providers/environments/hiera_misc/data/common.yaml +46 -0
  209. data/spec/fixtures/unit/data_providers/environments/hiera_misc/environment.conf +2 -0
  210. data/spec/fixtures/unit/data_providers/environments/hiera_misc/manifests/site.pp +1 -0
  211. data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/data/common.yaml +30 -0
  212. data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/manifests/init.pp +13 -0
  213. data/spec/fixtures/unit/data_providers/environments/hiera_misc/modules/one/metadata.json +9 -0
  214. data/spec/fixtures/unit/data_providers/environments/hiera_module_config/environment.conf +2 -0
  215. data/spec/fixtures/unit/data_providers/environments/hiera_module_config/manifests/site.pp +1 -0
  216. data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/first.json +3 -0
  217. data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/name.yaml +1 -0
  218. data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/second.json +3 -0
  219. data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data1/single.yaml +2 -0
  220. data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/data2/single.yaml +2 -0
  221. data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/hiera.yaml +18 -0
  222. data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/manifests/init.pp +5 -0
  223. data/spec/fixtures/unit/data_providers/environments/hiera_module_config/modules/one/metadata.json +9 -0
  224. data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_env_data.rb +1 -0
  225. data/spec/fixtures/unit/data_providers/environments/sample/modules/dataprovider/lib/puppet_x/helindbe/sample_module_data.rb +1 -0
  226. data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/data/first.json +3 -0
  227. data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/hiera.yaml +8 -0
  228. data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/manifests/init.pp +5 -0
  229. data/spec/fixtures/unit/functions/lookup/environments/production/modules/hieraprovider/metadata.json +9 -0
  230. data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/lib/puppet/functions/meta/data.rb +9 -0
  231. data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/manifests/init.pp +3 -0
  232. data/spec/fixtures/unit/functions/lookup/environments/production/modules/meta/metadata.json +9 -0
  233. data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/lib/puppet/bindings/metawcp/default.rb +10 -0
  234. data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/lib/puppet_x/thallgren/sample_module_data.rb +23 -0
  235. data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/manifests/init.pp +3 -0
  236. data/spec/fixtures/unit/functions/lookup/environments/production/modules/metawcp/metadata.json +9 -0
  237. data/spec/fixtures/unit/provider/package/yum/yum-check-update-security.txt +184 -0
  238. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
  239. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
  240. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
  241. data/spec/integration/data_binding_spec.rb +229 -0
  242. data/spec/integration/file_bucket/file_spec.rb +2 -2
  243. data/spec/integration/parser/compiler_spec.rb +23 -19
  244. data/spec/integration/parser/resource_expressions_spec.rb +4 -4
  245. data/spec/integration/parser/undef_param_spec.rb +1 -1
  246. data/spec/integration/resource/catalog_spec.rb +1 -1
  247. data/spec/integration/type/package_spec.rb +2 -0
  248. data/spec/integration/util/windows/security_spec.rb +18 -0
  249. data/spec/lib/matchers/include_in_order.rb +2 -2
  250. data/spec/shared_behaviours/iterative_functions.rb +8 -8
  251. data/spec/spec_helper.rb +7 -0
  252. data/spec/unit/agent/locker_spec.rb +4 -4
  253. data/spec/unit/agent_spec.rb +0 -8
  254. data/spec/unit/application/agent_spec.rb +5 -0
  255. data/spec/unit/application/apply_spec.rb +8 -0
  256. data/spec/unit/application/filebucket_spec.rb +87 -1
  257. data/spec/unit/application/lookup_spec.rb +195 -0
  258. data/spec/unit/appmgmt_spec.rb +657 -0
  259. data/spec/unit/capability_spec.rb +414 -0
  260. data/spec/unit/configurer_spec.rb +7 -1
  261. data/spec/unit/context/trusted_information_spec.rb +24 -1
  262. data/spec/unit/daemon_spec.rb +18 -8
  263. data/spec/unit/data_providers/hiera_data_provider_spec.rb +201 -0
  264. data/spec/unit/file_bucket/dipper_spec.rb +210 -1
  265. data/spec/unit/functions/assert_type_spec.rb +5 -7
  266. data/spec/unit/functions/defined_spec.rb +2 -2
  267. data/spec/unit/functions/epp_spec.rb +2 -2
  268. data/spec/unit/functions/lookup_spec.rb +200 -9
  269. data/spec/unit/functions/regsubst_spec.rb +17 -8
  270. data/spec/unit/functions/scanf_spec.rb +1 -1
  271. data/spec/unit/functions/split_spec.rb +2 -2
  272. data/spec/unit/functions/versioncmp_spec.rb +36 -0
  273. data/spec/unit/functions4_spec.rb +58 -72
  274. data/spec/unit/indirector/catalog/compiler_spec.rb +28 -8
  275. data/spec/unit/indirector/catalog/static_compiler_spec.rb +38 -20
  276. data/spec/unit/indirector/data_binding/none_spec.rb +2 -2
  277. data/spec/unit/indirector/file_bucket_file/file_spec.rb +52 -1
  278. data/spec/unit/indirector/request_spec.rb +8 -8
  279. data/spec/unit/info_service_spec.rb +236 -0
  280. data/spec/unit/module_tool/metadata_spec.rb +31 -2
  281. data/spec/unit/network/authconfig_spec.rb +62 -32
  282. data/spec/unit/network/authorization_spec.rb +30 -2
  283. data/spec/unit/network/http/connection_spec.rb +14 -19
  284. data/spec/unit/parser/compiler_spec.rb +86 -2
  285. data/spec/unit/parser/functions/create_resources_spec.rb +1 -1
  286. data/spec/unit/parser/resource_spec.rb +2 -20
  287. data/spec/unit/pops/binder/config/binder_config_spec.rb +1 -1
  288. data/spec/unit/pops/binder/injector_spec.rb +3 -3
  289. data/spec/unit/pops/evaluator/access_ops_spec.rb +13 -11
  290. data/spec/unit/pops/evaluator/basic_expressions_spec.rb +1 -2
  291. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +19 -11
  292. data/spec/unit/pops/evaluator/literal_evaluator_spec.rb +43 -0
  293. data/spec/unit/pops/label_provider_spec.rb +5 -1
  294. data/spec/unit/pops/parser/lexer2_spec.rb +33 -7
  295. data/spec/unit/pops/parser/parse_application_spec.rb +40 -0
  296. data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +4 -0
  297. data/spec/unit/pops/parser/parse_capabilities_spec.rb +47 -0
  298. data/spec/unit/pops/parser/parse_site_spec.rb +38 -0
  299. data/spec/unit/pops/parser/parser_rspec_helper.rb +5 -0
  300. data/spec/unit/pops/parser/parser_spec.rb +18 -0
  301. data/spec/unit/pops/types/type_calculator_spec.rb +427 -444
  302. data/spec/unit/pops/types/type_factory_spec.rb +12 -12
  303. data/spec/unit/pops/types/type_parser_spec.rb +7 -12
  304. data/spec/unit/pops/validator/validator_spec.rb +25 -0
  305. data/spec/unit/provider/augeas/augeas_spec.rb +50 -0
  306. data/spec/unit/provider/group/directoryservice_spec.rb +33 -0
  307. data/spec/unit/provider/group/windows_adsi_spec.rb +3 -0
  308. data/spec/unit/provider/package/dnf_spec.rb +92 -0
  309. data/spec/unit/provider/package/gem_spec.rb +7 -0
  310. data/spec/unit/provider/package/rpm_spec.rb +25 -2
  311. data/spec/unit/provider/package/windows/package_spec.rb +41 -0
  312. data/spec/unit/provider/package/yum_spec.rb +21 -13
  313. data/spec/unit/provider/scheduled_task/win32_taskscheduler_spec.rb +10 -0
  314. data/spec/unit/provider/service/debian_spec.rb +27 -0
  315. data/spec/unit/provider/service/rcng_spec.rb +41 -0
  316. data/spec/unit/provider/service/redhat_spec.rb +8 -1
  317. data/spec/unit/provider/service/smf_spec.rb +30 -5
  318. data/spec/unit/provider/service/src_spec.rb +19 -4
  319. data/spec/unit/provider/service/systemd_spec.rb +78 -29
  320. data/spec/unit/provider/sshkey/parsed_spec.rb +23 -0
  321. data/spec/unit/reports_spec.rb +10 -0
  322. data/spec/unit/resource/capability_finder_spec.rb +56 -0
  323. data/spec/unit/resource/catalog_spec.rb +31 -8
  324. data/spec/unit/resource/type_collection_spec.rb +23 -2
  325. data/spec/unit/resource/type_spec.rb +1 -1
  326. data/spec/unit/resource_spec.rb +22 -4
  327. data/spec/unit/settings_spec.rb +90 -1
  328. data/spec/unit/ssl/certificate_authority/interface_spec.rb +4 -3
  329. data/spec/unit/ssl/oids_spec.rb +8 -0
  330. data/spec/unit/transaction/additional_resource_generator_spec.rb +78 -5
  331. data/spec/unit/transaction/report_spec.rb +24 -1
  332. data/spec/unit/type/package_spec.rb +1 -0
  333. data/spec/unit/type/user_spec.rb +14 -7
  334. data/spec/unit/type_spec.rb +1 -1
  335. metadata +169 -5
  336. data/lib/puppet/pops/evaluator/callable_mismatch_describer.rb +0 -175
  337. data/spec/integration/data_binding.rb +0 -104
@@ -0,0 +1,24 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://my-server:8140/foo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: ! 'OK '
18
+ headers: {}
19
+ body:
20
+ encoding: US-ASCII
21
+ string: ''
22
+ http_version:
23
+ recorded_at: Thu, 19 Mar 2015 22:44:49 GMT
24
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,24 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: head
5
+ uri: http://my-server:8140/foo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: ! 'OK '
18
+ headers: {}
19
+ body:
20
+ encoding: US-ASCII
21
+ string: ''
22
+ http_version:
23
+ recorded_at: Thu, 19 Mar 2015 22:44:49 GMT
24
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,24 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://my-server:8140/foo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ! 'param: value'
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: ! 'OK '
18
+ headers: {}
19
+ body:
20
+ encoding: US-ASCII
21
+ string: ''
22
+ http_version:
23
+ recorded_at: Thu, 19 Mar 2015 23:15:40 GMT
24
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,229 @@
1
+ require 'spec_helper'
2
+
3
+ require 'puppet_spec/compiler'
4
+
5
+ describe "Data binding" do
6
+ include PuppetSpec::Files
7
+ include PuppetSpec::Compiler
8
+
9
+ let(:dir) { tmpdir("puppetdir") }
10
+ let(:data) {{
11
+ 'global' => {
12
+ 'testing::binding::value' => 'the value',
13
+ 'testing::binding::calling_class' => '%{calling_class}',
14
+ 'testing::binding::calling_class_path' => '%{calling_class_path}'
15
+ }
16
+ }}
17
+ let(:hash_data) {{
18
+ 'global' => {
19
+ 'testing::hash::options' => {
20
+ 'key' => 'value',
21
+ 'port' => '80',
22
+ 'bind' => 'localhost'
23
+ }
24
+ },
25
+ 'agent.example.com' => {
26
+ 'testing::hash::options' => {
27
+ 'key' => 'new value',
28
+ 'port' => '443'
29
+ }
30
+ }
31
+ }}
32
+ let(:hash_data_with_lopts) {{
33
+ 'global' => {
34
+ 'testing::hash::options' => {
35
+ 'key' => 'value',
36
+ 'port' => '80',
37
+ 'bind' => 'localhost'
38
+ }
39
+ },
40
+ 'agent.example.com' => {
41
+ 'lookup_options' => {
42
+ 'testing::hash::options' => {
43
+ 'merge' => 'deep'
44
+ }
45
+ },
46
+ 'testing::hash::options' => {
47
+ 'key' => 'new value',
48
+ 'port' => '443'
49
+ }
50
+ }
51
+ }}
52
+
53
+ before do
54
+ # Drop all occurances of cached hiera instances. This will reset @hiera in Puppet::Indirector::Hiera, Testing::DataBinding::Hiera,
55
+ # and Puppet::DataBinding::Hiera. Different classes are active as indirection depending on configuration
56
+ ObjectSpace.each_object(Class).select {|klass| klass <= Puppet::Indirector::Hiera }.each { |klass| klass.instance_variable_set(:@hiera, nil) }
57
+ Puppet[:data_binding_terminus] = 'hiera'
58
+ Puppet[:modulepath] = dir
59
+ end
60
+
61
+ it "works with the puppet backend configured, although it can't use it for lookup" do
62
+ configure_hiera_for_puppet
63
+ create_manifest_in_module("testing", "binding.pp",
64
+ <<-MANIFEST)
65
+ # lookup via the puppet backend to ensure it works
66
+ class testing::binding($value = hiera('variable')) {}
67
+ MANIFEST
68
+
69
+ create_manifest_in_module("testing", "data.pp",
70
+ <<-MANIFEST)
71
+ class testing::data (
72
+ $variable = "the value"
73
+ ) { }
74
+ MANIFEST
75
+
76
+ catalog = compile_to_catalog("include testing::data")
77
+ resource = catalog.resource('Class[testing::data]')
78
+
79
+ expect(resource[:variable]).to eq("the value")
80
+ end
81
+
82
+ context "with testing::binding and global data only" do
83
+ it "looks up global data from hiera" do
84
+ configure_hiera_for_one_tier(data)
85
+
86
+ create_manifest_in_module("testing", "binding.pp",
87
+ <<-MANIFEST)
88
+ class testing::binding($value,
89
+ $calling_class,
90
+ $calling_class_path,
91
+ $calling_module = $module_name) {}
92
+ MANIFEST
93
+
94
+ catalog = compile_to_catalog("include testing::binding")
95
+ resource = catalog.resource('Class[testing::binding]')
96
+
97
+ expect(resource[:value]).to eq("the value")
98
+ expect(resource[:calling_class]).to eq("testing::binding")
99
+ expect(resource[:calling_class_path]).to eq("testing/binding")
100
+ expect(resource[:calling_module]).to eq("testing")
101
+ end
102
+ end
103
+
104
+ context "with testing::hash and global data only" do
105
+ it "looks up global data from hiera" do
106
+ configure_hiera_for_one_tier(hash_data)
107
+
108
+ create_manifest_in_module("testing", "hash.pp",
109
+ <<-MANIFEST)
110
+ class testing::hash($options) {}
111
+ MANIFEST
112
+
113
+ catalog = compile_to_catalog("include testing::hash")
114
+ resource = catalog.resource('Class[testing::hash]')
115
+
116
+ expect(resource[:options]).to eq({
117
+ 'key' => 'value',
118
+ 'port' => '80',
119
+ 'bind' => 'localhost'
120
+ })
121
+ end
122
+ end
123
+
124
+ context "with custom clientcert" do
125
+ it "merges global data with agent.example.com data from hiera" do
126
+ configure_hiera_for_two_tier(hash_data)
127
+
128
+ create_manifest_in_module("testing", "hash.pp",
129
+ <<-MANIFEST)
130
+ class testing::hash($options) {}
131
+ MANIFEST
132
+
133
+ catalog = compile_to_catalog("include testing::hash")
134
+ resource = catalog.resource('Class[testing::hash]')
135
+
136
+ expect(resource[:options]).to eq({
137
+ 'key' => 'new value',
138
+ 'port' => '443',
139
+ })
140
+ end
141
+ end
142
+
143
+ context "with custom clientcert and with lookup_options" do
144
+ it "merges global data with agent.example.com data from hiera" do
145
+ configure_hiera_for_two_tier(hash_data_with_lopts)
146
+
147
+ create_manifest_in_module("testing", "hash.pp",
148
+ <<-MANIFEST)
149
+ class testing::hash($options) {}
150
+ MANIFEST
151
+
152
+ catalog = compile_to_catalog("include testing::hash")
153
+ resource = catalog.resource('Class[testing::hash]')
154
+
155
+ expect(resource[:options]).to eq({
156
+ 'key' => 'new value',
157
+ 'port' => '443',
158
+ 'bind' => 'localhost',
159
+ })
160
+ end
161
+ end
162
+
163
+
164
+ def configure_hiera_for_one_tier(data)
165
+ hiera_config_file = tmpfile("hiera.yaml")
166
+
167
+ File.open(hiera_config_file, 'w') do |f|
168
+ f.write("---
169
+ :yaml:
170
+ :datadir: #{dir}
171
+ :hierarchy: ['global']
172
+ :logger: 'noop'
173
+ :backends: ['yaml']
174
+ ")
175
+ end
176
+
177
+ data.each do | file, contents |
178
+ File.open(File.join(dir, "#{file}.yaml"), 'w') do |f|
179
+ f.write(YAML.dump(contents))
180
+ end
181
+ end
182
+
183
+ Puppet[:hiera_config] = hiera_config_file
184
+ end
185
+
186
+ def configure_hiera_for_two_tier(data)
187
+ hiera_config_file = tmpfile("hiera.yaml")
188
+
189
+ File.open(hiera_config_file, 'w') do |f|
190
+ f.write("---
191
+ :yaml:
192
+ :datadir: #{dir}
193
+ :hierarchy: ['agent.example.com', 'global']
194
+ :logger: 'noop'
195
+ :backends: ['yaml']
196
+ ")
197
+ end
198
+
199
+ data.each do | file, contents |
200
+ File.open(File.join(dir, "#{file}.yaml"), 'w') do |f|
201
+ f.write(YAML.dump(contents))
202
+ end
203
+ end
204
+
205
+ Puppet[:hiera_config] = hiera_config_file
206
+ end
207
+
208
+ def configure_hiera_for_puppet
209
+ hiera_config_file = tmpfile("hiera.yaml")
210
+
211
+ File.open(hiera_config_file, 'w') do |f|
212
+ f.write("---
213
+ :logger: 'noop'
214
+ :backends: ['puppet']
215
+ ")
216
+ end
217
+
218
+ Puppet[:hiera_config] = hiera_config_file
219
+ end
220
+
221
+ def create_manifest_in_module(module_name, name, manifest)
222
+ module_dir = File.join(dir, module_name, 'manifests')
223
+ FileUtils.mkdir_p(module_dir)
224
+
225
+ File.open(File.join(module_dir, name), 'w') do |f|
226
+ f.write(manifest)
227
+ end
228
+ end
229
+ end
@@ -18,7 +18,7 @@ describe Puppet::FileBucket::File do
18
18
 
19
19
  {
20
20
  "md5/d41d8cd98f00b204e9800998ecf8427e" => :file,
21
- "https://puppetmaster:8140/production/file_bucket_file/md5/d41d8cd98f00b204e9800998ecf8427e" => :file,
21
+ "filebucket://puppetmaster:8140/md5/d41d8cd98f00b204e9800998ecf8427e" => :file,
22
22
  }.each do |key, terminus|
23
23
  it "should use the #{terminus} terminus when requesting #{key.inspect}" do
24
24
  described_class.indirection.terminus(terminus).class.any_instance.expects(:find)
@@ -31,7 +31,7 @@ describe Puppet::FileBucket::File do
31
31
  describe "when running another application" do
32
32
  {
33
33
  "md5/d41d8cd98f00b204e9800998ecf8427e" => :file,
34
- "https://puppetmaster:8140/production/file_bucket_file/md5/d41d8cd98f00b204e9800998ecf8427e" => :rest,
34
+ "filebucket://puppetmaster:8140/md5/d41d8cd98f00b204e9800998ecf8427e" => :rest,
35
35
  }.each do |key, terminus|
36
36
  it "should use the #{terminus} terminus when requesting #{key.inspect}" do
37
37
  described_class.indirection.terminus(terminus).class.any_instance.expects(:find)
@@ -49,6 +49,10 @@ class CompilerTestResource
49
49
  def line
50
50
  "42"
51
51
  end
52
+
53
+ def resource_type
54
+ self.class
55
+ end
52
56
  end
53
57
 
54
58
  describe Puppet::Parser::Compiler do
@@ -655,7 +659,7 @@ describe Puppet::Parser::Compiler do
655
659
  @node.classes = klass
656
660
  klass = Puppet::Resource::Type.new(:hostclass, 'foo', :arguments => {'a' => nil, 'b' => nil})
657
661
  @compiler.topscope.known_resource_types.add klass
658
- expect { @compiler.compile }.to raise_error(Puppet::ParseError, "Must pass b to Class[Foo]")
662
+ expect { @compiler.compile }.to raise_error(Puppet::PreformattedError, /Class\[Foo\]: expects a value for parameter 'b'/)
659
663
  end
660
664
 
661
665
  it "should fail if invalid parameters are passed" do
@@ -663,7 +667,7 @@ describe Puppet::Parser::Compiler do
663
667
  @node.classes = klass
664
668
  klass = Puppet::Resource::Type.new(:hostclass, 'foo', :arguments => {})
665
669
  @compiler.topscope.known_resource_types.add klass
666
- expect { @compiler.compile }.to raise_error(Puppet::ParseError, "Invalid parameter: '3' on Class[Foo]")
670
+ expect { @compiler.compile }.to raise_error(Puppet::PreformattedError, /Class\[Foo\]: has no parameter named '3'/)
667
671
  end
668
672
 
669
673
  it "should ensure class is in catalog without params" do
@@ -1452,7 +1456,7 @@ describe Puppet::Parser::Compiler do
1452
1456
  define foo(Integer $x) { }
1453
1457
  foo { 'test': x =>'say friend' }
1454
1458
  MANIFEST
1455
- end.to raise_error(/type Integer, got String/)
1459
+ end.to raise_error(/Foo\[test\]: parameter 'x' expects an Integer value, got String/)
1456
1460
  end
1457
1461
 
1458
1462
  it 'denies undef for a non-optional type' do
@@ -1461,7 +1465,7 @@ describe Puppet::Parser::Compiler do
1461
1465
  define foo(Integer $x) { }
1462
1466
  foo { 'test': x => undef }
1463
1467
  MANIFEST
1464
- end.to raise_error(/type Integer, got Undef/)
1468
+ end.to raise_error(/Foo\[test\]: parameter 'x' expects an Integer value, got Undef/)
1465
1469
  end
1466
1470
 
1467
1471
  it 'denies non type compliant default argument' do
@@ -1470,7 +1474,7 @@ describe Puppet::Parser::Compiler do
1470
1474
  define foo(Integer $x = 'pow') { }
1471
1475
  foo { 'test': }
1472
1476
  MANIFEST
1473
- end.to raise_error(/type Integer, got String/)
1477
+ end.to raise_error(/Foo\[test\]: parameter 'x' expects an Integer value, got String/)
1474
1478
  end
1475
1479
 
1476
1480
  it 'denies undef as the default for a non-optional type' do
@@ -1479,7 +1483,7 @@ describe Puppet::Parser::Compiler do
1479
1483
  define foo(Integer $x = undef) { }
1480
1484
  foo { 'test': }
1481
1485
  MANIFEST
1482
- end.to raise_error(/type Integer, got Undef/)
1486
+ end.to raise_error(/Foo\[test\]: parameter 'x' expects an Integer value, got Undef/)
1483
1487
  end
1484
1488
 
1485
1489
  it 'accepts a Resource as a Type' do
@@ -1500,7 +1504,7 @@ describe Puppet::Parser::Compiler do
1500
1504
  define foo(Struct[{b => Integer, d=>String}] $a) { }
1501
1505
  foo{ bar: a => {b => 5, c => 'stuff'}}
1502
1506
  MANIFEST
1503
- end.to raise_error(/got Struct\[\{'b'=>Integer, 'c'=>String\}\]/)
1507
+ end.to raise_error(/Foo\[bar\]:\s+parameter 'a' expects a value for key 'd'\s+parameter 'a' has no 'c' key/m)
1504
1508
  end
1505
1509
  end
1506
1510
 
@@ -1538,7 +1542,7 @@ describe Puppet::Parser::Compiler do
1538
1542
  class foo(Integer $x) { }
1539
1543
  class { 'foo': x =>'say friend' }
1540
1544
  MANIFEST
1541
- end.to raise_error(/type Integer, got String/)
1545
+ end.to raise_error(/Class\[Foo\]: parameter 'x' expects an Integer value, got String/)
1542
1546
  end
1543
1547
 
1544
1548
  it 'denies undef for a non-optional type' do
@@ -1547,7 +1551,7 @@ describe Puppet::Parser::Compiler do
1547
1551
  class foo(Integer $x) { }
1548
1552
  class { 'foo': x => undef }
1549
1553
  MANIFEST
1550
- end.to raise_error(/type Integer, got Undef/)
1554
+ end.to raise_error(/Class\[Foo\]: parameter 'x' expects an Integer value, got Undef/)
1551
1555
  end
1552
1556
 
1553
1557
  it 'denies non type compliant default argument' do
@@ -1556,7 +1560,7 @@ describe Puppet::Parser::Compiler do
1556
1560
  class foo(Integer $x = 'pow') { }
1557
1561
  class { 'foo': }
1558
1562
  MANIFEST
1559
- end.to raise_error(/type Integer, got String/)
1563
+ end.to raise_error(/Class\[Foo\]: parameter 'x' expects an Integer value, got String/)
1560
1564
  end
1561
1565
 
1562
1566
  it 'denies undef as the default for a non-optional type' do
@@ -1565,7 +1569,7 @@ describe Puppet::Parser::Compiler do
1565
1569
  class foo(Integer $x = undef) { }
1566
1570
  class { 'foo': }
1567
1571
  MANIFEST
1568
- end.to raise_error(/type Integer, got Undef/)
1572
+ end.to raise_error(/Class\[Foo\]: parameter 'x' expects an Integer value, got Undef/)
1569
1573
  end
1570
1574
 
1571
1575
  it 'accepts a Resource as a Type' do
@@ -1632,7 +1636,7 @@ describe Puppet::Parser::Compiler do
1632
1636
  compile_to_catalog(<<-MANIFEST)
1633
1637
  with(1) |String $x| { }
1634
1638
  MANIFEST
1635
- end.to raise_error(/expected.*String.*actual.*Integer/m)
1639
+ end.to raise_error(/block parameter 'x' expects a String value, got Integer/m)
1636
1640
  end
1637
1641
 
1638
1642
  it 'denies non-type-compliant, slurped arguments' do
@@ -1640,7 +1644,7 @@ describe Puppet::Parser::Compiler do
1640
1644
  compile_to_catalog(<<-MANIFEST)
1641
1645
  with(1, "hello") |Integer *$x| { }
1642
1646
  MANIFEST
1643
- end.to raise_error(/called with mis-matched arguments.*expected.*Integer.*actual.*Integer, String/m)
1647
+ end.to raise_error(/block parameter 'x' expects an Integer value, got String/m)
1644
1648
  end
1645
1649
 
1646
1650
  it 'denies non-type-compliant default argument' do
@@ -1648,7 +1652,7 @@ describe Puppet::Parser::Compiler do
1648
1652
  compile_to_catalog(<<-MANIFEST)
1649
1653
  with(1) |$x, String $defaulted = 1| { notify { "${$x + $defaulted}": }}
1650
1654
  MANIFEST
1651
- end.to raise_error(/expected.*Any.*String.*actual.*Integer.*Integer/m)
1655
+ end.to raise_error(/block parameter 'defaulted' expects a String value, got Integer/m)
1652
1656
  end
1653
1657
 
1654
1658
  it 'raises an error when a default argument value is an incorrect type and there are no arguments passed' do
@@ -1656,7 +1660,7 @@ describe Puppet::Parser::Compiler do
1656
1660
  compile_to_catalog(<<-MANIFEST)
1657
1661
  with() |String $defaulted = 1| {}
1658
1662
  MANIFEST
1659
- end.to raise_error(/expected.*String.*actual.*Integer/m)
1663
+ end.to raise_error(/block parameter 'defaulted' expects a String value, got Integer/m)
1660
1664
  end
1661
1665
 
1662
1666
  it 'raises an error when the default argument for a slurped parameter is an incorrect type' do
@@ -1664,7 +1668,7 @@ describe Puppet::Parser::Compiler do
1664
1668
  compile_to_catalog(<<-MANIFEST)
1665
1669
  with() |String *$defaulted = 1| {}
1666
1670
  MANIFEST
1667
- end.to raise_error(/expected.*String.*actual.*Integer/m)
1671
+ end.to raise_error(/block parameter 'defaulted' expects a String value, got Integer/m)
1668
1672
  end
1669
1673
 
1670
1674
  it 'allows using an array as the default slurped value' do
@@ -1696,7 +1700,7 @@ describe Puppet::Parser::Compiler do
1696
1700
  compile_to_catalog(<<-MANIFEST)
1697
1701
  with() |Array[String, 2] *$defaulted = hi| { }
1698
1702
  MANIFEST
1699
- end.to raise_error(/expected.*arg count \{2,\}.*actual.*arg count \{1\}/m)
1703
+ end.to raise_error(/block expects at least 2 arguments, got 1/m)
1700
1704
  end
1701
1705
 
1702
1706
  it 'raises an error when the number of passed values does not match the parameter\'s size specification' do
@@ -1704,7 +1708,7 @@ describe Puppet::Parser::Compiler do
1704
1708
  compile_to_catalog(<<-MANIFEST)
1705
1709
  with(hi) |Array[String, 2] *$passed| { }
1706
1710
  MANIFEST
1707
- end.to raise_error(/expected.*arg count \{2,\}.*actual.*arg count \{1\}/m)
1711
+ end.to raise_error(/block expects at least 2 arguments, got 1/m)
1708
1712
  end
1709
1713
 
1710
1714
  it 'matches when the number of arguments passed for a slurp parameter match the size specification' do
@@ -1723,7 +1727,7 @@ describe Puppet::Parser::Compiler do
1723
1727
  compile_to_catalog(<<-MANIFEST)
1724
1728
  with(hi, bye) |Array[String, 1, 1] *$passed| { }
1725
1729
  MANIFEST
1726
- end.to raise_error(/expected.*arg count \{1\}.*actual.*arg count \{2\}/m)
1730
+ end.to raise_error(/block expects 1 argument, got 2/m)
1727
1731
  end
1728
1732
 
1729
1733
  it 'allows passing slurped arrays by specifying an array of arrays' do