puppet 5.3.7-universal-darwin → 5.4.0-universal-darwin

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 (454) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +42 -29
  3. data/README.md +8 -6
  4. data/ext/cert_inspector +2 -2
  5. data/ext/envpuppet +1 -1
  6. data/ext/gentoo/init.d/puppetmaster +4 -4
  7. data/ext/ips/puppet-agent +11 -11
  8. data/ext/ips/puppet-master +11 -11
  9. data/ext/puppet-test +1 -2
  10. data/ext/redhat/client.init +2 -2
  11. data/ext/redhat/logrotate +1 -1
  12. data/ext/solaris/smf/puppet +11 -11
  13. data/ext/solaris/smf/svc-puppetd +5 -5
  14. data/ext/solaris/smf/svc-puppetmasterd +5 -5
  15. data/ext/windows/service/daemon.rb +1 -1
  16. data/install.rb +2 -3
  17. data/lib/puppet/agent.rb +1 -1
  18. data/lib/puppet/application/cert.rb +1 -3
  19. data/lib/puppet/application/describe.rb +0 -1
  20. data/lib/puppet/application/device.rb +12 -99
  21. data/lib/puppet/application/filebucket.rb +32 -11
  22. data/lib/puppet/application/lookup.rb +1 -11
  23. data/lib/puppet/application/script.rb +261 -0
  24. data/lib/puppet/configurer.rb +3 -4
  25. data/lib/puppet/configurer/plugin_handler.rb +26 -9
  26. data/lib/puppet/context.rb +1 -1
  27. data/lib/puppet/datatypes.rb +213 -0
  28. data/lib/puppet/datatypes/error.rb +21 -0
  29. data/lib/puppet/datatypes/impl/error.rb +40 -0
  30. data/lib/puppet/defaults.rb +51 -20
  31. data/lib/puppet/environments.rb +17 -0
  32. data/lib/puppet/error.rb +17 -0
  33. data/lib/puppet/etc.rb +2 -2
  34. data/lib/puppet/external/pson/pure/generator.rb +1 -1
  35. data/lib/puppet/external/pson/pure/parser.rb +1 -1
  36. data/lib/puppet/face/config.rb +45 -0
  37. data/lib/puppet/face/epp.rb +3 -3
  38. data/lib/puppet/face/help/action.erb +3 -0
  39. data/lib/puppet/face/module/build.rb +1 -0
  40. data/lib/puppet/face/module/generate.rb +5 -0
  41. data/lib/puppet/face/module/install.rb +1 -0
  42. data/lib/puppet/face/module/search.rb +6 -2
  43. data/lib/puppet/face/module/uninstall.rb +1 -0
  44. data/lib/puppet/face/module/upgrade.rb +1 -0
  45. data/lib/puppet/face/parser.rb +0 -1
  46. data/lib/puppet/face/plugin.rb +1 -3
  47. data/lib/puppet/feature/base.rb +1 -1
  48. data/lib/puppet/feature/bolt.rb +3 -0
  49. data/lib/puppet/file_bucket/dipper.rb +1 -2
  50. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  51. data/lib/puppet/file_system/uniquefile.rb +2 -2
  52. data/lib/puppet/forge.rb +6 -0
  53. data/lib/puppet/functions.rb +70 -88
  54. data/lib/puppet/functions/all.rb +6 -2
  55. data/lib/puppet/functions/annotate.rb +1 -1
  56. data/lib/puppet/functions/any.rb +7 -3
  57. data/lib/puppet/functions/contain.rb +6 -0
  58. data/lib/puppet/functions/convert_to.rb +32 -0
  59. data/lib/puppet/functions/defined.rb +0 -3
  60. data/lib/puppet/functions/each.rb +10 -6
  61. data/lib/puppet/functions/filter.rb +16 -10
  62. data/lib/puppet/functions/find_file.rb +0 -1
  63. data/lib/puppet/functions/include.rb +6 -0
  64. data/lib/puppet/functions/map.rb +12 -9
  65. data/lib/puppet/functions/module_directory.rb +41 -0
  66. data/lib/puppet/functions/new.rb +1 -4
  67. data/lib/puppet/functions/regsubst.rb +1 -1
  68. data/lib/puppet/functions/require.rb +6 -0
  69. data/lib/puppet/generate/type.rb +1 -1
  70. data/lib/puppet/gettext/config.rb +2 -2
  71. data/lib/puppet/gettext/stubs.rb +1 -1
  72. data/lib/puppet/indirector/catalog/compiler.rb +0 -1
  73. data/lib/puppet/indirector/file_bucket_file/file.rb +6 -2
  74. data/lib/puppet/indirector/file_server.rb +1 -1
  75. data/lib/puppet/indirector/node/ldap.rb +19 -3
  76. data/lib/puppet/indirector/request.rb +10 -6
  77. data/lib/puppet/indirector/rest.rb +11 -12
  78. data/lib/puppet/info_service/class_information_service.rb +1 -1
  79. data/lib/puppet/interface/action.rb +11 -0
  80. data/lib/puppet/interface/action_builder.rb +8 -0
  81. data/lib/puppet/interface/option_manager.rb +1 -1
  82. data/lib/puppet/loaders.rb +2 -0
  83. data/lib/puppet/module.rb +6 -2
  84. data/lib/puppet/module_tool/applications/builder.rb +4 -0
  85. data/lib/puppet/module_tool/applications/installer.rb +3 -0
  86. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -0
  87. data/lib/puppet/module_tool/applications/unpacker.rb +1 -1
  88. data/lib/puppet/module_tool/applications/upgrader.rb +3 -0
  89. data/lib/puppet/module_tool/installed_modules.rb +1 -1
  90. data/lib/puppet/module_tool/metadata.rb +0 -1
  91. data/lib/puppet/network/authstore.rb +1 -1
  92. data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
  93. data/lib/puppet/network/http/connection.rb +1 -9
  94. data/lib/puppet/network/http/factory.rb +0 -3
  95. data/lib/puppet/network/http/webrick.rb +1 -0
  96. data/lib/puppet/network/rights.rb +1 -1
  97. data/lib/puppet/node.rb +53 -0
  98. data/lib/puppet/node/environment.rb +1 -1
  99. data/lib/puppet/parameter/boolean.rb +1 -1
  100. data/lib/puppet/parser.rb +1 -0
  101. data/lib/puppet/parser/abstract_compiler.rb +36 -0
  102. data/lib/puppet/parser/ast/branch.rb +1 -1
  103. data/lib/puppet/parser/ast/pops_bridge.rb +8 -52
  104. data/lib/puppet/parser/compiler.rb +4 -54
  105. data/lib/puppet/parser/functions.rb +0 -1
  106. data/lib/puppet/parser/functions/create_resources.rb +6 -0
  107. data/lib/puppet/parser/functions/fqdn_rand.rb +6 -2
  108. data/lib/puppet/parser/functions/inline_template.rb +6 -0
  109. data/lib/puppet/parser/functions/new.rb +47 -32
  110. data/lib/puppet/parser/functions/realize.rb +6 -0
  111. data/lib/puppet/parser/functions/return.rb +1 -22
  112. data/lib/puppet/parser/functions/reverse_each.rb +1 -1
  113. data/lib/puppet/parser/functions/scanf.rb +1 -1
  114. data/lib/puppet/parser/functions/sha256.rb +5 -0
  115. data/lib/puppet/parser/functions/tag.rb +6 -0
  116. data/lib/puppet/parser/functions/tagged.rb +6 -0
  117. data/lib/puppet/parser/functions/template.rb +5 -0
  118. data/lib/puppet/parser/scope.rb +28 -4
  119. data/lib/puppet/parser/script_compiler.rb +118 -0
  120. data/lib/puppet/parser/type_loader.rb +1 -1
  121. data/lib/puppet/pops.rb +1 -1
  122. data/lib/puppet/pops/evaluator/access_operator.rb +38 -4
  123. data/lib/puppet/pops/evaluator/closure.rb +12 -4
  124. data/lib/puppet/pops/evaluator/compare_operator.rb +4 -4
  125. data/lib/puppet/pops/evaluator/epp_evaluator.rb +13 -0
  126. data/lib/puppet/pops/evaluator/evaluator_impl.rb +38 -10
  127. data/lib/puppet/pops/evaluator/literal_evaluator.rb +1 -1
  128. data/lib/puppet/pops/evaluator/runtime3_converter.rb +1 -1
  129. data/lib/puppet/pops/evaluator/runtime3_support.rb +2 -3
  130. data/lib/puppet/pops/functions/dispatch.rb +6 -5
  131. data/lib/puppet/pops/functions/function.rb +2 -2
  132. data/lib/puppet/pops/issues.rb +34 -2
  133. data/lib/puppet/pops/loader/base_loader.rb +10 -0
  134. data/lib/puppet/pops/loader/dependency_loader.rb +7 -0
  135. data/lib/puppet/pops/loader/loader.rb +21 -2
  136. data/lib/puppet/pops/loader/loader_paths.rb +180 -30
  137. data/lib/puppet/pops/loader/module_loaders.rb +202 -33
  138. data/lib/puppet/pops/loader/puppet_plan_instantiator.rb +84 -0
  139. data/lib/puppet/pops/loader/puppet_resource_type_impl_instantiator.rb +9 -9
  140. data/lib/puppet/pops/loader/ruby_data_type_instantiator.rb +40 -0
  141. data/lib/puppet/pops/loader/runtime3_type_loader.rb +6 -1
  142. data/lib/puppet/pops/loader/static_loader.rb +23 -8
  143. data/lib/puppet/pops/loader/task_instantiator.rb +69 -0
  144. data/lib/puppet/pops/loader/type_definition_instantiator.rb +4 -0
  145. data/lib/puppet/pops/loaders.rb +122 -11
  146. data/lib/puppet/pops/lookup/data_dig_function_provider.rb +1 -1
  147. data/lib/puppet/pops/lookup/interpolation.rb +1 -1
  148. data/lib/puppet/pops/lookup/lookup_adapter.rb +0 -1
  149. data/lib/puppet/pops/model/ast.pp +3 -0
  150. data/lib/puppet/pops/model/ast.rb +34 -1
  151. data/lib/puppet/pops/model/factory.rb +30 -3
  152. data/lib/puppet/pops/model/model_label_provider.rb +1 -0
  153. data/lib/puppet/pops/model/model_tree_dumper.rb +12 -1
  154. data/lib/puppet/pops/model/tree_dumper.rb +1 -1
  155. data/lib/puppet/pops/parser/code_merger.rb +2 -2
  156. data/lib/puppet/pops/parser/egrammar.ra +44 -15
  157. data/lib/puppet/pops/parser/eparser.rb +1687 -1571
  158. data/lib/puppet/pops/parser/epp_support.rb +1 -3
  159. data/lib/puppet/pops/parser/evaluating_parser.rb +1 -1
  160. data/lib/puppet/pops/parser/interpolation_support.rb +2 -2
  161. data/lib/puppet/pops/parser/lexer2.rb +4 -4
  162. data/lib/puppet/pops/parser/lexer_support.rb +2 -2
  163. data/lib/puppet/pops/parser/locatable.rb +1 -1
  164. data/lib/puppet/pops/parser/locator.rb +7 -13
  165. data/lib/puppet/pops/parser/parser_support.rb +3 -3
  166. data/lib/puppet/pops/parser/slurp_support.rb +0 -3
  167. data/lib/puppet/pops/pcore.rb +45 -0
  168. data/lib/puppet/pops/resource/param.rb +1 -1
  169. data/lib/puppet/pops/resource/resource_type_impl.rb +1 -1
  170. data/lib/puppet/pops/serialization/abstract_reader.rb +4 -0
  171. data/lib/puppet/pops/serialization/abstract_writer.rb +6 -0
  172. data/lib/puppet/pops/serialization/extension.rb +1 -0
  173. data/lib/puppet/pops/serialization/from_data_converter.rb +64 -10
  174. data/lib/puppet/pops/serialization/json_path.rb +2 -1
  175. data/lib/puppet/pops/serialization/object.rb +3 -4
  176. data/lib/puppet/pops/serialization/serializer.rb +2 -1
  177. data/lib/puppet/pops/serialization/to_data_converter.rb +7 -3
  178. data/lib/puppet/pops/time/timespan.rb +1 -1
  179. data/lib/puppet/pops/types/iterable.rb +38 -9
  180. data/lib/puppet/pops/types/p_init_type.rb +1 -1
  181. data/lib/puppet/pops/types/p_meta_type.rb +4 -0
  182. data/lib/puppet/pops/types/p_object_type.rb +146 -14
  183. data/lib/puppet/pops/types/p_object_type_extension.rb +218 -0
  184. data/lib/puppet/pops/types/p_sem_ver_range_type.rb +0 -1
  185. data/lib/puppet/pops/types/p_sem_ver_type.rb +10 -2
  186. data/lib/puppet/pops/types/p_type_set_type.rb +0 -1
  187. data/lib/puppet/pops/types/p_uri_type.rb +190 -0
  188. data/lib/puppet/pops/types/puppet_object.rb +15 -1
  189. data/lib/puppet/pops/types/ruby_generator.rb +46 -54
  190. data/lib/puppet/pops/types/string_converter.rb +22 -1
  191. data/lib/puppet/pops/types/type_acceptor.rb +1 -1
  192. data/lib/puppet/pops/types/type_calculator.rb +13 -4
  193. data/lib/puppet/pops/types/type_factory.rb +29 -5
  194. data/lib/puppet/pops/types/type_formatter.rb +67 -4
  195. data/lib/puppet/pops/types/type_parser.rb +92 -4
  196. data/lib/puppet/pops/types/type_with_members.rb +43 -0
  197. data/lib/puppet/pops/types/types.rb +212 -80
  198. data/lib/puppet/pops/validation/checker4_0.rb +10 -6
  199. data/lib/puppet/pops/validation/tasks_checker.rb +60 -0
  200. data/lib/puppet/pops/validation/validator_factory_4_0.rb +6 -1
  201. data/lib/puppet/property.rb +1 -1
  202. data/lib/puppet/provider.rb +18 -8
  203. data/lib/puppet/provider/augeas/augeas.rb +3 -4
  204. data/lib/puppet/provider/exec.rb +0 -2
  205. data/lib/puppet/provider/group/groupadd.rb +25 -1
  206. data/lib/puppet/provider/group/windows_adsi.rb +7 -4
  207. data/lib/puppet/provider/mount.rb +25 -8
  208. data/lib/puppet/provider/nameservice.rb +9 -4
  209. data/lib/puppet/provider/nameservice/directoryservice.rb +3 -3
  210. data/lib/puppet/provider/nameservice/objectadd.rb +13 -24
  211. data/lib/puppet/provider/nameservice/pw.rb +14 -14
  212. data/lib/puppet/provider/package/appdmg.rb +0 -1
  213. data/lib/puppet/provider/package/apple.rb +0 -1
  214. data/lib/puppet/provider/package/gem.rb +2 -2
  215. data/lib/puppet/provider/package/macports.rb +2 -2
  216. data/lib/puppet/provider/package/pkg.rb +3 -0
  217. data/lib/puppet/provider/package/pkgdmg.rb +0 -1
  218. data/lib/puppet/provider/package/portage.rb +0 -1
  219. data/lib/puppet/provider/package/yum.rb +23 -8
  220. data/lib/puppet/provider/package/zypper.rb +2 -2
  221. data/lib/puppet/provider/scheduled_task/win32_taskscheduler.rb +2 -2
  222. data/lib/puppet/provider/service/init.rb +1 -0
  223. data/lib/puppet/provider/service/launchd.rb +6 -7
  224. data/lib/puppet/provider/service/redhat.rb +3 -2
  225. data/lib/puppet/provider/service/systemd.rb +2 -2
  226. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +1 -1
  227. data/lib/puppet/provider/user/aix.rb +3 -2
  228. data/lib/puppet/provider/user/openbsd.rb +1 -1
  229. data/lib/puppet/provider/user/pw.rb +1 -1
  230. data/lib/puppet/provider/user/user_role_add.rb +7 -1
  231. data/lib/puppet/provider/user/useradd.rb +36 -6
  232. data/lib/puppet/provider/user/windows_adsi.rb +1 -1
  233. data/lib/puppet/provider/yumrepo/inifile.rb +2 -4
  234. data/lib/puppet/provider/zfs/zfs.rb +23 -3
  235. data/lib/puppet/provider/zpool/zpool.rb +1 -1
  236. data/lib/puppet/reference/configuration.rb +0 -2
  237. data/lib/puppet/reference/type.rb +0 -1
  238. data/lib/puppet/resource.rb +1 -2
  239. data/lib/puppet/resource/catalog.rb +1 -1
  240. data/lib/puppet/resource/status.rb +0 -1
  241. data/lib/puppet/resource/type.rb +4 -4
  242. data/lib/puppet/resource/type_collection.rb +1 -1
  243. data/lib/puppet/settings/base_setting.rb +1 -1
  244. data/lib/puppet/settings/environment_conf.rb +0 -1
  245. data/lib/puppet/settings/ini_file.rb +66 -12
  246. data/lib/puppet/ssl/certificate_authority.rb +1 -1
  247. data/lib/puppet/ssl/certificate_request.rb +2 -2
  248. data/lib/puppet/ssl/certificate_revocation_list.rb +2 -1
  249. data/lib/puppet/ssl/certificate_signer.rb +11 -0
  250. data/lib/puppet/ssl/host.rb +2 -2
  251. data/lib/puppet/syntax_checkers/base64.rb +1 -1
  252. data/lib/puppet/transaction.rb +37 -14
  253. data/lib/puppet/transaction/report.rb +3 -1
  254. data/lib/puppet/type.rb +17 -4
  255. data/lib/puppet/type/cron.rb +1 -1
  256. data/lib/puppet/type/exec.rb +5 -4
  257. data/lib/puppet/type/file.rb +3 -3
  258. data/lib/puppet/type/file/checksum.rb +7 -1
  259. data/lib/puppet/type/file/checksum_value.rb +4 -3
  260. data/lib/puppet/type/group.rb +3 -0
  261. data/lib/puppet/type/k5login.rb +101 -0
  262. data/lib/puppet/type/macauthorization.rb +1 -1
  263. data/lib/puppet/type/mount.rb +6 -2
  264. data/lib/puppet/type/tidy.rb +6 -4
  265. data/lib/puppet/type/user.rb +26 -39
  266. data/lib/puppet/type/yumrepo.rb +9 -0
  267. data/lib/puppet/type/zfs.rb +4 -0
  268. data/lib/puppet/util.rb +8 -15
  269. data/lib/puppet/util/character_encoding.rb +2 -2
  270. data/lib/puppet/util/checksums.rb +82 -1
  271. data/lib/puppet/util/errors.rb +0 -2
  272. data/lib/puppet/util/filetype.rb +2 -2
  273. data/lib/puppet/util/json_lockfile.rb +1 -1
  274. data/lib/puppet/util/log.rb +1 -1
  275. data/lib/puppet/util/log/destinations.rb +10 -1
  276. data/lib/puppet/util/monkey_patches.rb +1 -1
  277. data/lib/puppet/util/network_device/cisco/device.rb +5 -5
  278. data/lib/puppet/util/network_device/config.rb +2 -3
  279. data/lib/puppet/util/platform.rb +13 -0
  280. data/lib/puppet/util/plist.rb +4 -4
  281. data/lib/puppet/util/rdoc/generators/puppet_generator.rb +2 -2
  282. data/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb +1 -1
  283. data/lib/puppet/util/reference.rb +8 -1
  284. data/lib/puppet/util/windows/adsi.rb +18 -15
  285. data/lib/puppet/util/windows/principal.rb +6 -7
  286. data/lib/puppet/util/windows/process.rb +1 -1
  287. data/lib/puppet/util/windows/registry.rb +2 -2
  288. data/lib/puppet/util/windows/sid.rb +7 -62
  289. data/lib/puppet/vendor/deep_merge/README.md +2 -2
  290. data/lib/puppet/vendor/pathspec/lib/pathspec/gitignorespec.rb +18 -18
  291. data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version.rb +2 -2
  292. data/lib/puppet/vendor/semantic_puppet/lib/semantic_puppet/version_range.rb +5 -5
  293. data/lib/puppet/vendor/semantic_puppet/locales/config.yaml +1 -1
  294. data/lib/puppet/version.rb +1 -1
  295. data/lib/puppet_pal.rb +874 -0
  296. data/locales/ja/puppet.po +140 -163
  297. data/locales/puppet.pot +940 -597
  298. data/man/man5/puppet.conf.5 +16 -91
  299. data/man/man8/puppet-agent.8 +2 -6
  300. data/man/man8/puppet-apply.8 +2 -2
  301. data/man/man8/puppet-ca.8 +1 -1
  302. data/man/man8/puppet-catalog.8 +1 -1
  303. data/man/man8/puppet-cert.8 +1 -1
  304. data/man/man8/puppet-certificate.8 +1 -1
  305. data/man/man8/puppet-certificate_request.8 +1 -1
  306. data/man/man8/puppet-certificate_revocation_list.8 +1 -1
  307. data/man/man8/puppet-config.8 +1 -1
  308. data/man/man8/puppet-describe.8 +1 -1
  309. data/man/man8/puppet-device.8 +11 -33
  310. data/man/man8/puppet-doc.8 +1 -1
  311. data/man/man8/puppet-epp.8 +1 -1
  312. data/man/man8/puppet-facts.8 +1 -1
  313. data/man/man8/puppet-filebucket.8 +4 -22
  314. data/man/man8/puppet-generate.8 +1 -1
  315. data/man/man8/puppet-help.8 +1 -1
  316. data/man/man8/puppet-key.8 +1 -1
  317. data/man/man8/puppet-lookup.8 +1 -1
  318. data/man/man8/puppet-man.8 +1 -1
  319. data/man/man8/puppet-master.8 +1 -1
  320. data/man/man8/puppet-module.8 +2 -11
  321. data/man/man8/puppet-node.8 +1 -1
  322. data/man/man8/puppet-parser.8 +1 -1
  323. data/man/man8/puppet-plugin.8 +1 -1
  324. data/man/man8/puppet-report.8 +1 -1
  325. data/man/man8/puppet-resource.8 +1 -1
  326. data/man/man8/puppet-status.8 +1 -1
  327. data/man/man8/puppet.8 +2 -2
  328. data/spec/integration/application/lookup_spec.rb +0 -21
  329. data/spec/integration/parser/compiler_spec.rb +18 -0
  330. data/spec/integration/parser/script_compiler_spec.rb +113 -0
  331. data/spec/integration/provider/mount_spec.rb +2 -0
  332. data/spec/integration/type/file_spec.rb +11 -3
  333. data/spec/integration/util/windows/adsi_spec.rb +1 -86
  334. data/spec/integration/util/windows/principal_spec.rb +1 -10
  335. data/spec/shared_contexts/checksum.rb +4 -1
  336. data/spec/shared_contexts/digests.rb +46 -1
  337. data/spec/shared_contexts/types_setup.rb +8 -3
  338. data/spec/unit/agent_spec.rb +2 -2
  339. data/spec/unit/application/cert_spec.rb +5 -17
  340. data/spec/unit/application/device_spec.rb +2 -96
  341. data/spec/unit/application/filebucket_spec.rb +18 -4
  342. data/spec/unit/configurer/plugin_handler_spec.rb +5 -32
  343. data/spec/unit/configurer_spec.rb +3 -3
  344. data/spec/unit/datatypes_spec.rb +304 -0
  345. data/spec/unit/defaults_spec.rb +41 -20
  346. data/spec/unit/face/config_spec.rb +46 -1
  347. data/spec/unit/face/epp_face_spec.rb +7 -3
  348. data/spec/unit/face/module/search_spec.rb +11 -0
  349. data/spec/unit/face/parser_spec.rb +2 -2
  350. data/spec/unit/file_bucket/dipper_spec.rb +12 -1
  351. data/spec/unit/forge/module_release_spec.rb +70 -0
  352. data/spec/unit/functions/break_spec.rb +34 -2
  353. data/spec/unit/functions/contain_spec.rb +1 -0
  354. data/spec/unit/functions/convert_to_spec.rb +22 -0
  355. data/spec/unit/functions/epp_spec.rb +5 -0
  356. data/spec/unit/functions/include_spec.rb +15 -0
  357. data/spec/unit/functions/module_directory_spec.rb +43 -0
  358. data/spec/unit/functions/new_spec.rb +14 -14
  359. data/spec/unit/functions/require_spec.rb +2 -0
  360. data/spec/unit/functions/shared.rb +12 -0
  361. data/spec/unit/functions/step_spec.rb +1 -1
  362. data/spec/unit/functions4_spec.rb +49 -4
  363. data/spec/unit/indirector/catalog/compiler_spec.rb +3 -3
  364. data/spec/unit/indirector/file_bucket_file/file_spec.rb +148 -94
  365. data/spec/unit/indirector/node/ldap_spec.rb +15 -12
  366. data/spec/unit/indirector/rest_spec.rb +0 -43
  367. data/spec/unit/interface/action_spec.rb +33 -0
  368. data/spec/unit/module_tool/applications/builder_spec.rb +7 -0
  369. data/spec/unit/module_tool/applications/installer_spec.rb +8 -0
  370. data/spec/unit/module_tool/applications/uninstaller_spec.rb +8 -0
  371. data/spec/unit/module_tool/applications/upgrader_spec.rb +6 -0
  372. data/spec/unit/network/http/connection_spec.rb +1 -1
  373. data/spec/unit/network/http/factory_spec.rb +28 -35
  374. data/spec/unit/parser/compiler_spec.rb +0 -8
  375. data/spec/unit/parser/environment_compiler_spec.rb +36 -0
  376. data/spec/unit/parser/functions/create_resources_spec.rb +9 -0
  377. data/spec/unit/parser/functions/inline_template_spec.rb +7 -0
  378. data/spec/unit/parser/functions/realize_spec.rb +9 -0
  379. data/spec/unit/parser/functions/tag_spec.rb +7 -0
  380. data/spec/unit/parser/functions/tagged_spec.rb +25 -0
  381. data/spec/unit/parser/functions/template_spec.rb +8 -0
  382. data/spec/unit/parser/scope_spec.rb +19 -0
  383. data/spec/unit/pops/evaluator/conditionals_spec.rb +1 -1
  384. data/spec/unit/pops/loaders/loader_spec.rb +516 -0
  385. data/spec/unit/pops/loaders/loaders_spec.rb +11 -0
  386. data/spec/unit/pops/loaders/module_loaders_spec.rb +43 -0
  387. data/spec/unit/pops/loaders/static_loader_spec.rb +15 -7
  388. data/spec/unit/pops/model/model_spec.rb +5 -0
  389. data/spec/unit/pops/parser/lexer2_spec.rb +15 -0
  390. data/spec/unit/pops/parser/locator_spec.rb +20 -0
  391. data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +33 -0
  392. data/spec/unit/pops/parser/parse_calls_spec.rb +28 -0
  393. data/spec/unit/pops/parser/parse_conditionals_spec.rb +12 -0
  394. data/spec/unit/pops/parser/parse_plan_spec.rb +48 -0
  395. data/spec/unit/pops/serialization/packer_spec.rb +8 -0
  396. data/spec/unit/pops/serialization/serialization_spec.rb +30 -0
  397. data/spec/unit/pops/serialization/to_from_hr_spec.rb +31 -0
  398. data/spec/unit/pops/types/error_spec.rb +207 -0
  399. data/spec/unit/pops/types/p_init_type_spec.rb +98 -0
  400. data/spec/unit/pops/types/p_object_type_spec.rb +275 -10
  401. data/spec/unit/pops/types/p_uri_type_spec.rb +191 -0
  402. data/spec/unit/pops/types/ruby_generator_spec.rb +82 -44
  403. data/spec/unit/pops/types/task_spec.rb +353 -0
  404. data/spec/unit/pops/types/type_calculator_spec.rb +76 -5
  405. data/spec/unit/pops/types/type_formatter_spec.rb +31 -13
  406. data/spec/unit/pops/types/type_parser_spec.rb +13 -1
  407. data/spec/unit/pops/types/types_spec.rb +60 -0
  408. data/spec/unit/pops/validator/validator_spec.rb +76 -0
  409. data/spec/unit/provider/group/groupadd_spec.rb +77 -1
  410. data/spec/unit/provider/group/pw_spec.rb +4 -4
  411. data/spec/unit/provider/group/windows_adsi_spec.rb +22 -79
  412. data/spec/unit/provider/mount_spec.rb +18 -5
  413. data/spec/unit/provider/nameservice_spec.rb +5 -5
  414. data/spec/unit/provider/package/dnf_spec.rb +2 -2
  415. data/spec/unit/provider/package/gem_spec.rb +1 -1
  416. data/spec/unit/provider/package/pkg_spec.rb +3 -0
  417. data/spec/unit/provider/package/yum_spec.rb +40 -0
  418. data/spec/unit/provider/service/launchd_spec.rb +2 -1
  419. data/spec/unit/provider/service/redhat_spec.rb +5 -0
  420. data/spec/unit/provider/service/systemd_spec.rb +1 -1
  421. data/spec/unit/provider/user/hpux_spec.rb +2 -2
  422. data/spec/unit/provider/user/openbsd_spec.rb +2 -2
  423. data/spec/unit/provider/user/pw_spec.rb +14 -14
  424. data/spec/unit/provider/user/user_role_add_spec.rb +19 -2
  425. data/spec/unit/provider/user/useradd_spec.rb +188 -22
  426. data/spec/unit/provider/user/windows_adsi_spec.rb +4 -4
  427. data/spec/unit/provider/zfs/zfs_spec.rb +55 -1
  428. data/spec/unit/provider_spec.rb +48 -0
  429. data/spec/unit/puppet_pal_2pec.rb +1005 -0
  430. data/spec/unit/puppet_pal_spec.rb +11 -0
  431. data/spec/unit/settings/ini_file_spec.rb +313 -2
  432. data/spec/unit/ssl/certificate_request_spec.rb +42 -1
  433. data/spec/unit/ssl/certificate_revocation_list_spec.rb +2 -1
  434. data/spec/unit/transaction/report_spec.rb +1 -0
  435. data/spec/unit/transaction_spec.rb +112 -21
  436. data/spec/unit/type/file/checksum_spec.rb +20 -0
  437. data/spec/unit/type/file_spec.rb +8 -0
  438. data/spec/unit/type/group_spec.rb +8 -0
  439. data/spec/unit/type/k5login_spec.rb +22 -1
  440. data/spec/unit/type/scheduled_task_spec.rb +15 -0
  441. data/spec/unit/type/user_spec.rb +11 -1
  442. data/spec/unit/type/yumrepo_spec.rb +5 -0
  443. data/spec/unit/util/checksums_spec.rb +3 -3
  444. data/spec/unit/util/log/destinations_spec.rb +14 -0
  445. data/spec/unit/util/network_device/cisco/device_spec.rb +1 -1
  446. data/spec/unit/util/plist_spec.rb +3 -3
  447. data/spec/unit/util/windows/adsi_spec.rb +27 -31
  448. data/spec/unit/util/windows/sid_spec.rb +15 -86
  449. data/spec/unit/util_spec.rb +17 -3
  450. data/tasks/manpages.rake +1 -1
  451. metadata +218 -180
  452. data/lib/puppet/bindings.rb +0 -148
  453. data/lib/puppet/configurer/downloader_factory.rb +0 -44
  454. data/spec/unit/configurer/downloader_factory_spec.rb +0 -129
