puppet 5.3.7-x64-mingw32 → 5.4.0-x64-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 (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 +220 -182
  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
@@ -70,11 +70,11 @@ describe Puppet::Type.type(:user).provider(:user_role_add), :unless => Puppet.fe
70
70
  end
71
71
 
72
72
  it "should set password age rules" do
73
- resource = Puppet::Type.type(:user).new :name => "myuser", :password_min_age => 5, :password_max_age => 10, :provider => :user_role_add
73
+ resource = Puppet::Type.type(:user).new :name => "myuser", :password_min_age => 5, :password_max_age => 10, :password_warn_days => 15, :provider => :user_role_add
74
74
  provider = described_class.new(resource)
75
75
  provider.stubs(:user_attributes)
76
76
  provider.stubs(:execute)
77
- provider.expects(:execute).with { |cmd, *args| args == ["-n", 5, "-x", 10, "myuser"] }
77
+ provider.expects(:execute).with { |cmd, *args| args == ["-n", 5, "-x", 10, '-w', 15, "myuser"] }
78
78
  provider.create
79
79
  end
80
80
  end
@@ -354,4 +354,21 @@ EOT
354
354
  expect(provider.password_min_age).to eq(-1)
355
355
  end
356
356
  end
357
+
358
+ describe "#password_warn_days" do
359
+ it "should return a warn days number" do
360
+ File.stubs(:readlines).returns(["fakeval:NP:12345:10:50:30:::\n"])
361
+ expect(provider.password_warn_days).to eq("30")
362
+ end
363
+
364
+ it "should return -1 for no warn days" do
365
+ File.stubs(:readlines).returns(["fakeval:NP:12345::::::\n"])
366
+ expect(provider.password_warn_days).to eq(-1)
367
+ end
368
+
369
+ it "should return -1 for no warn days when failed attempts are present" do
370
+ File.stubs(:readlines).returns(["fakeval:NP:12345::::::3\n"])
371
+ expect(provider.password_warn_days).to eq(-1)
372
+ end
373
+ end
357
374
  end
@@ -5,10 +5,13 @@ describe Puppet::Type.type(:user).provider(:useradd) do
5
5
 
6
6
  before :each do
7
7
  described_class.stubs(:command).with(:password).returns '/usr/bin/chage'
8
+ described_class.stubs(:command).with(:localpassword).returns '/usr/sbin/lchage'
8
9
  described_class.stubs(:command).with(:add).returns '/usr/sbin/useradd'
9
10
  described_class.stubs(:command).with(:localadd).returns '/usr/sbin/luseradd'
10
11
  described_class.stubs(:command).with(:modify).returns '/usr/sbin/usermod'
12
+ described_class.stubs(:command).with(:localmodify).returns '/usr/sbin/lusermod'
11
13
  described_class.stubs(:command).with(:delete).returns '/usr/sbin/userdel'
14
+ described_class.stubs(:command).with(:localdelete).returns '/usr/sbin/luserdel'
12
15
  end
13
16
 
14
17
  let(:resource) do
@@ -94,8 +97,9 @@ describe Puppet::Type.type(:user).provider(:useradd) do
94
97
  described_class.has_feature :manages_password_age
95
98
  resource[:password_min_age] = 5
96
99
  resource[:password_max_age] = 10
100
+ resource[:password_warn_days] = 15
97
101
  provider.expects(:execute).with(includes('/usr/sbin/useradd'), kind_of(Hash))
98
- provider.expects(:execute).with(['/usr/bin/chage', '-m', 5, '-M', 10, 'myuser'])
102
+ provider.expects(:execute).with(['/usr/bin/chage', '-m', 5, '-M', 10, '-W', 15, 'myuser'], has_entry(:custom_environment, {}))
99
103
  provider.create
100
104
  end
101
105
 
@@ -121,10 +125,10 @@ describe Puppet::Type.type(:user).provider(:useradd) do
121
125
  expect { provider.create }.to raise_error(Puppet::Error, "UID 505 already exists, use allowdupe to force user creation")
122
126
  end
123
127
 
124
- it "should not use -G for luseradd and should call usermod with -G after luseradd when groups property is set" do
128
+ it "should not use -G for luseradd and should call lusermod with -G after luseradd when groups property is set" do
125
129
  resource[:groups] = ['group1', 'group2']
126
130
  provider.expects(:execute).with(Not(includes("-G")), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
127
- provider.expects(:execute).with(includes('/usr/sbin/usermod'))
131
+ provider.expects(:execute).with(includes('/usr/sbin/lusermod'), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
128
132
  provider.create
129
133
  end
130
134
 
@@ -134,18 +138,21 @@ describe Puppet::Type.type(:user).provider(:useradd) do
134
138
  provider.create
135
139
  end
136
140
 
137
- it "should not use -e with luseradd, should call usermod with -e after luseradd when expiry is set" do
141
+ it "should not use -e with luseradd, should call lusermod with -e after luseradd when expiry is set" do
138
142
  resource[:expiry] = '2038-01-24'
139
143
  provider.expects(:execute).with(all_of(includes('/usr/sbin/luseradd'), Not(includes('-e'))), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
140
- provider.expects(:execute).with(all_of(includes('/usr/sbin/usermod'), includes('-e')))
144
+ provider.expects(:execute).with(all_of(includes('/usr/sbin/lusermod'), includes('-e')), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
141
145
  provider.create
142
146
  end
143
147
 
144
- it "should use userdel to delete users" do
145
- resource[:ensure] = :absent
146
- provider.stubs(:exists?).returns(true)
147
- provider.expects(:execute).with(includes('/usr/sbin/userdel'))
148
- provider.delete
148
+ it 'should set password age rules locally' do
149
+ described_class.has_feature :manages_password_age
150
+ resource[:password_min_age] = 5
151
+ resource[:password_max_age] = 10
152
+ resource[:password_warn_days] = 15
153
+ provider.expects(:execute).with(includes('/usr/sbin/luseradd'), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
154
+ provider.expects(:execute).with(['/usr/sbin/lchage', '-m', 5, '-M', 10, '-W', 15, 'myuser'], has_entry(:custom_environment, has_key('LIBUSER_CONF')))
155
+ provider.create
149
156
  end
150
157
  end
151
158
 
@@ -160,10 +167,84 @@ describe Puppet::Type.type(:user).provider(:useradd) do
160
167
 
161
168
  end
162
169
 
170
+ describe '#modify' do
171
+ describe "on systems with the libuser and forcelocal=false" do
172
+ before do
173
+ described_class.has_feature :libuser
174
+ resource[:forcelocal] = false
175
+ end
176
+
177
+ it "should use usermod" do
178
+ provider.expects(:execute).with(['/usr/sbin/usermod', '-u', 150, 'myuser'], has_entry(:custom_environment, {}))
179
+ provider.uid = 150
180
+ end
181
+
182
+ it "should use -o when allowdupe=true" do
183
+ resource[:allowdupe] = :true
184
+ provider.expects(:execute).with(includes('-o'), has_entry(:custom_environment, {}))
185
+ provider.uid = 505
186
+ end
187
+
188
+ it 'should use chage for password_min_age' do
189
+ provider.expects(:execute).with(['/usr/bin/chage', '-m', 100, 'myuser'], has_entry(:custom_environment, {}))
190
+ provider.password_min_age = 100
191
+ end
192
+
193
+ it 'should use chage for password_max_age' do
194
+ provider.expects(:execute).with(['/usr/bin/chage', '-M', 101, 'myuser'], has_entry(:custom_environment, {}))
195
+ provider.password_max_age = 101
196
+ end
197
+
198
+ it 'should use chage for password_warn_days' do
199
+ provider.expects(:execute).with(['/usr/bin/chage', '-W', 99, 'myuser'], has_entry(:custom_environment, {}))
200
+ provider.password_warn_days = 99
201
+ end
202
+ end
203
+
204
+ describe "on systems with the libuser and forcelocal=true" do
205
+ before do
206
+ described_class.has_feature :libuser
207
+ resource[:forcelocal] = true
208
+ end
209
+
210
+ it "should use lusermod and not usermod" do
211
+ provider.expects(:execute).with(['/usr/sbin/lusermod', '-u', 150, 'myuser'], has_entry(:custom_environment, has_key('LIBUSER_CONF')))
212
+ provider.uid = 150
213
+ end
214
+
215
+ it "should NOT use -o when allowdupe=true" do
216
+ resource[:allowdupe] = :true
217
+ provider.expects(:execute).with(Not(includes('-o')), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
218
+ provider.uid = 505
219
+ end
220
+
221
+ it "should raise an exception for duplicate UIDs" do
222
+ resource[:uid] = 505
223
+ provider.stubs(:finduser).returns(true)
224
+ expect { provider.uid = 505 }.to raise_error(Puppet::Error, "UID 505 already exists, use allowdupe to force user creation")
225
+ end
226
+
227
+ it 'should use lchage for password_warn_days' do
228
+ provider.expects(:execute).with(['/usr/sbin/lchage', '-W', 99, 'myuser'], has_entry(:custom_environment, has_key('LIBUSER_CONF')))
229
+ provider.password_warn_days = 99
230
+ end
231
+
232
+ it 'should use lchage for password_min_age' do
233
+ provider.expects(:execute).with(['/usr/sbin/lchage', '-m', 100, 'myuser'], has_entry(:custom_environment, has_key('LIBUSER_CONF')))
234
+ provider.password_min_age = 100
235
+ end
236
+
237
+ it 'should use lchage for password_max_age' do
238
+ provider.expects(:execute).with(['/usr/sbin/lchage', '-M', 101, 'myuser'], has_entry(:custom_environment, has_key('LIBUSER_CONF')))
239
+ provider.password_max_age = 101
240
+ end
241
+ end
242
+ end
243
+
163
244
  describe "#uid=" do
164
245
  it "should add -o when allowdupe is enabled and the uid is being modified" do
165
246
  resource[:allowdupe] = :true
166
- provider.expects(:execute).with(['/usr/sbin/usermod', '-u', 150, '-o', 'myuser'])
247
+ provider.expects(:execute).with(['/usr/sbin/usermod', '-u', 150, '-o', 'myuser'], has_entry(:custom_environment, {}))
167
248
  provider.uid = 150
168
249
  end
169
250
  end
@@ -172,20 +253,20 @@ describe Puppet::Type.type(:user).provider(:useradd) do
172
253
  it "should pass expiry to usermod as MM/DD/YY when on Solaris" do
173
254
  Facter.expects(:value).with(:operatingsystem).returns 'Solaris'
174
255
  resource[:expiry] = '2012-10-31'
175
- provider.expects(:execute).with(['/usr/sbin/usermod', '-e', '10/31/2012', 'myuser'])
256
+ provider.expects(:execute).with(['/usr/sbin/usermod', '-e', '10/31/2012', 'myuser'], has_entry(:custom_environment, {}))
176
257
  provider.expiry = '2012-10-31'
177
258
  end
178
259
 
179
260
  it "should pass expiry to usermod as YYYY-MM-DD when not on Solaris" do
180
261
  Facter.expects(:value).with(:operatingsystem).returns 'not_solaris'
181
262
  resource[:expiry] = '2012-10-31'
182
- provider.expects(:execute).with(['/usr/sbin/usermod', '-e', '2012-10-31', 'myuser'])
263
+ provider.expects(:execute).with(['/usr/sbin/usermod', '-e', '2012-10-31', 'myuser'], has_entry(:custom_environment, {}))
183
264
  provider.expiry = '2012-10-31'
184
265
  end
185
266
 
186
267
  it "should use -e with an empty string when the expiry property is removed" do
187
268
  resource[:expiry] = :absent
188
- provider.expects(:execute).with(['/usr/sbin/usermod', '-e', '', 'myuser'])
269
+ provider.expects(:execute).with(['/usr/sbin/usermod', '-e', '', 'myuser'], has_entry(:custom_environment, {}))
189
270
  provider.expiry = :absent
190
271
  end
191
272
  end
@@ -232,7 +313,7 @@ describe Puppet::Type.type(:user).provider(:useradd) do
232
313
  describe "#check_manage_home" do
233
314
  it "should return an array with -m flag if home is managed" do
234
315
  resource[:managehome] = :true
235
- provider.expects(:execute).with(includes('-m'), kind_of(Hash))
316
+ provider.expects(:execute).with(includes('-m'), has_entry(:custom_environment, {}))
236
317
  provider.create
237
318
  end
238
319
 
@@ -240,7 +321,7 @@ describe Puppet::Type.type(:user).provider(:useradd) do
240
321
  resource[:managehome] = :true
241
322
  resource[:ensure] = :absent
242
323
  provider.stubs(:exists?).returns(true)
243
- provider.expects(:execute).with(includes('-r'))
324
+ provider.expects(:execute).with(includes('-r'), has_entry(:custom_environment, {}))
244
325
  provider.delete
245
326
  end
246
327
 
@@ -337,12 +418,46 @@ describe Puppet::Type.type(:user).provider(:useradd) do
337
418
 
338
419
  expect(provider.addcmd).to eq(['/usr/sbin/useradd', '-e', '', '-G', 'somegroup', '-o', '-m', '-r', 'myuser'])
339
420
  end
421
+
422
+ it "should use lgroupadd with forcelocal=true" do
423
+ resource[:forcelocal] = :true
424
+ expect(provider.addcmd[0]).to eq('/usr/sbin/luseradd')
425
+ end
426
+
427
+ it "should not pass -o with forcelocal=true and allowdupe=true" do
428
+ resource[:forcelocal] = :true
429
+ resource[:allowdupe] = :true
430
+ expect(provider.addcmd).not_to include("-o")
431
+ end
432
+
433
+ context 'when forcelocal=true' do
434
+ before do
435
+ resource[:forcelocal] = :true
436
+ end
437
+
438
+ it 'does not pass lchage options to luseradd for password_max_age' do
439
+ resource[:password_max_age] = 100
440
+ expect(provider.addcmd).not_to include('-M')
441
+ end
442
+
443
+ it 'does not pass lchage options to luseradd for password_min_age' do
444
+ resource[:managehome] = false # This needs to be set so that we don't pass in -m to create the home
445
+ resource[:password_min_age] = 100
446
+ expect(provider.addcmd).not_to include('-m')
447
+ end
448
+
449
+ it 'does not pass lchage options to luseradd for password_warn_days' do
450
+ resource[:password_warn_days] = 100
451
+ expect(provider.addcmd).not_to include('-W')
452
+ end
453
+ end
340
454
  end
341
455
 
342
456
  {
343
- :password_min_age => 10,
344
- :password_max_age => 20,
345
- :password => '$6$FvW8Ib8h$qQMI/CR9m.QzIicZKutLpBgCBBdrch1IX0rTnxuI32K1pD9.RXZrmeKQlaC.RzODNuoUtPPIyQDufunvLOQWF0'
457
+ :password_min_age => 10,
458
+ :password_max_age => 20,
459
+ :password_warn_days => 30,
460
+ :password => '$6$FvW8Ib8h$qQMI/CR9m.QzIicZKutLpBgCBBdrch1IX0rTnxuI32K1pD9.RXZrmeKQlaC.RzODNuoUtPPIyQDufunvLOQWF0'
346
461
  }.each_pair do |property, expected_value|
347
462
  describe "##{property}" do
348
463
  before :each do
@@ -429,18 +544,43 @@ describe Puppet::Type.type(:user).provider(:useradd) do
429
544
 
430
545
  it "should return a chage command array with -m <value> and the user name if password_min_age is set" do
431
546
  resource[:password_min_age] = 123
432
- expect(provider.passcmd).to eq(['/usr/bin/chage','-m',123,'myuser'])
547
+ expect(provider.passcmd).to eq(['/usr/bin/chage', '-m', 123, 'myuser'])
433
548
  end
434
549
 
435
550
  it "should return a chage command array with -M <value> if password_max_age is set" do
436
551
  resource[:password_max_age] = 999
437
- expect(provider.passcmd).to eq(['/usr/bin/chage','-M',999,'myuser'])
552
+ expect(provider.passcmd).to eq(['/usr/bin/chage', '-M', 999, 'myuser'])
553
+ end
554
+
555
+ it "should return a chage command array with -W <value> if password_warn_days is set" do
556
+ resource[:password_warn_days] = 999
557
+ expect(provider.passcmd).to eq(['/usr/bin/chage', '-W', 999, 'myuser'])
438
558
  end
439
559
 
440
560
  it "should return a chage command array with -M <value> -m <value> if both password_min_age and password_max_age are set" do
441
561
  resource[:password_min_age] = 123
442
562
  resource[:password_max_age] = 999
443
- expect(provider.passcmd).to eq(['/usr/bin/chage','-m',123,'-M',999,'myuser'])
563
+ expect(provider.passcmd).to eq(['/usr/bin/chage', '-m', 123, '-M', 999, 'myuser'])
564
+ end
565
+
566
+ it "should return a chage command array with -M <value> -m <value> -W <value> if password_min_age, password_max_age and password_warn_days are set" do
567
+ resource[:password_min_age] = 123
568
+ resource[:password_max_age] = 999
569
+ resource[:password_warn_days] = 555
570
+ expect(provider.passcmd).to eq(['/usr/bin/chage', '-m', 123, '-M', 999, '-W', 555, 'myuser'])
571
+ end
572
+
573
+ context 'with forcelocal=true' do
574
+ before do
575
+ resource[:forcelocal] = true
576
+ end
577
+
578
+ it 'should return a lchage command array with -M <value> -m <value> -W <value> if password_min_age, password_max_age and password_warn_days are set' do
579
+ resource[:password_min_age] = 123
580
+ resource[:password_max_age] = 999
581
+ resource[:password_warn_days] = 555
582
+ expect(provider.passcmd).to eq(['/usr/sbin/lchage', '-m', 123, '-M', 999, '-W', 555, 'myuser'])
583
+ end
444
584
  end
445
585
  end
446
586
 
@@ -457,4 +597,30 @@ describe Puppet::Type.type(:user).provider(:useradd) do
457
597
  end
458
598
  end
459
599
 
600
+ describe "#delete" do
601
+ before do
602
+ provider.stubs(:exists?).returns(true)
603
+ resource[:ensure] = :absent
604
+ end
605
+ describe "on systems with the libuser and forcelocal=false" do
606
+ before do
607
+ described_class.has_feature :libuser
608
+ resource[:forcelocal] = false
609
+ end
610
+ it "should use userdel to delete users" do
611
+ provider.expects(:execute).with(includes('/usr/sbin/userdel'), has_entry(:custom_environment, {}))
612
+ provider.delete
613
+ end
614
+ end
615
+ describe "on systems with the libuser and forcelocal=true" do
616
+ before do
617
+ described_class.has_feature :libuser
618
+ resource[:forcelocal] = true
619
+ end
620
+ it "should use luserdel to delete users" do
621
+ provider.expects(:execute).with(includes('/usr/sbin/luserdel'), has_entry(:custom_environment, has_key('LIBUSER_CONF')))
622
+ provider.delete
623
+ end
624
+ end
625
+ end
460
626
  end
@@ -81,9 +81,9 @@ describe Puppet::Type.type(:user).provider(:windows_adsi), :if => Puppet.feature
81
81
  let(:group3) { stub(:account => 'group3', :domain => '.', :sid => 'group3sid') }
82
82
 
83
83
  before :each do
84
- Puppet::Util::Windows::SID.stubs(:name_to_principal).with('group1').returns(group1)
85
- Puppet::Util::Windows::SID.stubs(:name_to_principal).with('group2').returns(group2)
86
- Puppet::Util::Windows::SID.stubs(:name_to_principal).with('group3').returns(group3)
84
+ Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with('group1').returns(group1)
85
+ Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with('group2').returns(group2)
86
+ Puppet::Util::Windows::SID.stubs(:name_to_sid_object).with('group3').returns(group3)
87
87
  end
88
88
 
89
89
  it "should return true for same lists of members" do
@@ -267,7 +267,7 @@ describe Puppet::Type.type(:user).provider(:windows_adsi), :if => Puppet.feature
267
267
  end
268
268
 
269
269
  it 'should be able to test whether a user exists' do
270
- Puppet::Util::Windows::SID.stubs(:name_to_principal).returns(nil)
270
+ Puppet::Util::Windows::SID.stubs(:name_to_sid_object).returns(nil)
271
271
  Puppet::Util::Windows::ADSI.stubs(:connect).returns stub('connection', :Class => 'User')
272
272
  expect(provider).to be_exists
273
273
 
@@ -95,7 +95,7 @@ describe Puppet::Type.type(:zfs).provider(:zfs) do
95
95
  :mountpoint, :nbmand, :primarycache, :quota, :readonly,
96
96
  :recordsize, :refquota, :refreservation, :reservation,
97
97
  :secondarycache, :setuid, :shareiscsi, :sharenfs, :sharesmb,
98
- :snapdir, :version, :volsize, :vscan, :xattr, :zoned].each do |prop|
98
+ :snapdir, :version, :volsize, :vscan, :xattr].each do |prop|
99
99
  it "should get #{prop}" do
100
100
  provider.expects(:zfs).with(:get, '-H', '-o', 'value', prop, name).returns("value\n")
101
101
 
@@ -109,4 +109,58 @@ describe Puppet::Type.type(:zfs).provider(:zfs) do
109
109
  end
110
110
  end
111
111
  end
112
+ describe "zoned" do
113
+ context "on FreeBSD" do
114
+ before do
115
+ Facter.stubs(:value).with(:operatingsystem).returns("FreeBSD")
116
+ end
117
+ it "should get 'jailed' property" do
118
+ provider.expects(:zfs).with(:get, '-H', '-o', 'value', :jailed, name).returns("value\n")
119
+ expect(provider.send("zoned")).to eq('value')
120
+ end
121
+
122
+ it "should set jalied=value" do
123
+ provider.expects(:zfs).with(:set, "jailed=value", name)
124
+ provider.send("zoned=", "value")
125
+ end
126
+ end
127
+
128
+ context "when not running FreeBSD" do
129
+ before do
130
+ Facter.stubs(:value).with(:operatingsystem).returns("Solaris")
131
+ end
132
+ it "should get 'zoned' property" do
133
+ provider.expects(:zfs).with(:get, '-H', '-o', 'value', :zoned, name).returns("value\n")
134
+ expect(provider.send("zoned")).to eq('value')
135
+ end
136
+
137
+ it "should set zoned=value" do
138
+ provider.expects(:zfs).with(:set, "zoned=value", name)
139
+ provider.send("zoned=", "value")
140
+ end
141
+ end
142
+ end
143
+ describe "acltype" do
144
+ context "when available" do
145
+ it "should get 'acltype' property" do
146
+ provider.expects(:zfs).with(:get, '-H', '-o', 'value', :acltype, name).returns("value\n")
147
+ expect(provider.send("acltype")).to eq('value')
148
+ end
149
+ it "should set acltype=value" do
150
+ provider.expects(:zfs).with(:set, "acltype=value", name)
151
+ provider.send("acltype=", "value")
152
+ end
153
+ end
154
+
155
+ context "when not available" do
156
+ it "should get '-' for the acltype property" do
157
+ provider.expects(:zfs).with(:get, '-H', '-o', 'value', :acltype, name).raises(RuntimeError, 'not valid')
158
+ expect(provider.send("acltype")).to eq('-')
159
+ end
160
+ it "should not error out when trying to set acltype" do
161
+ provider.expects(:zfs).with(:set, "acltype=value", name).raises(RuntimeError, 'not valid')
162
+ expect{provider.send("acltype=", "value")}.to_not raise_error
163
+ end
164
+ end
165
+ end
112
166
  end
@@ -279,6 +279,45 @@ describe Puppet::Provider do
279
279
  expect(subject.name).to eq(type.defaultprovider.name)
280
280
  end
281
281
 
282
+ describe "regex matches" do
283
+ it "should match a singular regex" do
284
+ Facter.expects(:value).with(:osfamily).at_least_once.returns "solaris"
285
+
286
+ one = type.provide(:one) do
287
+ defaultfor :osfamily => /solaris/
288
+ end
289
+
290
+ expect(one).to be_default
291
+ end
292
+
293
+ it "should not match a non-matching regex " do
294
+ Facter.expects(:value).with(:osfamily).at_least_once.returns "redhat"
295
+
296
+ one = type.provide(:one) do
297
+ defaultfor :osfamily => /solaris/
298
+ end
299
+
300
+ expect(one).to_not be_default
301
+ end
302
+
303
+ it "should allow a mix of regex and string" do
304
+
305
+ Facter.expects(:value).with(:operatingsystem).at_least_once.returns "fedora"
306
+ Facter.expects(:value).with(:operatingsystemmajrelease).at_least_once.returns "24"
307
+
308
+ one = type.provide(:one) do
309
+ defaultfor :operatingsystem => "fedora", :operatingsystemmajrelease => /^2[2-9]$/
310
+ end
311
+
312
+ two = type.provide(:two) do
313
+ defaultfor :operatingsystem => /fedora/, :operatingsystemmajrelease => '24'
314
+ end
315
+
316
+ expect(one).to be_default
317
+ expect(two).to be_default
318
+ end
319
+ end
320
+
282
321
  describe "when there are multiple defaultfor's of equal specificity" do
283
322
  before :each do
284
323
  subject.defaultfor :operatingsystem => :os1
@@ -306,6 +345,7 @@ describe Puppet::Provider do
306
345
  before :each do
307
346
  subject.defaultfor :operatingsystem => :os1
308
347
  subject.defaultfor :operatingsystem => :os2, :operatingsystemmajrelease => "42"
348
+ subject.defaultfor :operatingsystem => :os3, :operatingsystemmajrelease => /^4[2-9]$/
309
349
  end
310
350
 
311
351
  let(:alternate) { type.provide(:alternate) {} }
@@ -318,6 +358,14 @@ describe Puppet::Provider do
318
358
  expect(alternate).not_to be_default
319
359
  end
320
360
 
361
+ it "should be default for a more specific, but matching, defaultfor with regex" do
362
+ Facter.expects(:value).with(:operatingsystem).at_least_once.returns :os3
363
+ Facter.expects(:value).with(:operatingsystemmajrelease).at_least_once.returns "42"
364
+
365
+ expect(provider).to be_default
366
+ expect(alternate).not_to be_default
367
+ end
368
+
321
369
  it "should be default for a less specific, but matching, defaultfor" do
322
370
  Facter.expects(:value).with(:operatingsystem).at_least_once.returns :os1
323
371