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
@@ -98,7 +98,6 @@ Puppet::Type.type(:package).provide(:appdmg, :parent => Puppet::Provider::Packag
98
98
  end
99
99
 
100
100
  def install
101
- source = nil
102
101
  unless source = @resource[:source]
103
102
  self.fail _("Mac OS X PKG DMGs must specify a package source.")
104
103
  end
@@ -37,7 +37,6 @@ Puppet::Type.type(:package).provide :apple, :parent => Puppet::Provider::Package
37
37
  end
38
38
 
39
39
  def install
40
- source = nil
41
40
  unless source = @resource[:source]
42
41
  self.fail _("Mac OS X packages must specify a package source")
43
42
  end
@@ -8,7 +8,7 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
8
8
  specified source is used, also pass `--clear-sources` via `install_options`.
9
9
  If source is present but is not a valid URL, it will be interpreted as the
10
10
  path to a local gem file. If source is not present, the gem will be
11
- installed from the default gem repositories.
11
+ installed from the default gem repositories. Note that to modify this for Windows, it has to be a valid URL.
12
12
 
13
13
  This provider supports the `install_options` and `uninstall_options` attributes,
14
14
  which allow command-line flags to be passed to the gem command.
@@ -31,7 +31,7 @@ Puppet::Type.type(:package).provide :gem, :parent => Puppet::Provider::Package d
31
31
  gem_list_command << "--source" << options[:source]
32
32
  end
33
33
  if name = options[:justme]
34
- gem_list_command << "^" + name + "$"
34
+ gem_list_command << '\A' + name + '\z'
35
35
  end
36
36
 
37
37
  begin
@@ -61,9 +61,9 @@ Puppet::Type.type(:package).provide :macports, :parent => Puppet::Provider::Pack
61
61
  def install
62
62
  should = @resource.should(:ensure)
63
63
  if [:latest, :installed, :present].include?(should)
64
- output = port("-q", :install, @resource[:name])
64
+ port("-q", :install, @resource[:name])
65
65
  else
66
- output = port("-q", :install, @resource[:name], "@#{should}")
66
+ port("-q", :install, @resource[:name], "@#{should}")
67
67
  end
68
68
  # MacPorts now correctly exits non-zero with appropriate errors in
69
69
  # situations where a port cannot be found or installed.
@@ -174,6 +174,9 @@ Puppet::Type.type(:package).provide :pkg, :parent => Puppet::Provider::Package d
174
174
  # http://defect.opensolaris.org/bz/show_bug.cgi?id=19159%
175
175
  # notes that we can't use -Ha for the same even though the manual page reads that way.
176
176
  def latest
177
+ # Refresh package metadata before looking for latest versions
178
+ pkg(:refresh)
179
+
177
180
  lines = pkg(:list, "-Hvn", @resource[:name]).split("\n")
178
181
 
179
182
  # remove certificate expiration warnings from the output, but report them
@@ -140,7 +140,6 @@ Puppet::Type.type(:package).provide :pkgdmg, :parent => Puppet::Provider::Packag
140
140
  end
141
141
 
142
142
  def install
143
- source = nil
144
143
  unless source = @resource[:source]
145
144
  raise Puppet::Error.new(_("Mac OS X PKG DMGs must specify a package source."))
146
145
  end
@@ -109,7 +109,6 @@ Puppet::Type.type(:package).provide :portage, :parent => Puppet::Provider::Packa
109
109
  result_format = self.qatom_result_format
110
110
  result_fields = self.qatom_result_fields
111
111
  @atom ||= begin
112
- search_output = nil
113
112
  package_info = {}
114
113
  # do the search
115
114
  search_output = qatom_bin *([@resource[:name], '--format', output_format])
@@ -145,7 +145,7 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
145
145
  # Quote the DNF docs:
146
146
  # "Yum does this if its obsoletes config option is enabled but
147
147
  # the behavior is not properly documented and can be harmful."
148
- # So we'll stick with the safter option
148
+ # So we'll stick with the safer option
149
149
  # If a user wants to remove obsoletes, they can use { :install_options => '--obsoletes' }
150
150
  # More detail here: https://bugzilla.redhat.com/show_bug.cgi?id=1096506
151
151
  'update'
@@ -175,17 +175,32 @@ Puppet::Type.type(:package).provide :yum, :parent => :rpm, :source => :rpm do
175
175
  operation = :install
176
176
  end
177
177
  should = nil
178
- when true, false, Symbol
178
+ when true, :present, :installed
179
+ # if we have been given a source and we were not asked for a specific
180
+ # version feed it to yum directly
181
+ if @resource[:source]
182
+ wanted = @resource[:source]
183
+ self.debug "Installing directly from #{wanted}"
184
+ end
185
+ should = nil
186
+ when false,:absent
179
187
  # pass
180
188
  should = nil
181
189
  else
182
- # Add the package version
183
- wanted += "-#{should}"
184
- if wanted.scan(ARCH_REGEX)
185
- self.debug "Detected Arch argument in package! - Moving arch to end of version string"
186
- wanted.gsub!(/(.+)(#{ARCH_REGEX})(.+)/,'\1\3\2')
190
+ if @resource[:source]
191
+ # An explicit source was supplied, which means we're ensuring a specific
192
+ # version, and also supplying the path to a package that supplies that
193
+ # version.
194
+ wanted = @resource[:source]
195
+ self.debug "Installing directly from #{wanted}"
196
+ else
197
+ # No explicit source was specified, so add the package version
198
+ wanted += "-#{should}"
199
+ if wanted.scan(ARCH_REGEX)
200
+ self.debug "Detected Arch argument in package! - Moving arch to end of version string"
201
+ wanted.gsub!(/(.+)(#{ARCH_REGEX})(.+)/,'\1\3\2')
202
+ end
187
203
  end
188
-
189
204
  current_package = self.query
190
205
  if current_package
191
206
  if rpm_compareEVR(rpm_parse_evr(should), rpm_parse_evr(current_package[:ensure])) < 0
@@ -126,7 +126,7 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm do
126
126
 
127
127
  def uninstall
128
128
  #extract version numbers and convert to integers
129
- major, minor, patch = zypper_version.scan(/\d+/).map{ |x| x.to_i }
129
+ major, minor, _ = zypper_version.scan(/\d+/).map{ |x| x.to_i }
130
130
 
131
131
  if major < 1
132
132
  super
@@ -137,7 +137,7 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm do
137
137
  end
138
138
 
139
139
  options << @resource[:name]
140
-
140
+
141
141
  zypper *options
142
142
  end
143
143
 
@@ -308,7 +308,7 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
308
308
  trigger['type']['days_of_week'] = if puppet_trigger['day_of_week']
309
309
  bitfield_from_days_of_week(puppet_trigger['day_of_week'])
310
310
  else
311
- scheduler_days_of_week.inject(0) {|day_flags,day| day_flags |= day}
311
+ scheduler_days_of_week.inject(0) {|day_flags,day| day_flags | day}
312
312
  end
313
313
  when 'monthly'
314
314
  trigger['type'] = {
@@ -426,7 +426,7 @@ Puppet::Type.type(:scheduled_task).provide(:win32_taskscheduler) do
426
426
  day = 32 if day == 'last'
427
427
 
428
428
  integer_day = Integer(day)
429
- self.fail "Day must be specified as an integer in the range 1-31, or as 'last'" unless integer_day = day.to_f and integer_day.between?(1,32)
429
+ self.fail "Day must be specified as an integer in the range 1-31, or as 'last'" unless integer_day.between?(1,32)
430
430
 
431
431
  bitfield |= 1 << integer_day - 1
432
432
  end
@@ -72,6 +72,7 @@ Puppet::Type.type(:service).provide :init, :parent => :base do
72
72
  excludes += %w{cryptdisks-udev}
73
73
  excludes += %w{statd-mounting}
74
74
  excludes += %w{gssd-mounting}
75
+ excludes
75
76
  end
76
77
 
77
78
  # List all services of this type.
@@ -4,10 +4,9 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
4
4
  This provider manages jobs with `launchd`, which is the default service
5
5
  framework for Mac OS X (and may be available for use on other platforms).
6
6
 
7
- For `launchd` documentation, see:
7
+ For more information, see the `launchd` man page:
8
8
 
9
- * <https://developer.apple.com/macosx/launchd.html>
10
- * <http://launchd.macosforge.org/>
9
+ * <https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man8/launchd.8.html>
11
10
 
12
11
  This provider reads plists out of the following directories:
13
12
 
@@ -142,7 +141,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
142
141
  @label_to_path_map[job["Label"]] = filepath
143
142
  else
144
143
  #TRANSLATORS 'plist' and label' should not be translated
145
- Puppet.warning(_("The %{file} plist does not contain a 'label' key; Puppet is skipping it") % { file: filepath })
144
+ Puppet.debug(_("The %{file} plist does not contain a 'label' key; Puppet is skipping it") % { file: filepath })
146
145
  next
147
146
  end
148
147
  end
@@ -239,7 +238,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
239
238
  # directly.
240
239
  def start
241
240
  return ucommand(:start) if resource[:start]
242
- job_path, job_plist = plist_from_label(resource[:name])
241
+ job_path, _ = plist_from_label(resource[:name])
243
242
  did_enable_job = false
244
243
  cmds = []
245
244
  cmds << :launchctl << :load
@@ -262,7 +261,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
262
261
 
263
262
  def stop
264
263
  return ucommand(:stop) if resource[:stop]
265
- job_path, job_plist = plist_from_label(resource[:name])
264
+ job_path, _ = plist_from_label(resource[:name])
266
265
  did_disable_job = false
267
266
  cmds = []
268
267
  cmds << :launchctl << :unload
@@ -298,7 +297,7 @@ Puppet::Type.type(:service).provide :launchd, :parent => :base do
298
297
  job_plist_disabled = nil
299
298
  overrides_disabled = nil
300
299
 
301
- job_path, job_plist = plist_from_label(resource[:name])
300
+ _, job_plist = plist_from_label(resource[:name])
302
301
  job_plist_disabled = job_plist["Disabled"] if job_plist.has_key?("Disabled")
303
302
 
304
303
  if FileTest.file?(self.class.launchd_overrides) and overrides = self.class.read_plist(self.class.launchd_overrides)
@@ -33,8 +33,9 @@ Puppet::Type.type(:service).provide :redhat, :parent => :init, :source => :init
33
33
  end
34
34
 
35
35
  # For Suse OS family, chkconfig returns 0 even if the service is disabled or non-existent
36
- # Therefore, check the output for '<name> on' to see if it is enabled
37
- return :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+on$/
36
+ # Therefore, check the output for '<name> on' (or '<name> B for boot services)
37
+ # to see if it is enabled
38
+ return :false unless Facter.value(:osfamily) != 'Suse' || output =~ /^#{name}\s+(on|B)$/
38
39
 
39
40
  :true
40
41
  end
@@ -25,7 +25,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
25
25
  defaultfor :osfamily => :coreos
26
26
  defaultfor :operatingsystem => :amazon, :operatingsystemmajrelease => ["2"]
27
27
  defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ["8", "stretch/sid", "9", "buster/sid"]
28
- defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["15.04","15.10","16.04","16.10","17.04","17.10","18.04"]
28
+ defaultfor :operatingsystem => :ubuntu, :operatingsystemmajrelease => ["15.04","15.10","16.04","16.10"]
29
29
  defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ["3"]
30
30
 
31
31
  def self.instances
@@ -179,7 +179,7 @@ Puppet::Type.type(:service).provide :systemd, :parent => :base do
179
179
  def prepare_error_message(name, action, exception)
180
180
  error_return = "Systemd #{action} for #{name} failed!\n"
181
181
  journalctl_command = "journalctl -n 50 --since '5 minutes ago' -u #{name} --no-pager"
182
- Puppet.debug("Runing journalctl command to get logs for systemd #{action} failure: #{journalctl_command}")
182
+ Puppet.debug("Running journalctl command to get logs for systemd #{action} failure: #{journalctl_command}")
183
183
  journalctl_output = execute(journalctl_command)
184
184
  error_return << "journalctl log for #{name}:\n#{journalctl_output}"
185
185
  end
@@ -58,7 +58,7 @@ Puppet::Type.type(:ssh_authorized_key).provide(
58
58
 
59
59
  Puppet::Util::SUIDManager.asuser(@resource.should(:user)) do
60
60
  unless Puppet::FileSystem.exist?(dir = File.dirname(target))
61
- Puppet.debug "Creating #{dir}"
61
+ Puppet.debug "Creating #{dir} as #{@resource.should(:user)}"
62
62
  Dir.mkdir(dir, dir_perm)
63
63
  end
64
64
 
@@ -72,6 +72,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
72
72
  :from => :expiry_from_attr },
73
73
  {:aix_attr => :maxage, :puppet_prop => :password_max_age},
74
74
  {:aix_attr => :minage, :puppet_prop => :password_min_age},
75
+ {:aix_attr => :pwdwarntime, :puppet_prop => :password_warn_days},
75
76
  {:aix_attr => :attributes, :puppet_prop => :attributes},
76
77
  { :aix_attr => :gecos, :puppet_prop => :comment },
77
78
  ]
@@ -275,7 +276,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
275
276
  # Must receive "user:enc_password" as input
276
277
  # command, arguments = {:failonfail => true, :combine => true}
277
278
  # Fix for bugs #11200 and #10915
278
- cmd = [self.class.command(:chpasswd), get_ia_module_args, '-e', '-c'].flatten
279
+ cmd = [self.class.command(:chpasswd), get_ia_module_args, '-e', '-c', user].flatten
279
280
  begin
280
281
  output = execute(cmd, {:failonfail => false, :combine => true, :stdinfile => tmpfile.path })
281
282
  # chpasswd can return 1, even on success (at least on AIX 6.1); empty output indicates success
@@ -292,7 +293,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
292
293
  def managed_attribute_keys(hash)
293
294
  managed_attributes ||= @resource.original_parameters[:attributes] || hash.keys.map{|k| k.to_s}
294
295
  managed_attributes = [managed_attributes] unless managed_attributes.is_a?(Array)
295
- managed_attributes.map {|attr| key, value = attr.split("="); key.strip.to_sym}
296
+ managed_attributes.map {|attr| key, _ = attr.split("="); key.strip.to_sym}
296
297
  end
297
298
 
298
299
  def should_include?(key, managed_keys)
@@ -45,7 +45,7 @@ Puppet::Type.type(:user).provide :openbsd, :parent => :useradd do
45
45
  # sp_loginclass field.
46
46
  begin
47
47
  return unmunge(shadow_property, ent.send(method))
48
- rescue => detail
48
+ rescue
49
49
  #TRANSLATORS 'ruby-shadow' is a Ruby gem library
50
50
  Puppet.warning _("ruby-shadow doesn't support %{method}") % { method: method }
51
51
  end
@@ -67,7 +67,7 @@ Puppet::Type.type(:user).provide :pw, :parent => Puppet::Provider::NameService::
67
67
  # use pw to update password hash
68
68
  def password=(cryptopw)
69
69
  Puppet.debug "change password for user '#{@resource[:name]}' method called with hash '#{cryptopw}'"
70
- stdin, stdout, stderr = Open3.popen3("pw user mod #{@resource[:name]} -H 0")
70
+ stdin, _, _ = Open3.popen3("pw user mod #{@resource[:name]} -H 0")
71
71
  stdin.puts(cryptopw)
72
72
  stdin.close
73
73
  Puppet.debug "finished password for user '#{@resource[:name]}' method called with hash '#{cryptopw}'"
@@ -18,6 +18,7 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
18
18
  options :profiles, :flag => "-P"
19
19
  options :password_min_age, :flag => "-n"
20
20
  options :password_max_age, :flag => "-x"
21
+ options :password_warn_days, :flag => "-w"
21
22
 
22
23
  verify :gid, "GID must be an integer" do |value|
23
24
  value.is_a? Integer
@@ -48,7 +49,7 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
48
49
  cmd = []
49
50
  Puppet::Type.type(:user).validproperties.each do |property|
50
51
  #skip the password because we can't create it with the solaris useradd
51
- next if [:ensure, :password, :password_min_age, :password_max_age].include?(property)
52
+ next if [:ensure, :password, :password_min_age, :password_max_age, :password_warn_days].include?(property)
52
53
  # 1680 Now you can set the hashed passwords on solaris:lib/puppet/provider/user/user_role_add.rb
53
54
  # the value needs to be quoted, mostly because -c might
54
55
  # have spaces in it
@@ -196,6 +197,11 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
196
197
  shadow_entry[4].empty? ? -1 : shadow_entry[4]
197
198
  end
198
199
 
200
+ def password_warn_days
201
+ return :absent unless shadow_entry
202
+ shadow_entry[5].empty? ? -1 : shadow_entry[5]
203
+ end
204
+
199
205
  # Read in /etc/shadow, find the line for our used and rewrite it with the
200
206
  # new pw. Smooth like 80 grit sandpaper.
201
207
  #
@@ -16,6 +16,7 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
16
16
  options :groups, :flag => "-G"
17
17
  options :password_min_age, :flag => "-m", :method => :sp_min
18
18
  options :password_max_age, :flag => "-M", :method => :sp_max
19
+ options :password_warn_days, :flag => "-W", :method => :sp_warn
19
20
  options :password, :method => :sp_pwdp
20
21
  options :expiry, :method => :sp_expire,
21
22
  :munge => proc { |value|
@@ -41,7 +42,7 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
41
42
  end
42
43
  }
43
44
 
44
- optional_commands :localadd => "luseradd"
45
+ optional_commands :localadd => "luseradd", :localdelete => "luserdel", :localmodify => "lusermod", :localpassword => "lchage"
45
46
  has_feature :libuser if Puppet.features.libuser?
46
47
 
47
48
  def exists?
@@ -156,7 +157,7 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
156
157
  # sort them to have a predictable command line in tests
157
158
  Puppet::Type.type(:user).validproperties.sort.each do |property|
158
159
  next if property == :ensure
159
- next if property.to_s =~ /password_.+_age/
160
+ next if property_manages_password_age?(property)
160
161
  next if property == :groups and @resource.forcelocal?
161
162
  next if property == :expiry and @resource.forcelocal?
162
163
  # the value needs to be quoted, mostly because -c might
@@ -185,22 +186,47 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
185
186
  cmd << @resource[:name]
186
187
  end
187
188
 
189
+ def modifycmd(param, value)
190
+ if @resource.forcelocal?
191
+ cmd = [command(property_manages_password_age?(param) ? :localpassword : :localmodify)]
192
+ @custom_environment = Puppet::Util::Libuser.getenv
193
+ else
194
+ cmd = [command(property_manages_password_age?(param) ? :password : :modify)]
195
+ end
196
+ cmd << flag(param) << value
197
+ cmd += check_allow_dup
198
+ cmd << @resource[:name]
199
+
200
+ cmd
201
+ end
202
+
188
203
  def deletecmd
189
- cmd = [command(:delete)]
204
+ if @resource.forcelocal?
205
+ cmd = [command(:localdelete)]
206
+ @custom_environment = Puppet::Util::Libuser.getenv
207
+ else
208
+ cmd = [command(:delete)]
209
+ end
190
210
  cmd += @resource.managehome? ? ['-r'] : []
191
211
  cmd << @resource[:name]
192
212
  end
193
213
 
194
214
  def passcmd
195
- age_limits = [:password_min_age, :password_max_age].select { |property| @resource.should(property) }
215
+ if @resource.forcelocal?
216
+ cmd = command(:localpassword)
217
+ @custom_environment = Puppet::Util::Libuser.getenv
218
+ else
219
+ cmd = command(:password)
220
+ end
221
+ age_limits = [:password_min_age, :password_max_age, :password_warn_days].select { |property| @resource.should(property) }
196
222
  if age_limits.empty?
197
223
  nil
198
224
  else
199
- [command(:password),age_limits.collect { |property| [flag(property), @resource.should(property)]}, @resource[:name]].flatten
225
+ [cmd, age_limits.collect { |property| [flag(property), @resource.should(property)]}, @resource[:name]].flatten
200
226
  end
201
227
  end
202
228
 
203
- [:expiry, :password_min_age, :password_max_age, :password].each do |shadow_property|
229
+ [:expiry, :password_min_age, :password_max_age, :password_warn_days, :password].each do |shadow_property|
204
230
  define_method(shadow_property) do
205
231
  if Puppet.features.libshadow?
206
232
  if ent = Shadow::Passwd.getspnam(@canonical_name)
@@ -228,4 +254,8 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
228
254
  def groups?
229
255
  !!@resource[:groups]
230
256
  end
257
+
258
+ def property_manages_password_age?(property)
259
+ property.to_s =~ /password_.+_age|password_warn_days/
260
+ end
231
261
  end
@@ -52,7 +52,7 @@ Puppet::Type.type(:user).provide :windows_adsi do
52
52
  def groups_to_s(groups)
53
53
  return '' if groups.nil? || !groups.kind_of?(Array)
54
54
  groups = groups.map do |group_name|
55
- sid = Puppet::Util::Windows::SID.name_to_principal(group_name)
55
+ sid = Puppet::Util::Windows::SID.name_to_sid_object(group_name)
56
56
  if sid.account =~ /\\/
57
57
  account, _ = Puppet::Util::Windows::ADSI::Group.parse_name(sid.account)
58
58
  else
@@ -76,8 +76,8 @@ Puppet::Type.type(:yumrepo).provide(:inifile) do
76
76
  # Use directories in reposdir if they are set instead of default
77
77
  if reposdir
78
78
  # Follow the code from the yum/config.py
79
- dirs = reposdir.gsub!("\n", ' ')
80
- dirs = reposdir.gsub!(',', ' ')
79
+ reposdir.gsub!("\n", ' ')
80
+ reposdir.gsub!(',', ' ')
81
81
  dirs = reposdir.split
82
82
  end
83
83
  dirs.select! { |dir| Puppet::FileSystem.exist?(dir) }
@@ -204,8 +204,6 @@ Puppet::Type.type(:yumrepo).provide(:inifile) do
204
204
  def create
205
205
  @property_hash[:ensure] = :present
206
206
 
207
- new_section = current_section
208
-
209
207
  # We fetch a list of properties from the type, then iterate
210
208
  # over them, avoiding ensure. We're relying on .should to
211
209
  # check if the property has been set and should be modified,