@@ -54,7 +54,7 @@ describe provider_class do
54
54
  it "should run pw with no additional flags" do
55
55
  provider.expects(:exists?).returns true
56
56
  expect(provider.deletecmd).to eq([provider_class.command(:pw), "groupdel", "testgroup"])
57
- provider.expects(:execute).with([provider_class.command(:pw), "groupdel", "testgroup"])
57
+ provider.expects(:execute).with([provider_class.command(:pw), "groupdel", "testgroup"], has_entry(:custom_environment, {}))
58
58
  provider.delete
59
59
  end
60
60
  end
@@ -62,19 +62,19 @@ describe provider_class do
62
62
  describe "when modifying groups" do
63
63
  it "should run pw with the correct arguments" do
64
64
  expect(provider.modifycmd("gid", 12345)).to eq([provider_class.command(:pw), "groupmod", "testgroup", "-g", 12345])
65
- provider.expects(:execute).with([provider_class.command(:pw), "groupmod", "testgroup", "-g", 12345])
65
+ provider.expects(:execute).with([provider_class.command(:pw), "groupmod", "testgroup", "-g", 12345], has_entry(:custom_environment, {}))
66
66
  provider.gid = 12345
67
67
  end
68
68
 
69
69
  it "should use -M with the correct argument when the members property is changed" do
70
70
  resource[:members] = "user1"
71
- provider.expects(:execute).with(all_of(includes("-M"), includes("user2")))
71
+ provider.expects(:execute).with(all_of(includes("-M"), includes("user2")), has_entry(:custom_environment, {}))
72
72
  provider.members = "user2"
73
73
  end
74
74
 
75
75
  it "should use -M with all the given users when the members property is changed with an array" do
76
76
  resource[:members] = ["user1", "user2"]
77
- provider.expects(:execute).with(all_of(includes("-M"), includes("user3,user4")))
77
+ provider.expects(:execute).with(all_of(includes("-M"), includes("user3,user4")), has_entry(:custom_environment, {}))
78
78
  provider.members = ["user3", "user4"]
79
79
  end
80
80
  end
@@ -40,36 +40,23 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
40
40
  let(:invalid_user) { SecureRandom.uuid }
41
41
 
42
42
  before :each do
43
- Puppet::Util::Windows::SID.stubs(:name_to_principal).with('user1').returns(user1)
44
- Puppet::Util::Windows::SID.stubs(:name_to_principal).with('user2').returns(user2)
45
- Puppet::Util::Windows::SID.stubs(:name_to_principal).with('user3').returns(user3)
46
- Puppet::Util::Windows::SID.stubs(:name_to_principal).with(invalid_user).returns(nil)
43
+ Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with('user1').returns(user1)
44
+ Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with('user2').returns(user2)
45
+ Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with('user3').returns(user3)
46
+ Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with(invalid_user).returns(nil)
47
47
  end
48
48
 
49
49
  describe "#members_insync?" do
50
50
  it "should return true for same lists of members" do
51
- current = [
52
- Puppet::Util::Windows::SID.name_to_principal('user1'),
53
- Puppet::Util::Windows::SID.name_to_principal('user2'),
54
- ]
55
- expect(provider.members_insync?(current, ['user1', 'user2'])).to be_truthy
51
+ expect(provider.members_insync?(['user1', 'user2'], ['user1', 'user2'])).to be_truthy
56
52
  end
57
53
 
58
54
  it "should return true for same lists of unordered members" do
59
- current = [
60
- Puppet::Util::Windows::SID.name_to_principal('user1'),
61
- Puppet::Util::Windows::SID.name_to_principal('user2'),
62
- ]
63
- expect(provider.members_insync?(current, ['user2', 'user1'])).to be_truthy
55
+ expect(provider.members_insync?(['user1', 'user2'], ['user2', 'user1'])).to be_truthy
64
56
  end
65
57
 
66
58
  it "should return true for same lists of members irrespective of duplicates" do
67
- current = [
68
- Puppet::Util::Windows::SID.name_to_principal('user1'),
69
- Puppet::Util::Windows::SID.name_to_principal('user2'),
70
- Puppet::Util::Windows::SID.name_to_principal('user2'),
71
- ]
72
- expect(provider.members_insync?(current, ['user2', 'user1', 'user1'])).to be_truthy
59
+ expect(provider.members_insync?(['user1', 'user2', 'user2'], ['user2', 'user1', 'user1'])).to be_truthy
73
60
  end
74
61
 
75
62
  it "should return true when current and should members are empty lists" do
@@ -90,12 +77,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
90
77
  end
91
78
 
92
79
  it "should return true when current and should contain the same users in a different order" do
93
- current = [
94
- Puppet::Util::Windows::SID.name_to_principal('user1'),
95
- Puppet::Util::Windows::SID.name_to_principal('user2'),
96
- Puppet::Util::Windows::SID.name_to_principal('user3'),
97
- ]
98
- expect(provider.members_insync?(current, ['user3', 'user1', 'user2'])).to be_truthy
80
+ expect(provider.members_insync?(['user1', 'user2', 'user3'], ['user3', 'user1', 'user2'])).to be_truthy
99
81
  end
100
82
 
101
83
  it "should return false when current is nil" do
@@ -103,24 +85,15 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
103
85
  end
104
86
 
105
87
  it "should return false when should is nil" do
106
- current = [
107
- Puppet::Util::Windows::SID.name_to_principal('user1'),
108
- ]
109
- expect(provider.members_insync?(current, nil)).to be_falsey
88
+ expect(provider.members_insync?(['user1'], nil)).to be_falsey
110
89
  end
111
90
 
112
91
  it "should return false when current contains different users than should" do
113
- current = [
114
- Puppet::Util::Windows::SID.name_to_principal('user1'),
115
- ]
116
- expect(provider.members_insync?(current, ['user2'])).to be_falsey
92
+ expect(provider.members_insync?(['user1'], ['user2'])).to be_falsey
117
93
  end
118
94
 
119
95
  it "should return false when current contains members and should is empty" do
120
- current = [
121
- Puppet::Util::Windows::SID.name_to_principal('user1'),
122
- ]
123
- expect(provider.members_insync?(current, [])).to be_falsey
96
+ expect(provider.members_insync?(['user1'], [])).to be_falsey
124
97
  end
125
98
 
126
99
  it "should return false when current is empty and should contains members" do
@@ -128,19 +101,11 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
128
101
  end
129
102
 
130
103
  it "should return false when should user(s) are not the only items in the current" do
131
- current = [
132
- Puppet::Util::Windows::SID.name_to_principal('user1'),
133
- Puppet::Util::Windows::SID.name_to_principal('user2'),
134
- ]
135
- expect(provider.members_insync?(current, ['user1'])).to be_falsey
104
+ expect(provider.members_insync?(['user1', 'user2'], ['user1'])).to be_falsey
136
105
  end
137
106
 
138
107
  it "should return false when current user(s) is not empty and should is an empty list" do
139
- current = [
140
- Puppet::Util::Windows::SID.name_to_principal('user1'),
141
- Puppet::Util::Windows::SID.name_to_principal('user2'),
142
- ]
143
- expect(provider.members_insync?(current, [])).to be_falsey
108
+ expect(provider.members_insync?(['user1','user2'], [])).to be_falsey
144
109
  end
145
110
  end
146
111
 
@@ -155,24 +120,15 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
155
120
  end
156
121
 
157
122
  it "should return true when should is nil" do
158
- current = [
159
- Puppet::Util::Windows::SID.name_to_principal('user1'),
160
- ]
161
- expect(provider.members_insync?(current, nil)).to be_truthy
123
+ expect(provider.members_insync?(['user1'], nil)).to be_truthy
162
124
  end
163
125
 
164
126
  it "should return false when current contains different users than should" do
165
- current = [
166
- Puppet::Util::Windows::SID.name_to_principal('user1'),
167
- ]
168
- expect(provider.members_insync?(current, ['user2'])).to be_falsey
127
+ expect(provider.members_insync?(['user1'], ['user2'])).to be_falsey
169
128
  end
170
129
 
171
130
  it "should return true when current contains members and should is empty" do
172
- current = [
173
- Puppet::Util::Windows::SID.name_to_principal('user1'),
174
- ]
175
- expect(provider.members_insync?(current, [])).to be_truthy
131
+ expect(provider.members_insync?(['user1'], [])).to be_truthy
176
132
  end
177
133
 
178
134
  it "should return false when current is empty and should contains members" do
@@ -180,28 +136,15 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
180
136
  end
181
137
 
182
138
  it "should return true when current user(s) contains at least the should list" do
183
- current = [
184
- Puppet::Util::Windows::SID.name_to_principal('user1'),
185
- Puppet::Util::Windows::SID.name_to_principal('user2'),
186
- ]
187
- expect(provider.members_insync?(current, ['user1'])).to be_truthy
139
+ expect(provider.members_insync?(['user1','user2'], ['user1'])).to be_truthy
188
140
  end
189
141
 
190
142
  it "should return true when current user(s) is not empty and should is an empty list" do
191
- current = [
192
- Puppet::Util::Windows::SID.name_to_principal('user1'),
193
- Puppet::Util::Windows::SID.name_to_principal('user2'),
194
- ]
195
- expect(provider.members_insync?(current, [])).to be_truthy
143
+ expect(provider.members_insync?(['user1','user2'], [])).to be_truthy
196
144
  end
197
145
 
198
146
  it "should return true when current user(s) contains at least the should list, even unordered" do
199
- current = [
200
- Puppet::Util::Windows::SID.name_to_principal('user3'),
201
- Puppet::Util::Windows::SID.name_to_principal('user1'),
202
- Puppet::Util::Windows::SID.name_to_principal('user2'),
203
- ]
204
- expect(provider.members_insync?(current, ['user2','user1'])).to be_truthy
147
+ expect(provider.members_insync?(['user3','user1','user2'], ['user2','user1'])).to be_truthy
205
148
  end
206
149
  end
207
150
  end
@@ -253,8 +196,8 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
253
196
 
254
197
  provider.group.stubs(:member_sids).returns(member_sids[0..1])
255
198
 
256
- Puppet::Util::Windows::SID.expects(:name_to_principal).with('user2').returns(member_sids[1])
257
- Puppet::Util::Windows::SID.expects(:name_to_principal).with('user3').returns(member_sids[2])
199
+ Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('user2').returns(member_sids[1])
200
+ Puppet::Util::Windows::SID.expects(:name_to_sid_object).with('user3').returns(member_sids[2])
258
201
 
259
202
  provider.group.expects(:remove_member_sids).with(member_sids[0])
260
203
  provider.group.expects(:add_member_sids).with(member_sids[2])
@@ -304,7 +247,7 @@ describe Puppet::Type.type(:group).provider(:windows_adsi), :if => Puppet.featur
304
247
  end
305
248
 
306
249
  it "should be able to test whether a group exists" do
307
- Puppet::Util::Windows::SID.stubs(:name_to_principal).returns(nil)
250
+ Puppet::Util::Windows::SID.stubs(:name_to_sid_object).returns(nil)
308
251
  Puppet::Util::Windows::ADSI.stubs(:connect).returns stub('connection', :Class => 'Group')
309
252
  expect(provider).to be_exists
310
253
 
@@ -72,11 +72,24 @@ describe Puppet::Provider::Mount do
72
72
 
73
73
  describe Puppet::Provider::Mount, " when remounting" do
74
74
 
75
- it "should use '-o remount' if the resource specifies it supports remounting" do
76
- @mounter.stubs(:info)
77
- @resource.stubs(:[]).with(:remounts).returns(:true)
78
- @mounter.expects(:mountcmd).with("-o", "remount", @name)
79
- @mounter.remount
75
+ context "if the resource supports remounting" do
76
+ context "given explicit options on AIX" do
77
+ it "should combine the options with 'remount'" do
78
+ @mounter.stubs(:info)
79
+ @mounter.stubs(:options).returns('ro')
80
+ @resource.stubs(:[]).with(:remounts).returns(:true)
81
+ Facter.expects(:value).with(:operatingsystem).returns 'AIX'
82
+ @mounter.expects(:mountcmd).with("-o", "ro,remount", @name)
83
+ @mounter.remount
84
+ end
85
+ end
86
+
87
+ it "should use '-o remount'" do
88
+ @mounter.stubs(:info)
89
+ @resource.stubs(:[]).with(:remounts).returns(:true)
90
+ @mounter.expects(:mountcmd).with("-o", "remount", @name)
91
+ @mounter.remount
92
+ end
80
93
  end
81
94
 
82
95
  it "should mount with '-o update' on OpenBSD" do
@@ -393,20 +393,20 @@ describe Puppet::Provider::NameService do
393
393
 
394
394
  it "should execute the modify command on valid values" do
395
395
  provider.expects(:modifycmd).with(:foo, 100).returns ['/bin/modify', '-f', '100' ]
396
- provider.expects(:execute).with ['/bin/modify', '-f', '100']
396
+ provider.expects(:execute).with(['/bin/modify', '-f', '100'], has_entry(:custom_environment, {}))
397
397
  provider.set(:foo, 100)
398
398
  end
399
399
 
400
400
  it "should munge the value first" do
401
401
  described_class.options(:foo, :munge => proc { |x| x*2}, :unmunge => proc {|x| x/2})
402
- provider.expects(:modifycmd).with(:foo, 200).returns ['/bin/modify', '-f', '200' ]
403
- provider.expects(:execute).with ['/bin/modify', '-f', '200']
402
+ provider.expects(:modifycmd).with(:foo, 200).returns(['/bin/modify', '-f', '200' ])
403
+ provider.expects(:execute).with(['/bin/modify', '-f', '200'], has_entry(:custom_environment, {}))
404
404
  provider.set(:foo, 100)
405
405
  end
406
406
 
407
407
  it "should fail if the modify command fails" do
408
- provider.expects(:modifycmd).with(:foo, 100).returns ['/bin/modify', '-f', '100' ]
409
- provider.expects(:execute).with(['/bin/modify', '-f', '100']).raises(Puppet::ExecutionFailure, "Execution of '/bin/modify' returned 1: some_failure")
408
+ provider.expects(:modifycmd).with(:foo, 100).returns(['/bin/modify', '-f', '100' ])
409
+ provider.expects(:execute).with(['/bin/modify', '-f', '100'], kind_of(Hash)).raises(Puppet::ExecutionFailure, "Execution of '/bin/modify' returned 1: some_failure")
410
410
  expect { provider.set(:foo, 100) }.to raise_error Puppet::Error, /Could not set foo/
411
411
  end
412
412
  end
@@ -6,7 +6,7 @@ require 'spec_helper'
6
6
  provider_class = Puppet::Type.type(:package).provider(:dnf)
7
7
 
8
8
  context 'default' do
9
- [ 19, 20, 21 ].each do |ver|
9
+ (19..21).each do |ver|
10
10
  it "should not be the default provider on fedora#{ver}" do
11
11
  Facter.stubs(:value).with(:osfamily).returns(:redhat)
12
12
  Facter.stubs(:value).with(:operatingsystem).returns(:fedora)
@@ -15,7 +15,7 @@ context 'default' do
15
15
  end
16
16
  end
17
17
 
18
- [ 22, 23, 24 ].each do |ver|
18
+ (22..26).each do |ver|
19
19
  it "should be the default provider on fedora#{ver}" do
20
20
  Facter.stubs(:value).with(:osfamily).returns(:redhat)
21
21
  Facter.stubs(:value).with(:operatingsystem).returns(:fedora)
@@ -196,7 +196,7 @@ context 'installing myresource' do
196
196
  describe "listing gems" do
197
197
  describe "searching for a single package" do
198
198
  it "searches for an exact match" do
199
- provider_class.expects(:execute).with(includes('^bundler$'), {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}}).returns(File.read(my_fixture('gem-list-single-package')))
199
+ provider_class.expects(:execute).with(includes('\Abundler\z'), {:failonfail => true, :combine => true, :custom_environment => {"HOME"=>ENV["HOME"]}}).returns(File.read(my_fixture('gem-list-single-package')))
200
200
  expected = {:name => 'bundler', :ensure => %w[1.6.2], :provider => :gem}
201
201
  expect(provider_class.gemlist({:justme => 'bundler'})).to eq(expected)
202
202
  end
@@ -101,6 +101,9 @@ describe Puppet::Type.type(:package).provider(:pkg) do
101
101
  end
102
102
 
103
103
  context ":latest" do
104
+ before do
105
+ described_class.expects(:pkg).with(:refresh)
106
+ end
104
107
  it "should work correctly for ensure latest on solaris 11 (UFOXI) when there are no further packages to install" do
105
108
  described_class.expects(:pkg).with(:list,'-Hvn','dummy').returns File.read(my_fixture('dummy_solaris11.installed'))
106
109
  expect(provider.latest).to eq('1.0.6,5.11-0.175.0.0.0.2.537:20131230T130000Z')
@@ -7,6 +7,46 @@ describe provider_class do
7
7
  include PuppetSpec::Fixtures
8
8
  it_behaves_like 'RHEL package provider', provider_class, 'yum'
9
9
 
10
+ describe "when supplied the source param" do
11
+ let(:name) { 'baz' }
12
+
13
+ let(:resource) do
14
+ Puppet::Type.type(:package).new(
15
+ :name => name,
16
+ :provider => 'yum',
17
+ )
18
+ end
19
+
20
+ let(:provider) do
21
+ provider = provider_class.new
22
+ provider.resource = resource
23
+ provider
24
+ end
25
+
26
+ before { provider_class.stubs(:command).with(:cmd).returns("/usr/bin/yum") }
27
+
28
+ context "when installing" do
29
+ it "should use the supplied source as the explicit path to a package to install" do
30
+ resource[:ensure] = :present
31
+ resource[:source] = "/foo/bar/baz-1.1.0.rpm"
32
+ provider.expects(:execute).with(["/usr/bin/yum", "-d", "0", "-e", "0", "-y", :install, "/foo/bar/baz-1.1.0.rpm"])
33
+ provider.install
34
+ end
35
+ end
36
+
37
+ context "when ensuring a specific version" do
38
+ it "should use the suppplied source as the explicit path to the package to update" do
39
+ # The first query response informs yum provider that package 1.1.0 is
40
+ # already installed, and the second that it's been upgraded
41
+ provider.expects(:query).twice.returns({:ensure => "1.1.0"}, {:ensure => "1.2.0"})
42
+ resource[:ensure] = "1.2.0"
43
+ resource[:source] = "http://foo.repo.com/baz-1.2.0.rpm"
44
+ provider.expects(:execute).with(["/usr/bin/yum", "-d", "0", "-e", "0", "-y", 'update', "http://foo.repo.com/baz-1.2.0.rpm"])
45
+ provider.install
46
+ end
47
+ end
48
+ end
49
+
10
50
  describe "parsing the output of check-update" do
11
51
  describe "with no multiline entries" do
12
52
  let(:check_update) { File.read(my_fixture("yum-check-update-simple.txt")) }
@@ -292,7 +292,8 @@ describe Puppet::Type.type(:service).provider(:launchd) do
292
292
  provider.expects(:launchd_paths).returns(['/Library/LaunchAgents'])
293
293
  provider.expects(:return_globbed_list_of_file_paths).with('/Library/LaunchAgents').returns([busted_plist_path])
294
294
  plistlib.expects(:read_plist_file).with(busted_plist_path).returns(plist_without_label)
295
- Puppet.expects(:warning).with("The #{busted_plist_path} plist does not contain a 'label' key; Puppet is skipping it")
295
+ Puppet.expects(:debug).with("Reading launchd plist #{busted_plist_path}")
296
+ Puppet.expects(:debug).with("The #{busted_plist_path} plist does not contain a 'label' key; Puppet is skipping it")
296
297
  provider.make_label_to_path_map
297
298
  end
298
299
  end
@@ -88,6 +88,11 @@ describe provider_class, :if => Puppet.features.posix? do
88
88
  expect(@provider.enabled?).to eq(:true)
89
89
  end
90
90
 
91
+ it "should check for B" do
92
+ provider_class.stubs(:chkconfig).with(@resource[:name]).returns "#{@resource[:name]} B"
93
+ expect(@provider.enabled?).to eq(:true)
94
+ end
95
+
91
96
  it "should check for off" do
92
97
  provider_class.stubs(:chkconfig).with(@resource[:name]).returns "#{@resource[:name]} off"
93
98
  expect(@provider.enabled?).to eq(:false)
@@ -126,7 +126,7 @@ describe Puppet::Type.type(:service).provider(:systemd) do
126
126
  expect(described_class).not_to be_default
127
127
  end
128
128
 
129
- [ '15.04', '15.10', '16.04', '16.10', '17.04', '17.10', '18.04' ].each do |ver|
129
+ [ '15.04', '15.10', '16.04', '16.10' ].each do |ver|
130
130
  it "should be the default provider on ubuntu#{ver}" do
131
131
  Facter.stubs(:value).with(:osfamily).returns(:debian)
132
132
  Facter.stubs(:value).with(:operatingsystem).returns(:ubuntu)
@@ -59,14 +59,14 @@ describe provider_class, :unless => Puppet.features.microsoft_windows? do
59
59
  it "should add modprpw to modifycmd if Trusted System" do
60
60
  resource.stubs(:allowdupe?).returns true
61
61
  provider.expects(:exec_getprpw).with('root','-m uid').returns('uid=0')
62
- provider.expects(:execute).with(['/usr/sam/lbin/usermod.sam', '-u', 1000, '-o', 'testuser', '-F', ';', '/usr/lbin/modprpw', '-v', '-l', 'testuser'])
62
+ provider.expects(:execute).with(['/usr/sam/lbin/usermod.sam', '-u', 1000, '-o', 'testuser', '-F', ';', '/usr/lbin/modprpw', '-v', '-l', 'testuser'], has_entry(:custom_environment, {}))
63
63
  provider.uid = 1000
64
64
  end
65
65
 
66
66
  it "should not add modprpw if not Trusted System" do
67
67
  resource.stubs(:allowdupe?).returns true
68
68
  provider.expects(:exec_getprpw).with('root','-m uid').returns('System is not trusted')
69
- provider.expects(:execute).with(['/usr/sam/lbin/usermod.sam', '-u', 1000, '-o', 'testuser', '-F'])
69
+ provider.expects(:execute).with(['/usr/sam/lbin/usermod.sam', '-u', 1000, '-o', 'testuser', '-F'], has_entry(:custom_environment, {}))
70
70
  provider.uid = 1000
71
71
  end
72
72
  end
@@ -33,13 +33,13 @@ describe Puppet::Type.type(:user).provider(:openbsd) do
33
33
  describe "#expiry=" do
34
34
  it "should pass expiry to usermod as MM/DD/YY" do
35
35
  resource[:expiry] = '2014-11-05'
36
- provider.expects(:execute).with(['/usr/sbin/usermod', '-e', 'November 05 2014', 'myuser'])
36
+ provider.expects(:execute).with(['/usr/sbin/usermod', '-e', 'November 05 2014', 'myuser'], has_entry(:custom_environment, {}))
37
37
  provider.expiry = '2014-11-05'
38
38
  end
39
39
 
40
40
  it "should use -e with an empty string when the expiry property is removed" do
41
41
  resource[:expiry] = :absent
42
- provider.expects(:execute).with(['/usr/sbin/usermod', '-e', '', 'myuser'])
42
+ provider.expects(:execute).with(['/usr/sbin/usermod', '-e', '', 'myuser'], has_entry(:custom_environment, {}))
43
43
  provider.expiry = :absent
44
44
  end
45
45
  end
@@ -109,7 +109,7 @@ describe provider_class do
109
109
  provider = resource.provider
110
110
  provider.expects(:exists?).returns true
111
111
  expect(provider.deletecmd).to eq([provider_class.command(:pw), "userdel", "testuser"])
112
- provider.expects(:execute).with([provider_class.command(:pw), "userdel", "testuser"])
112
+ provider.expects(:execute).with([provider_class.command(:pw), "userdel", "testuser"], has_entry(:custom_environment, {}))
113
113
  provider.delete
114
114
  end
115
115
 
@@ -120,7 +120,7 @@ describe provider_class do
120
120
  provider = resource.provider
121
121
  provider.expects(:exists?).returns true
122
122
  resource[:managehome] = false
123
- provider.expects(:execute).with(Not(includes("-r")))
123
+ provider.expects(:execute).with(Not(includes("-r")), has_entry(:custom_environment, {}))
124
124
  provider.delete
125
125
  end
126
126
 
@@ -128,7 +128,7 @@ describe provider_class do
128
128
  provider = resource.provider
129
129
  provider.expects(:exists?).returns true
130
130
  resource[:managehome] = true
131
- provider.expects(:execute).with(includes("-r"))
131
+ provider.expects(:execute).with(includes("-r"), has_entry(:custom_environment, {}))
132
132
  provider.delete
133
133
  end
134
134
  end
@@ -140,56 +140,56 @@ describe provider_class do
140
140
 
141
141
  it "should run pw with the correct arguments" do
142
142
  expect(provider.modifycmd("uid", 12345)).to eq([provider_class.command(:pw), "usermod", "testuser", "-u", 12345])
143
- provider.expects(:execute).with([provider_class.command(:pw), "usermod", "testuser", "-u", 12345])
143
+ provider.expects(:execute).with([provider_class.command(:pw), "usermod", "testuser", "-u", 12345], has_entry(:custom_environment, {}))
144
144
  provider.uid = 12345
145
145
  end
146
146
 
147
147
  it "should use -c with the correct argument when the comment property is changed" do
148
148
  resource[:comment] = "Testuser Name"
149
- provider.expects(:execute).with(all_of(includes("-c"), includes("Testuser New Name")))
149
+ provider.expects(:execute).with(all_of(includes("-c"), includes("Testuser New Name")), has_entry(:custom_environment, {}))
150
150
  provider.comment = "Testuser New Name"
151
151
  end
152
152
 
153
153
  it "should use -e with the correct argument when the expiry property is changed" do
154
154
  resource[:expiry] = "2010-02-19"
155
- provider.expects(:execute).with(all_of(includes("-e"), includes("19-02-2011")))
155
+ provider.expects(:execute).with(all_of(includes("-e"), includes("19-02-2011")), has_entry(:custom_environment, {}))
156
156
  provider.expiry = "2011-02-19"
157
157
  end
158
158
 
159
159
  it "should use -e with the correct argument when the expiry property is removed" do
160
160
  resource[:expiry] = :absent
161
- provider.expects(:execute).with(all_of(includes("-e"), includes("00-00-0000")))
161
+ provider.expects(:execute).with(all_of(includes("-e"), includes("00-00-0000")), has_entry(:custom_environment, {}))
162
162
  provider.expiry = :absent
163
163
  end
164
164
 
165
165
  it "should use -g with the correct argument when the gid property is changed" do
166
166
  resource[:gid] = 12345
167
- provider.expects(:execute).with(all_of(includes("-g"), includes(54321)))
167
+ provider.expects(:execute).with(all_of(includes("-g"), includes(54321)), has_entry(:custom_environment, {}))
168
168
  provider.gid = 54321
169
169
  end
170
170
 
171
171
  it "should use -G with the correct argument when the groups property is changed" do
172
172
  resource[:groups] = "group1"
173
- provider.expects(:execute).with(all_of(includes("-G"), includes("group2")))
173
+ provider.expects(:execute).with(all_of(includes("-G"), includes("group2")), has_entry(:custom_environment, {}))
174
174
  provider.groups = "group2"
175
175
  end
176
176
 
177
177
  it "should use -G with all the given groups when the groups property is changed with an array" do
178
178
  resource[:groups] = ["group1", "group2"]
179
- provider.expects(:execute).with(all_of(includes("-G"), includes("group3,group4")))
179
+ provider.expects(:execute).with(all_of(includes("-G"), includes("group3,group4")), has_entry(:custom_environment, {}))
180
180
  provider.groups = "group3,group4"
181
181
  end
182
182
 
183
183
  it "should use -d with the correct argument when the home property is changed" do
184
184
  resource[:home] = "/home/testuser"
185
- provider.expects(:execute).with(all_of(includes("-d"), includes("/newhome/testuser")))
185
+ provider.expects(:execute).with(all_of(includes("-d"), includes("/newhome/testuser")), has_entry(:custom_environment, {}))
186
186
  provider.home = "/newhome/testuser"
187
187
  end
188
188
 
189
189
  it "should use -m and -d with the correct argument when the home property is changed and managehome is enabled" do
190
190
  resource[:home] = "/home/testuser"
191
191
  resource[:managehome] = true
192
- provider.expects(:execute).with(all_of(includes("-d"), includes("/newhome/testuser"), includes("-m")))
192
+ provider.expects(:execute).with(all_of(includes("-d"), includes("/newhome/testuser"), includes("-m")), has_entry(:custom_environment, {}))
193
193
  provider.home = "/newhome/testuser"
194
194
  end
195
195
 
@@ -201,13 +201,13 @@ describe provider_class do
201
201
 
202
202
  it "should use -s with the correct argument when the shell property is changed" do
203
203
  resource[:shell] = "/bin/sh"
204
- provider.expects(:execute).with(all_of(includes("-s"), includes("/bin/tcsh")))
204
+ provider.expects(:execute).with(all_of(includes("-s"), includes("/bin/tcsh")), has_entry(:custom_environment, {}))
205
205
  provider.shell = "/bin/tcsh"
206
206
  end
207
207
 
208
208
  it "should use -u with the correct argument when the uid property is changed" do
209
209
  resource[:uid] = 12345
210
- provider.expects(:execute).with(all_of(includes("-u"), includes(54321)))
210
+ provider.expects(:execute).with(all_of(includes("-u"), includes(54321)), has_entry(:custom_environment, {}))
211
211
  provider.uid = 54321
212
212
  end
213
213
  end