puppet 7.7.0-x86-mingw32 → 7.11.0-x86-mingw32

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

Potentially problematic release.


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

Files changed (386) hide show
  1. checksums.yaml +4 -4
  2. data/CONTRIBUTING.md +7 -7
  3. data/Gemfile +4 -3
  4. data/Gemfile.lock +18 -18
  5. data/README.md +4 -4
  6. data/{ext → examples/enc}/regexp_nodes/classes/databases +0 -0
  7. data/{ext → examples/enc}/regexp_nodes/classes/webservers +0 -0
  8. data/{ext → examples/enc}/regexp_nodes/environment/development +0 -0
  9. data/{ext → examples/enc}/regexp_nodes/parameters/service/prod +0 -0
  10. data/{ext → examples/enc}/regexp_nodes/parameters/service/qa +0 -0
  11. data/{ext → examples/enc}/regexp_nodes/parameters/service/sandbox +0 -0
  12. data/{ext → examples/enc}/regexp_nodes/regexp_nodes.rb +0 -0
  13. data/{ext → examples}/nagios/check_puppet.rb +2 -2
  14. data/ext/README.md +13 -0
  15. data/ext/osx/puppet.plist +2 -0
  16. data/ext/project_data.yaml +1 -0
  17. data/install.rb +0 -4
  18. data/lib/puppet/application/agent.rb +4 -0
  19. data/lib/puppet/application/apply.rb +20 -2
  20. data/lib/puppet/application/filebucket.rb +1 -0
  21. data/lib/puppet/application/resource.rb +30 -15
  22. data/lib/puppet/application/ssl.rb +1 -0
  23. data/lib/puppet/concurrent/thread_local_singleton.rb +1 -0
  24. data/lib/puppet/configurer.rb +169 -50
  25. data/lib/puppet/confine/variable.rb +1 -1
  26. data/lib/puppet/defaults.rb +70 -30
  27. data/lib/puppet/environments.rb +75 -25
  28. data/lib/puppet/face/help/action.erb +1 -0
  29. data/lib/puppet/face/help/face.erb +1 -0
  30. data/lib/puppet/face/node/clean.rb +1 -1
  31. data/lib/puppet/facter_impl.rb +96 -0
  32. data/lib/puppet/file_serving/configuration/parser.rb +2 -0
  33. data/lib/puppet/file_serving/configuration.rb +2 -0
  34. data/lib/puppet/file_serving/mount/file.rb +4 -4
  35. data/lib/puppet/file_serving/mount/scripts.rb +24 -0
  36. data/lib/puppet/file_system/file_impl.rb +3 -1
  37. data/lib/puppet/file_system/windows.rb +2 -2
  38. data/lib/puppet/forge/cache.rb +1 -1
  39. data/lib/puppet/forge.rb +4 -4
  40. data/lib/puppet/functions/empty.rb +8 -0
  41. data/lib/puppet/functions/find_template.rb +2 -2
  42. data/lib/puppet/functions/strftime.rb +1 -0
  43. data/lib/puppet/functions/unwrap.rb +17 -2
  44. data/lib/puppet/http/service/compiler.rb +6 -1
  45. data/lib/puppet/indirector/catalog/compiler.rb +24 -6
  46. data/lib/puppet/indirector/catalog/rest.rb +1 -0
  47. data/lib/puppet/indirector/facts/facter.rb +6 -6
  48. data/lib/puppet/indirector/indirection.rb +1 -1
  49. data/lib/puppet/indirector/resource/ral.rb +6 -1
  50. data/lib/puppet/indirector/terminus.rb +4 -0
  51. data/lib/puppet/interface/documentation.rb +1 -0
  52. data/lib/puppet/module/plan.rb +0 -1
  53. data/lib/puppet/module/task.rb +1 -1
  54. data/lib/puppet/module_tool/applications/installer.rb +12 -4
  55. data/lib/puppet/module_tool/applications/uninstaller.rb +1 -1
  56. data/lib/puppet/module_tool/applications/upgrader.rb +1 -1
  57. data/lib/puppet/module_tool/errors/shared.rb +17 -0
  58. data/lib/puppet/module_tool/tar/mini.rb +1 -1
  59. data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
  60. data/lib/puppet/node/environment.rb +10 -11
  61. data/lib/puppet/pal/pal_impl.rb +1 -1
  62. data/lib/puppet/parser/scope.rb +8 -7
  63. data/lib/puppet/parser/templatewrapper.rb +1 -0
  64. data/lib/puppet/pops/lookup/lookup_adapter.rb +3 -2
  65. data/lib/puppet/pops/model/ast.rb +1 -0
  66. data/lib/puppet/pops/model/factory.rb +14 -13
  67. data/lib/puppet/pops/parser/egrammar.ra +2 -2
  68. data/lib/puppet/pops/parser/eparser.rb +752 -753
  69. data/lib/puppet/pops/parser/lexer2.rb +69 -68
  70. data/lib/puppet/pops/parser/slurp_support.rb +1 -0
  71. data/lib/puppet/pops/serialization/to_data_converter.rb +18 -6
  72. data/lib/puppet/pops/serialization/to_stringified_converter.rb +1 -1
  73. data/lib/puppet/pops/types/p_sem_ver_type.rb +8 -2
  74. data/lib/puppet/pops/types/p_sensitive_type.rb +10 -0
  75. data/lib/puppet/pops/types/type_formatter.rb +7 -6
  76. data/lib/puppet/pops/types/type_mismatch_describer.rb +1 -1
  77. data/lib/puppet/pops/types/types.rb +1 -1
  78. data/lib/puppet/provider/aix_object.rb +1 -1
  79. data/lib/puppet/provider/exec/posix.rb +16 -4
  80. data/lib/puppet/provider/group/groupadd.rb +5 -2
  81. data/lib/puppet/provider/package/apt.rb +3 -3
  82. data/lib/puppet/provider/package/nim.rb +11 -6
  83. data/lib/puppet/provider/package/pip.rb +15 -3
  84. data/lib/puppet/provider/package/pkg.rb +9 -2
  85. data/lib/puppet/provider/package/puppet_gem.rb +1 -1
  86. data/lib/puppet/provider/package/puppetserver_gem.rb +1 -1
  87. data/lib/puppet/provider/package/windows/exe_package.rb +30 -1
  88. data/lib/puppet/provider/package/windows/package.rb +2 -1
  89. data/lib/puppet/provider/package/windows.rb +14 -1
  90. data/lib/puppet/provider/package/yum.rb +4 -4
  91. data/lib/puppet/provider/package/zypper.rb +3 -3
  92. data/lib/puppet/provider/parsedfile.rb +3 -0
  93. data/lib/puppet/provider/service/base.rb +1 -1
  94. data/lib/puppet/provider/service/freebsd.rb +1 -1
  95. data/lib/puppet/provider/service/init.rb +5 -5
  96. data/lib/puppet/provider/service/launchd.rb +2 -2
  97. data/lib/puppet/provider/service/redhat.rb +1 -1
  98. data/lib/puppet/provider/service/smf.rb +3 -3
  99. data/lib/puppet/provider/service/systemd.rb +8 -3
  100. data/lib/puppet/provider/service/upstart.rb +5 -5
  101. data/lib/puppet/provider/user/aix.rb +44 -1
  102. data/lib/puppet/provider/user/directoryservice.rb +25 -12
  103. data/lib/puppet/provider/user/useradd.rb +52 -16
  104. data/lib/puppet/provider.rb +1 -1
  105. data/lib/puppet/reference/providers.rb +2 -2
  106. data/lib/puppet/resource/type_collection.rb +4 -1
  107. data/lib/puppet/runtime.rb +11 -1
  108. data/lib/puppet/settings/config_file.rb +1 -8
  109. data/lib/puppet/settings/file_setting.rb +3 -8
  110. data/lib/puppet/settings/value_translator.rb +0 -1
  111. data/lib/puppet/settings.rb +32 -9
  112. data/lib/puppet/test/test_helper.rb +4 -1
  113. data/lib/puppet/transaction/additional_resource_generator.rb +1 -1
  114. data/lib/puppet/transaction/persistence.rb +11 -1
  115. data/lib/puppet/transaction/report.rb +15 -1
  116. data/lib/puppet/type/exec.rb +35 -5
  117. data/lib/puppet/type/file/mode.rb +6 -0
  118. data/lib/puppet/type/file.rb +6 -6
  119. data/lib/puppet/type/filebucket.rb +2 -2
  120. data/lib/puppet/type/group.rb +0 -1
  121. data/lib/puppet/type/resources.rb +1 -1
  122. data/lib/puppet/type/service.rb +8 -9
  123. data/lib/puppet/type/tidy.rb +1 -1
  124. data/lib/puppet/type/user.rb +39 -22
  125. data/lib/puppet/type.rb +1 -1
  126. data/lib/puppet/util/command_line.rb +1 -1
  127. data/lib/puppet/util/filetype.rb +2 -2
  128. data/lib/puppet/util/log.rb +1 -2
  129. data/lib/puppet/util/logging.rb +1 -25
  130. data/lib/puppet/util/monkey_patches.rb +2 -17
  131. data/lib/puppet/util/pidlock.rb +1 -1
  132. data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +1 -1
  133. data/lib/puppet/util/suidmanager.rb +1 -2
  134. data/lib/puppet/util/symbolic_file_mode.rb +29 -17
  135. data/lib/puppet/util/tagging.rb +1 -0
  136. data/lib/puppet/util/windows/sid.rb +3 -1
  137. data/lib/puppet/util/windows/user.rb +0 -1
  138. data/lib/puppet/util.rb +4 -3
  139. data/lib/puppet/version.rb +1 -1
  140. data/lib/puppet/x509/cert_provider.rb +3 -21
  141. data/lib/puppet.rb +5 -9
  142. data/locales/puppet.pot +346 -274
  143. data/man/man5/puppet.conf.5 +76 -25
  144. data/man/man8/puppet-agent.8 +4 -1
  145. data/man/man8/puppet-apply.8 +1 -1
  146. data/man/man8/puppet-catalog.8 +9 -9
  147. data/man/man8/puppet-config.8 +1 -1
  148. data/man/man8/puppet-describe.8 +1 -1
  149. data/man/man8/puppet-device.8 +1 -1
  150. data/man/man8/puppet-doc.8 +1 -1
  151. data/man/man8/puppet-epp.8 +1 -1
  152. data/man/man8/puppet-facts.8 +7 -7
  153. data/man/man8/puppet-filebucket.8 +1 -1
  154. data/man/man8/puppet-generate.8 +1 -1
  155. data/man/man8/puppet-help.8 +1 -1
  156. data/man/man8/puppet-lookup.8 +1 -1
  157. data/man/man8/puppet-module.8 +3 -3
  158. data/man/man8/puppet-node.8 +5 -5
  159. data/man/man8/puppet-parser.8 +1 -1
  160. data/man/man8/puppet-plugin.8 +1 -1
  161. data/man/man8/puppet-report.8 +5 -5
  162. data/man/man8/puppet-resource.8 +1 -1
  163. data/man/man8/puppet-script.8 +1 -1
  164. data/man/man8/puppet-ssl.8 +1 -1
  165. data/man/man8/puppet.8 +2 -2
  166. data/spec/fixtures/integration/application/agent/lib/facter/agent_spec_role.rb +3 -0
  167. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/Gemfile +4 -0
  168. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/Rakefile +3 -0
  169. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/lib/puppet/functions/l10n.rb +8 -0
  170. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/config.yaml +25 -0
  171. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/ja/puppet-l10n.po +19 -0
  172. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/locales/puppet-l10n.pot +20 -0
  173. data/spec/fixtures/integration/l10n/envs/prod/modules/demo/metadata.json +8 -0
  174. data/spec/fixtures/ssl/127.0.0.1-key.pem +106 -106
  175. data/spec/fixtures/ssl/127.0.0.1.pem +48 -48
  176. data/spec/fixtures/ssl/bad-basic-constraints.pem +54 -54
  177. data/spec/fixtures/ssl/bad-int-basic-constraints.pem +51 -51
  178. data/spec/fixtures/ssl/ca.pem +52 -52
  179. data/spec/fixtures/ssl/crl.pem +25 -25
  180. data/spec/fixtures/ssl/ec-key-openssl.pem +8 -0
  181. data/spec/fixtures/ssl/ec-key-pk8.pem +5 -0
  182. data/spec/fixtures/ssl/ec-key.pem +11 -11
  183. data/spec/fixtures/ssl/ec.pem +32 -32
  184. data/spec/fixtures/ssl/encrypted-ec-key.pem +12 -12
  185. data/spec/fixtures/ssl/encrypted-key.pem +107 -107
  186. data/spec/fixtures/ssl/intermediate-agent-crl.pem +25 -25
  187. data/spec/fixtures/ssl/intermediate-agent.pem +54 -54
  188. data/spec/fixtures/ssl/intermediate-crl.pem +28 -28
  189. data/spec/fixtures/ssl/intermediate.pem +51 -51
  190. data/spec/fixtures/ssl/oid-key.pem +117 -0
  191. data/spec/fixtures/ssl/oid.pem +69 -0
  192. data/spec/fixtures/ssl/pluto-key.pem +106 -106
  193. data/spec/fixtures/ssl/pluto.pem +50 -50
  194. data/spec/fixtures/ssl/request-key.pem +106 -106
  195. data/spec/fixtures/ssl/request.pem +45 -45
  196. data/spec/fixtures/ssl/revoked-key.pem +106 -106
  197. data/spec/fixtures/ssl/revoked.pem +49 -49
  198. data/spec/fixtures/ssl/signed-key.pem +106 -106
  199. data/spec/fixtures/ssl/signed.pem +47 -47
  200. data/spec/fixtures/ssl/tampered-cert.pem +49 -49
  201. data/spec/fixtures/ssl/tampered-csr.pem +45 -45
  202. data/spec/fixtures/ssl/trusted_oid_mapping.yaml +5 -0
  203. data/spec/fixtures/ssl/unknown-127.0.0.1-key.pem +106 -106
  204. data/spec/fixtures/ssl/unknown-127.0.0.1.pem +48 -48
  205. data/spec/fixtures/ssl/unknown-ca-key.pem +106 -106
  206. data/spec/fixtures/ssl/unknown-ca.pem +52 -52
  207. data/spec/integration/application/agent_spec.rb +118 -52
  208. data/spec/integration/application/filebucket_spec.rb +16 -0
  209. data/spec/integration/application/module_spec.rb +21 -0
  210. data/spec/integration/application/resource_spec.rb +64 -0
  211. data/spec/integration/application/ssl_spec.rb +20 -0
  212. data/spec/integration/configurer_spec.rb +18 -2
  213. data/spec/integration/defaults_spec.rb +5 -0
  214. data/spec/integration/environments/settings_interpolation_spec.rb +0 -4
  215. data/spec/integration/indirector/facts/facter_spec.rb +93 -39
  216. data/spec/integration/l10n/compiler_spec.rb +37 -0
  217. data/spec/integration/transaction/report_spec.rb +1 -1
  218. data/spec/integration/type/exec_spec.rb +70 -45
  219. data/spec/integration/type/file_spec.rb +2 -2
  220. data/spec/integration/type/package_spec.rb +6 -6
  221. data/spec/integration/util/rdoc/parser_spec.rb +1 -1
  222. data/spec/integration/util/windows/process_spec.rb +1 -9
  223. data/spec/lib/puppet/test_ca.rb +5 -0
  224. data/spec/lib/puppet_spec/modules.rb +13 -2
  225. data/spec/lib/puppet_spec/puppetserver.rb +15 -0
  226. data/spec/lib/puppet_spec/settings.rb +1 -0
  227. data/spec/shared_behaviours/documentation_on_faces.rb +0 -2
  228. data/spec/shared_contexts/l10n.rb +27 -0
  229. data/spec/spec_helper.rb +1 -10
  230. data/spec/unit/application/apply_spec.rb +76 -56
  231. data/spec/unit/application/resource_spec.rb +29 -0
  232. data/spec/unit/configurer_spec.rb +277 -56
  233. data/spec/unit/environments_spec.rb +184 -0
  234. data/spec/unit/facter_impl_spec.rb +31 -0
  235. data/spec/unit/file_bucket/dipper_spec.rb +2 -2
  236. data/spec/unit/file_serving/configuration/parser_spec.rb +23 -0
  237. data/spec/unit/file_serving/configuration_spec.rb +12 -4
  238. data/spec/unit/file_serving/mount/scripts_spec.rb +69 -0
  239. data/spec/unit/file_system_spec.rb +13 -0
  240. data/spec/unit/functions/assert_type_spec.rb +1 -1
  241. data/spec/unit/functions/empty_spec.rb +10 -0
  242. data/spec/unit/functions/logging_spec.rb +1 -0
  243. data/spec/unit/functions/lookup_spec.rb +87 -0
  244. data/spec/unit/functions/unwrap_spec.rb +8 -0
  245. data/spec/unit/functions4_spec.rb +19 -10
  246. data/spec/unit/http/service/compiler_spec.rb +8 -0
  247. data/spec/unit/indirector/catalog/compiler_spec.rb +87 -0
  248. data/spec/unit/indirector/catalog/rest_spec.rb +8 -0
  249. data/spec/unit/indirector/indirection_spec.rb +10 -3
  250. data/spec/unit/indirector/resource/ral_spec.rb +40 -75
  251. data/spec/unit/interface/action_spec.rb +0 -9
  252. data/spec/unit/module_spec.rb +14 -0
  253. data/spec/unit/module_tool/applications/installer_spec.rb +52 -14
  254. data/spec/unit/parser/compiler_spec.rb +29 -0
  255. data/spec/unit/parser/templatewrapper_spec.rb +12 -2
  256. data/spec/unit/pops/loaders/dependency_loader_spec.rb +0 -9
  257. data/spec/unit/pops/parser/lexer2_spec.rb +0 -4
  258. data/spec/unit/pops/parser/parse_containers_spec.rb +0 -11
  259. data/spec/unit/pops/serialization/to_from_hr_spec.rb +58 -0
  260. data/spec/unit/pops/serialization/to_stringified_spec.rb +5 -0
  261. data/spec/unit/pops/types/p_sem_ver_type_spec.rb +18 -0
  262. data/spec/unit/pops/types/p_sensitive_type_spec.rb +18 -0
  263. data/spec/unit/pops/types/type_calculator_spec.rb +6 -0
  264. data/spec/unit/provider/package/gem_spec.rb +1 -1
  265. data/spec/unit/provider/package/nim_spec.rb +42 -0
  266. data/spec/unit/provider/package/pip2_spec.rb +1 -1
  267. data/spec/unit/provider/package/pip3_spec.rb +1 -1
  268. data/spec/unit/provider/package/pip_spec.rb +38 -1
  269. data/spec/unit/provider/package/pkg_spec.rb +19 -5
  270. data/spec/unit/provider/package/puppet_gem_spec.rb +1 -1
  271. data/spec/unit/provider/package/puppetserver_gem_spec.rb +1 -1
  272. data/spec/unit/provider/package/windows/exe_package_spec.rb +17 -0
  273. data/spec/unit/provider/parsedfile_spec.rb +10 -0
  274. data/spec/unit/provider/service/freebsd_spec.rb +1 -1
  275. data/spec/unit/provider/service/launchd_spec.rb +11 -0
  276. data/spec/unit/provider/service/systemd_spec.rb +13 -1
  277. data/spec/unit/provider/user/aix_spec.rb +100 -0
  278. data/spec/unit/provider/user/directoryservice_spec.rb +68 -36
  279. data/spec/unit/provider/user/useradd_spec.rb +3 -2
  280. data/spec/unit/provider_spec.rb +4 -4
  281. data/spec/unit/puppet_spec.rb +12 -4
  282. data/spec/unit/resource/type_collection_spec.rb +16 -0
  283. data/spec/unit/resource/type_spec.rb +2 -2
  284. data/spec/unit/settings/config_file_spec.rb +1 -11
  285. data/spec/unit/settings/file_setting_spec.rb +10 -7
  286. data/spec/unit/settings/value_translator_spec.rb +4 -5
  287. data/spec/unit/settings_spec.rb +120 -79
  288. data/spec/unit/ssl/ssl_provider_spec.rb +18 -16
  289. data/spec/unit/type/exec_spec.rb +76 -29
  290. data/spec/unit/type/file/source_spec.rb +4 -4
  291. data/spec/unit/type/service_spec.rb +49 -34
  292. data/spec/unit/type/tidy_spec.rb +7 -0
  293. data/spec/unit/type/user_spec.rb +45 -0
  294. data/spec/unit/type_spec.rb +2 -2
  295. data/spec/unit/util/ldap/connection_spec.rb +10 -10
  296. data/spec/unit/util/ldap/manager_spec.rb +2 -2
  297. data/spec/unit/util/logging_spec.rb +2 -0
  298. data/spec/unit/util/windows/sid_spec.rb +39 -4
  299. data/spec/unit/util_spec.rb +1 -3
  300. data/spec/unit/x509/cert_provider_spec.rb +9 -1
  301. data/tasks/generate_cert_fixtures.rake +10 -1
  302. data/tasks/parallel.rake +3 -3
  303. metadata +53 -95
  304. data/ext/README.environment +0 -8
  305. data/ext/dbfix.sql +0 -132
  306. data/ext/debian/README.Debian +0 -8
  307. data/ext/debian/README.source +0 -2
  308. data/ext/debian/TODO.Debian +0 -1
  309. data/ext/debian/changelog.erb +0 -1122
  310. data/ext/debian/compat +0 -1
  311. data/ext/debian/control +0 -144
  312. data/ext/debian/copyright +0 -339
  313. data/ext/debian/docs +0 -1
  314. data/ext/debian/fileserver.conf +0 -41
  315. data/ext/debian/puppet-common.dirs +0 -13
  316. data/ext/debian/puppet-common.install +0 -3
  317. data/ext/debian/puppet-common.lintian-overrides +0 -5
  318. data/ext/debian/puppet-common.manpages +0 -28
  319. data/ext/debian/puppet-common.postinst +0 -35
  320. data/ext/debian/puppet-common.postrm +0 -33
  321. data/ext/debian/puppet-el.dirs +0 -1
  322. data/ext/debian/puppet-el.emacsen-install +0 -25
  323. data/ext/debian/puppet-el.emacsen-remove +0 -11
  324. data/ext/debian/puppet-el.emacsen-startup +0 -9
  325. data/ext/debian/puppet-el.install +0 -1
  326. data/ext/debian/puppet-testsuite.install +0 -2
  327. data/ext/debian/puppet-testsuite.lintian-overrides +0 -4
  328. data/ext/debian/puppet.lintian-overrides +0 -3
  329. data/ext/debian/puppet.logrotate +0 -20
  330. data/ext/debian/puppet.postinst +0 -20
  331. data/ext/debian/puppet.postrm +0 -20
  332. data/ext/debian/puppet.preinst +0 -20
  333. data/ext/debian/puppetmaster-common.install +0 -2
  334. data/ext/debian/puppetmaster-common.manpages +0 -2
  335. data/ext/debian/puppetmaster-common.postinst +0 -6
  336. data/ext/debian/puppetmaster-passenger.dirs +0 -4
  337. data/ext/debian/puppetmaster-passenger.postinst +0 -162
  338. data/ext/debian/puppetmaster-passenger.postrm +0 -61
  339. data/ext/debian/puppetmaster.README.debian +0 -17
  340. data/ext/debian/puppetmaster.default +0 -14
  341. data/ext/debian/puppetmaster.init +0 -137
  342. data/ext/debian/puppetmaster.lintian-overrides +0 -3
  343. data/ext/debian/puppetmaster.postinst +0 -20
  344. data/ext/debian/puppetmaster.postrm +0 -5
  345. data/ext/debian/puppetmaster.preinst +0 -22
  346. data/ext/debian/rules +0 -132
  347. data/ext/debian/source/format +0 -1
  348. data/ext/debian/source/options +0 -1
  349. data/ext/debian/vim-puppet.README.Debian +0 -13
  350. data/ext/debian/vim-puppet.dirs +0 -5
  351. data/ext/debian/vim-puppet.yaml +0 -7
  352. data/ext/debian/watch +0 -2
  353. data/ext/freebsd/puppetd +0 -26
  354. data/ext/freebsd/puppetmasterd +0 -26
  355. data/ext/gentoo/conf.d/puppet +0 -5
  356. data/ext/gentoo/conf.d/puppetmaster +0 -12
  357. data/ext/gentoo/init.d/puppet +0 -38
  358. data/ext/gentoo/init.d/puppetmaster +0 -51
  359. data/ext/gentoo/puppet/fileserver.conf +0 -41
  360. data/ext/ips/puppet-agent +0 -44
  361. data/ext/ips/puppet-master +0 -44
  362. data/ext/ips/puppet.p5m.erb +0 -12
  363. data/ext/ips/puppetagent.xml +0 -42
  364. data/ext/ips/puppetmaster.xml +0 -42
  365. data/ext/ips/rules +0 -19
  366. data/ext/ips/transforms +0 -34
  367. data/ext/ldap/puppet.schema +0 -24
  368. data/ext/logcheck/puppet +0 -23
  369. data/ext/osx/file_mapping.yaml +0 -28
  370. data/ext/osx/postflight.erb +0 -109
  371. data/ext/osx/preflight.erb +0 -52
  372. data/ext/osx/prototype.plist.erb +0 -38
  373. data/ext/redhat/fileserver.conf +0 -41
  374. data/ext/redhat/logrotate +0 -21
  375. data/ext/redhat/puppet.spec.erb +0 -841
  376. data/ext/redhat/server.init +0 -128
  377. data/ext/redhat/server.sysconfig +0 -13
  378. data/ext/solaris/pkginfo +0 -6
  379. data/ext/solaris/smf/puppetd.xml +0 -77
  380. data/ext/solaris/smf/puppetmasterd.xml +0 -77
  381. data/ext/solaris/smf/svc-puppetd +0 -71
  382. data/ext/solaris/smf/svc-puppetmasterd +0 -67
  383. data/ext/suse/puppet.spec +0 -310
  384. data/ext/suse/server.init +0 -173
  385. data/ext/yaml_nodes.rb +0 -105
  386. data/spec/unit/indirector/store_configs_spec.rb +0 -7
@@ -26,7 +26,7 @@ describe Puppet::Type.type(:package).provider(:pip2) do
26
26
  end
27
27
 
28
28
  context 'when is defaultfor' do
29
- let(:os) { Facter.value(:operatingsystem) }
29
+ let(:os) { Puppet.runtime[:facter].value(:operatingsystem) }
30
30
  subject do
31
31
  described_class.defaultfor(operatingsystem: os)
32
32
  described_class.specificity
@@ -26,7 +26,7 @@ describe Puppet::Type.type(:package).provider(:pip3) do
26
26
  end
27
27
 
28
28
  context 'when is defaultfor' do
29
- let(:os) { Facter.value(:operatingsystem) }
29
+ let(:os) { Puppet.runtime[:facter].value(:operatingsystem) }
30
30
  subject do
31
31
  described_class.defaultfor(operatingsystem: os)
32
32
  described_class.specificity
@@ -266,6 +266,43 @@ describe Puppet::Type.type(:package).provider(:pip) do
266
266
  let(:pip_version) { '1.5.4' }
267
267
  let(:pip_path) { '/fake/bin/pip' }
268
268
 
269
+ context "with pip version >= 20.3 and < 21.1" do
270
+ let(:pip_version) { '20.3.1' }
271
+ let(:pip_path) { '/fake/bin/pip' }
272
+
273
+ it "should use legacy-resolver argument" do
274
+ p = StringIO.new(
275
+ <<-EOS
276
+ Collecting real-package==versionplease
277
+ Could not find a version that satisfies the requirement real-package==versionplease (from versions: 1.1.3, 1.0, 1.9b1)
278
+ No matching distribution found for real-package==versionplease
279
+ EOS
280
+ )
281
+ expect(Puppet::Util::Execution).to receive(:execpipe).with(["/fake/bin/pip", "install", "real_package==versionplease",
282
+ "--use-deprecated=legacy-resolver"]).and_yield(p).once
283
+ @resource[:name] = "real_package"
284
+ @provider.latest
285
+ end
286
+ end
287
+
288
+ context "with pip version >= 21.1" do
289
+ let(:pip_version) { '21.1' }
290
+ let(:pip_path) { '/fake/bin/pip' }
291
+
292
+ it "should not use legacy-resolver argument" do
293
+ p = StringIO.new(
294
+ <<-EOS
295
+ Collecting real-package==versionplease
296
+ Could not find a version that satisfies the requirement real-package==versionplease (from versions: 1.1.3, 1.0, 1.9b1)
297
+ No matching distribution found for real-package==versionplease
298
+ EOS
299
+ )
300
+ expect(Puppet::Util::Execution).to receive(:execpipe).with(["/fake/bin/pip", "install", "real_package==versionplease"]).and_yield(p).once
301
+ @resource[:name] = "real_package"
302
+ @provider.latest
303
+ end
304
+ end
305
+
269
306
  it "should find a version number for real_package" do
270
307
  p = StringIO.new(
271
308
  <<-EOS
@@ -456,7 +493,7 @@ describe Puppet::Type.type(:package).provider(:pip) do
456
493
  end
457
494
 
458
495
  context 'when is defaultfor' do
459
- let(:os) { Facter.value(:operatingsystem) }
496
+ let(:os) { Puppet.runtime[:facter].value(:operatingsystem) }
460
497
  subject do
461
498
  described_class.defaultfor(operatingsystem: os)
462
499
  described_class.specificity
@@ -342,14 +342,17 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
342
342
  resource[:ensure] = '1.0-0.151006'
343
343
  is = :absent
344
344
  expect(provider).to receive(:query).with(no_args).and_return({:ensure => is})
345
- expect(provider).to receive(:properties).and_return({:mark => :hold})
345
+ expect(provider).to receive(:properties).and_return({:mark => :hold}).exactly(3).times
346
+
347
+ expect(described_class).to receive(:pkg)
348
+ .with(:freeze, 'dummy')
346
349
  expect(described_class).to receive(:pkg)
347
350
  .with(:list, '-Hvfa', 'dummy@1.0-0.151006')
348
351
  .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0))
349
352
  expect(Puppet::Util::Execution).to receive(:execute)
350
353
  .with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
351
354
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
352
- expect(provider).to receive(:unhold).with(no_args)
355
+ expect(provider).to receive(:unhold).with(no_args).twice
353
356
  expect(Puppet::Util::Execution).to receive(:execute)
354
357
  .with(['/bin/pkg', 'install', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
355
358
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
@@ -361,12 +364,17 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
361
364
  resource[:ensure] = '1.0-0.151006'
362
365
  is = '1.0,5.11-0.151006:20140219T191204Z'
363
366
  expect(provider).to receive(:query).with(no_args).and_return({:ensure => is})
364
- expect(provider).to receive(:properties).and_return({:mark => :hold})
365
- expect(described_class).to receive(:pkg).with(:list, '-Hvfa', 'dummy@1.0-0.151006').and_return(File.read(my_fixture('dummy_implicit_version')))
367
+ expect(provider).to receive(:properties).and_return({:mark => :hold}).exactly(3).times
368
+
369
+ expect(described_class).to receive(:pkg)
370
+ .with(:freeze, 'dummy')
371
+ expect(described_class).to receive(:pkg)
372
+ .with(:list, '-Hvfa', 'dummy@1.0-0.151006')
373
+ .and_return(File.read(my_fixture('dummy_implicit_version')))
366
374
  expect(Puppet::Util::Execution).to receive(:execute)
367
375
  .with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
368
376
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
369
- expect(provider).to receive(:unhold).with(no_args)
377
+ expect(provider).to receive(:unhold).with(no_args).twice
370
378
  expect(Puppet::Util::Execution).to receive(:execute)
371
379
  .with(['/bin/pkg', 'update', *hash[:flags], 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
372
380
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
@@ -381,6 +389,9 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
381
389
  expect(described_class).to receive(:pkg)
382
390
  .with(:list, '-Hvfa', 'dummy@1.0-0.151006')
383
391
  .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0))
392
+ expect(Puppet::Util::Execution).to receive(:execute)
393
+ .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
394
+ .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0))
384
395
  expect(Puppet::Util::Execution).to receive(:execute)
385
396
  .with(['/bin/pkg', 'update', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
386
397
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 4))
@@ -395,6 +406,9 @@ describe Puppet::Type.type(:package).provider(:pkg), unless: Puppet::Util::Platf
395
406
  expect(described_class).to receive(:pkg)
396
407
  .with(:list, '-Hvfa', 'dummy@1.0-0.151006')
397
408
  .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0))
409
+ expect(Puppet::Util::Execution).to receive(:execute)
410
+ .with(['/bin/pkg', 'list', '-Hv', 'dummy'], {:failonfail => false, :combine => true})
411
+ .and_return(Puppet::Util::Execution::ProcessOutput.new(File.read(my_fixture('dummy_implicit_version')), 0))
398
412
  expect(Puppet::Util::Execution).to receive(:execute)
399
413
  .with(['/bin/pkg', 'install', '-n', 'dummy@1.0,5.11-0.151006:20140220T084443Z'], {:failonfail => false, :combine => true})
400
414
  .and_return(Puppet::Util::Execution::ProcessOutput.new('', 0))
@@ -118,7 +118,7 @@ describe Puppet::Type.type(:package).provider(:puppet_gem) do
118
118
  end
119
119
 
120
120
  context 'when is defaultfor' do
121
- let(:os) { Facter.value(:operatingsystem) }
121
+ let(:os) { Puppet.runtime[:facter].value(:operatingsystem) }
122
122
  subject do
123
123
  described_class.defaultfor(operatingsystem: os)
124
124
  described_class.specificity
@@ -127,7 +127,7 @@ describe Puppet::Type.type(:package).provider(:puppetserver_gem) do
127
127
  end
128
128
 
129
129
  context 'when is defaultfor' do
130
- let(:os) { Facter.value(:operatingsystem) }
130
+ let(:os) { Puppet.runtime[:facter].value(:operatingsystem) }
131
131
  subject do
132
132
  described_class.defaultfor(operatingsystem: os)
133
133
  described_class.specificity
@@ -1,5 +1,6 @@
1
1
  require 'spec_helper'
2
2
  require 'puppet/provider/package/windows/exe_package'
3
+ require 'puppet/provider/package/windows'
3
4
 
4
5
  describe Puppet::Provider::Package::Windows::ExePackage do
5
6
  let (:name) { 'Git version 1.7.11' }
@@ -71,10 +72,26 @@ describe Puppet::Provider::Package::Windows::ExePackage do
71
72
 
72
73
  context '#install_command' do
73
74
  it 'should install using the source' do
75
+ allow(Puppet::FileSystem).to receive(:exist?).with(source).and_return(true)
74
76
  cmd = described_class.install_command({:source => source})
75
77
 
76
78
  expect(cmd).to eq(source)
77
79
  end
80
+
81
+ it 'should raise error when URI is invalid' do
82
+ web_source = 'https://www.t e s t.test/test.exe'
83
+
84
+ expect do
85
+ described_class.install_command({:source => web_source, :name => name})
86
+ end.to raise_error(Puppet::Error, /Error when installing #{name}:/)
87
+ end
88
+
89
+ it 'should download package from source file before installing', if: Puppet::Util::Platform.windows? do
90
+ web_source = 'https://www.test.test/test.exe'
91
+ stub_request(:get, web_source).to_return(status: 200, body: 'package binaries')
92
+ cmd = described_class.install_command({:source => web_source})
93
+ expect(File.read(cmd)).to eq('package binaries')
94
+ end
78
95
  end
79
96
 
80
97
  context '#uninstall_command' do
@@ -79,6 +79,16 @@ describe Puppet::Provider::ParsedFile do
79
79
 
80
80
  provider.instances
81
81
  end
82
+
83
+ it "should raise if parsing returns nil" do
84
+ expect(provider).to receive(:targets).and_return(%w{/one})
85
+ expect_any_instance_of(Puppet::Util::FileType::FileTypeFlat).to receive(:read).and_return('a=b')
86
+ expect(provider).to receive(:parse).and_return(nil)
87
+
88
+ expect {
89
+ provider.instances
90
+ }.to raise_error(Puppet::DevError, %r{Prefetching /one for provider parsedfile_provider returned nil})
91
+ end
82
92
  end
83
93
 
84
94
  describe "when matching resources to existing records" do
@@ -82,7 +82,7 @@ OUTPUT
82
82
  allow(Puppet::FileSystem).to receive(:exist?).with('/etc/rc.conf').and_return(true)
83
83
  allow(File).to receive(:read).with('/etc/rc.conf').and_return("openntpd_enable=\"NO\"\nntpd_enable=\"NO\"\n")
84
84
  fh = double('fh')
85
- allow(File).to receive(:open).with('/etc/rc.conf', File::WRONLY).and_yield(fh)
85
+ allow(Puppet::FileSystem).to receive(:replace_file).with('/etc/rc.conf').and_yield(fh)
86
86
  expect(fh).to receive(:<<).with("openntpd_enable=\"NO\"\nntpd_enable=\"YES\"\n")
87
87
  allow(Puppet::FileSystem).to receive(:exist?).with('/etc/rc.conf.local').and_return(false)
88
88
  allow(Puppet::FileSystem).to receive(:exist?).with('/etc/rc.conf.d/ntpd').and_return(false)
@@ -325,6 +325,7 @@ describe 'Puppet::Type::Service::Provider::Launchd',
325
325
  'LimitLoadToSessionType' => 'Aqua'
326
326
  }
327
327
  end
328
+ let(:plist_without_label_not_hash) { 'just a string' }
328
329
  let(:busted_plist_path) { '/Library/LaunchAgents/org.busted.plist' }
329
330
  let(:binary_plist_path) { '/Library/LaunchAgents/org.binary.plist' }
330
331
 
@@ -336,6 +337,16 @@ describe 'Puppet::Type::Service::Provider::Launchd',
336
337
  expect(Puppet).to receive(:debug).with("The #{busted_plist_path} plist does not contain a 'label' key; Puppet is skipping it")
337
338
  provider.make_label_to_path_map
338
339
  end
340
+
341
+ it "it should warn that the malformed plist in question is being skipped" do
342
+ expect(provider).to receive(:launchd_paths).and_return(['/Library/LaunchAgents'])
343
+ expect(provider).to receive(:return_globbed_list_of_file_paths).with('/Library/LaunchAgents').and_return([busted_plist_path])
344
+ expect(plistlib).to receive(:read_plist_file).with(busted_plist_path).and_return(plist_without_label_not_hash)
345
+ expect(Puppet).to receive(:debug).with("Reading launchd plist #{busted_plist_path}")
346
+ expect(Puppet).to receive(:debug).with("The #{busted_plist_path} plist does not contain a 'label' key; Puppet is skipping it")
347
+ provider.make_label_to_path_map
348
+ end
349
+
339
350
  end
340
351
 
341
352
  it "should return the cached value when available" do
@@ -29,7 +29,7 @@ describe 'Puppet::Type::Service::Provider::Systemd',
29
29
  end
30
30
  end
31
31
 
32
- [7, 8].each do |ver|
32
+ [7, 8, 9].each do |ver|
33
33
  it "should be the default provider on rhel#{ver}" do
34
34
  allow(Facter).to receive(:value).with(:osfamily).and_return(:redhat)
35
35
  allow(Facter).to receive(:value).with(:operatingsystem).and_return(:redhat)
@@ -362,6 +362,9 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
362
362
  describe "#mask" do
363
363
  it "should run systemctl to disable and mask a service" do
364
364
  provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'sshd.service'))
365
+ expect(provider).to receive(:execute).
366
+ with(['/bin/systemctl','cat', '--', 'sshd.service'], :failonfail => false).
367
+ and_return(Puppet::Util::Execution::ProcessOutput.new("# /lib/systemd/system/sshd.service\n...", 0))
365
368
  # :disable is the only call in the provider that uses a symbol instead of
366
369
  # a string.
367
370
  # This should be made consistent in the future and all tests updated.
@@ -369,6 +372,15 @@ Jun 14 21:43:23 foo.example.com systemd[1]: sshd.service lacks both ExecStart= a
369
372
  expect(provider).to receive(:systemctl).with(:mask, '--', 'sshd.service')
370
373
  provider.mask
371
374
  end
375
+
376
+ it "masks a service that doesn't exist" do
377
+ provider = provider_class.new(Puppet::Type.type(:service).new(:name => 'doesnotexist.service'))
378
+ expect(provider).to receive(:execute).
379
+ with(['/bin/systemctl','cat', '--', 'doesnotexist.service'], :failonfail => false).
380
+ and_return(Puppet::Util::Execution::ProcessOutput.new("No files found for doesnotexist.service.\n", 1))
381
+ expect(provider).to receive(:systemctl).with(:mask, '--', 'doesnotexist.service')
382
+ provider.mask
383
+ end
372
384
  end
373
385
 
374
386
  # Note: systemd provider does not care about hasstatus or a custom status
@@ -217,4 +217,104 @@ describe 'Puppet::Type::User::Provider::Aix' do
217
217
  provider.create
218
218
  end
219
219
  end
220
+
221
+ describe '#list_all_homes' do
222
+ it "should return empty array and output debug on failure" do
223
+ allow(Puppet::Util::Execution).to receive(:execute).and_raise(Puppet::ExecutionFailure, 'Execution failed')
224
+ expect(Puppet).to receive(:debug).with('Could not list home of all users: Execution failed')
225
+ expect(provider.list_all_homes).to eql({})
226
+ end
227
+ end
228
+
229
+ describe '#delete' do
230
+ before(:each) do
231
+ allow(File).to receive(:realpath).and_call_original
232
+ allow(FileUtils).to receive(:remove_entry_secure).and_call_original
233
+
234
+ allow(provider.resource).to receive(:should).with(anything).and_return(nil)
235
+ allow(provider).to receive(:home).and_return(Dir.tmpdir)
236
+ allow(provider).to receive(:execute).and_return(nil)
237
+ allow(provider).to receive(:object_info).and_return(nil)
238
+ allow(FileUtils).to receive(:remove_entry_secure).with(Dir.tmpdir, true).and_return(nil)
239
+ end
240
+
241
+ context 'with managehome true' do
242
+ before(:each) do
243
+ allow(provider.resource).to receive(:managehome?).and_return(true)
244
+ allow(provider).to receive(:list_all_homes).and_return([])
245
+ end
246
+
247
+ it 'should delete the user without error' do
248
+ expect{ provider.delete }.not_to raise_error
249
+ end
250
+
251
+ it "should not remove home when relative" do
252
+ allow(provider).to receive(:home).and_return('relative_path')
253
+
254
+ expect(Puppet).to receive(:debug).with(/Please make sure the path is not relative, symlink or '\/'./)
255
+ provider.delete
256
+ end
257
+
258
+ it "should not remove home when '/'" do
259
+ allow(provider).to receive(:home).and_return('/')
260
+
261
+ expect(Puppet).to receive(:debug).with(/Please make sure the path is not relative, symlink or '\/'./)
262
+ provider.delete
263
+ end
264
+
265
+ it "should not remove home when symlink" do
266
+ allow(Puppet::FileSystem).to receive(:symlink?).with(Dir.tmpdir).and_return(true)
267
+
268
+ expect(Puppet).to receive(:debug).with(/Please make sure the path is not relative, symlink or '\/'./)
269
+ provider.delete
270
+ end
271
+
272
+ it "should not remove home when other users would be affected" do
273
+ allow(provider).to receive(:home).and_return('/special')
274
+ allow(File).to receive(:realpath).with('/special').and_return('/special')
275
+ allow(Puppet::Util).to receive(:absolute_path?).with('/special').and_return(true)
276
+ allow(provider).to receive(:list_all_homes).and_return([{:name => 'other_user', :home => '/special/other_user'}])
277
+
278
+ expect(Puppet).to receive(:debug).with(/it would remove the home directory '\/special\/other_user' of user 'other_user' also./)
279
+ provider.delete
280
+ end
281
+
282
+ it 'should remove homedir' do
283
+ expect(FileUtils).to receive(:remove_entry_secure).with(Dir.tmpdir, true)
284
+ provider.delete
285
+ end
286
+ end
287
+
288
+ context 'with managehome false' do
289
+ before(:each) do
290
+ allow(provider.resource).to receive(:managehome?).and_return(false)
291
+ end
292
+
293
+ it 'should delete the user without error' do
294
+ expect{ provider.delete }.not_to raise_error
295
+ end
296
+
297
+ it 'should not remove homedir' do
298
+ expect(FileUtils).not_to receive(:remove_entry_secure).with(Dir.tmpdir, true)
299
+ end
300
+
301
+ it 'should not print manage home debug messages' do
302
+ expect(Puppet).not_to receive(:debug).with(/Please make sure the path is not relative, symlink or '\/'./)
303
+ expect(Puppet).not_to receive(:debug).with(/it would remove the home directory '\/special\/other_user' of user 'other_user' also./)
304
+
305
+ provider.delete
306
+ end
307
+ end
308
+ end
309
+
310
+ describe '#deletecmd' do
311
+ it 'uses the -p flag when removing the user' do
312
+ allow(provider.class).to receive(:command).with(:delete).and_return('delete')
313
+ allow(provider).to receive(:ia_module_args).and_return(['ia_module_args'])
314
+
315
+ expect(provider.deletecmd).to eql(
316
+ ['delete', '-p', 'ia_module_args', provider.resource.name]
317
+ )
318
+ end
319
+ end
220
320
  end
@@ -925,28 +925,75 @@ end
925
925
  }
926
926
  end
927
927
 
928
- it 'should call set_salted_sha512 on 10.7 when given a salted-SHA512 password hash' do
929
- expect(provider).to receive(:get_users_plist).and_return(sample_users_plist)
930
- expect(provider).to receive(:get_shadow_hash_data).with(sample_users_plist).and_return(sha512_shadowhashdata)
931
- expect(provider.class).to receive(:get_os_version).and_return('10.7')
932
- expect(provider).to receive(:set_salted_sha512).with(sample_users_plist, sha512_shadowhashdata, sha512_password_hash)
933
- provider.write_password_to_users_plist(sha512_password_hash)
928
+ before do
929
+ allow(provider).to receive(:merge_attribute_with_dscl).with('Users', username, 'AuthenticationAuthority', any_args)
934
930
  end
935
931
 
936
- it 'should call set_salted_pbkdf2 on 10.8 when given a PBKDF2 password hash' do
937
- expect(provider).to receive(:get_users_plist).and_return(sample_users_plist)
938
- expect(provider).to receive(:get_shadow_hash_data).with(sample_users_plist).and_return(pbkdf2_shadowhashdata)
939
- expect(provider.class).to receive(:get_os_version).and_return('10.8')
940
- expect(provider).to receive(:set_salted_pbkdf2).with(sample_users_plist, pbkdf2_shadowhashdata, 'entropy', pbkdf2_password_hash)
941
- provider.write_password_to_users_plist(pbkdf2_password_hash)
932
+ describe 'when on macOS 11 (Big Sur) or greater' do
933
+ before do
934
+ allow(provider.class).to receive(:get_os_version).and_return('11.0.0')
935
+ end
936
+
937
+ it 'should add salted_sha512_pbkdf2 AuthenticationAuthority key if missing' do
938
+ expect(provider).to receive(:get_users_plist).and_return(sample_users_plist)
939
+ expect(provider).to receive(:get_shadow_hash_data).with(sample_users_plist).and_return(pbkdf2_shadowhashdata)
940
+ expect(provider).to receive(:set_salted_pbkdf2).with(sample_users_plist, pbkdf2_shadowhashdata, 'entropy', pbkdf2_password_hash)
941
+ expect(provider).to receive(:needs_sha512_pbkdf2_authentication_authority_to_be_added?).and_return(true)
942
+
943
+ expect(Puppet).to receive(:debug).with("Adding 'SALTED-SHA512-PBKDF2' AuthenticationAuthority key for ShadowHash to user 'nonexistent_user'")
944
+ provider.write_password_to_users_plist(pbkdf2_password_hash)
945
+ end
946
+
947
+ it 'should not add salted_sha512_pbkdf2 AuthenticationAuthority key if not missing' do
948
+ expect(provider).to receive(:get_users_plist).and_return(sample_users_plist)
949
+ expect(provider).to receive(:get_shadow_hash_data).with(sample_users_plist).and_return(pbkdf2_shadowhashdata)
950
+ expect(provider).to receive(:set_salted_pbkdf2).with(sample_users_plist, pbkdf2_shadowhashdata, 'entropy', pbkdf2_password_hash)
951
+ expect(provider).to receive(:needs_sha512_pbkdf2_authentication_authority_to_be_added?).and_return(false)
952
+
953
+ expect(Puppet).not_to receive(:debug).with("Adding 'SALTED-SHA512-PBKDF2' AuthenticationAuthority key for ShadowHash to user 'nonexistent_user'")
954
+ provider.write_password_to_users_plist(pbkdf2_password_hash)
955
+ end
942
956
  end
943
957
 
944
- it "should delete the SALTED-SHA512 key in the shadow_hash_data hash if it exists on a 10.8 system and write_password_to_users_plist has been called to set the user's password" do
945
- expect(provider).to receive(:get_users_plist).and_return('users_plist')
946
- expect(provider).to receive(:get_shadow_hash_data).with('users_plist').and_return(sha512_shadowhashdata)
947
- expect(provider.class).to receive(:get_os_version).and_return('10.8')
948
- expect(provider).to receive(:set_salted_pbkdf2).with('users_plist', {}, 'entropy', pbkdf2_password_hash)
949
- provider.write_password_to_users_plist(pbkdf2_password_hash)
958
+ describe 'when on macOS version lower than 11' do
959
+ before do
960
+ allow(provider.class).to receive(:get_os_version)
961
+ allow(provider).to receive(:needs_sha512_pbkdf2_authentication_authority_to_be_added?).and_return(false)
962
+ end
963
+
964
+ it 'should not add salted_sha512_pbkdf2 AuthenticationAuthority' do
965
+ expect(provider).to receive(:get_users_plist).and_return(sample_users_plist)
966
+ expect(provider).to receive(:get_shadow_hash_data).with(sample_users_plist).and_return(pbkdf2_shadowhashdata)
967
+ expect(provider).to receive(:set_salted_pbkdf2).with(sample_users_plist, pbkdf2_shadowhashdata, 'entropy', pbkdf2_password_hash)
968
+ expect(provider).to receive(:needs_sha512_pbkdf2_authentication_authority_to_be_added?).and_return(false)
969
+
970
+ expect(Puppet).not_to receive(:debug).with("Adding 'SALTED-SHA512-PBKDF2' AuthenticationAuthority key for ShadowHash to user 'nonexistent_user'")
971
+ provider.write_password_to_users_plist(pbkdf2_password_hash)
972
+ end
973
+
974
+ it 'should call set_salted_sha512 on 10.7 when given a salted-SHA512 password hash' do
975
+ expect(provider).to receive(:get_users_plist).and_return(sample_users_plist)
976
+ expect(provider).to receive(:get_shadow_hash_data).with(sample_users_plist).and_return(sha512_shadowhashdata)
977
+ expect(provider.class).to receive(:get_os_version).and_return('10.7')
978
+ expect(provider).to receive(:set_salted_sha512).with(sample_users_plist, sha512_shadowhashdata, sha512_password_hash)
979
+ provider.write_password_to_users_plist(sha512_password_hash)
980
+ end
981
+
982
+ it 'should call set_salted_pbkdf2 on 10.8 when given a PBKDF2 password hash' do
983
+ expect(provider).to receive(:get_users_plist).and_return(sample_users_plist)
984
+ expect(provider).to receive(:get_shadow_hash_data).with(sample_users_plist).and_return(pbkdf2_shadowhashdata)
985
+ expect(provider.class).to receive(:get_os_version).and_return('10.8')
986
+ expect(provider).to receive(:set_salted_pbkdf2).with(sample_users_plist, pbkdf2_shadowhashdata, 'entropy', pbkdf2_password_hash)
987
+ provider.write_password_to_users_plist(pbkdf2_password_hash)
988
+ end
989
+
990
+ it "should delete the SALTED-SHA512 key in the shadow_hash_data hash if it exists on a 10.8 system and write_password_to_users_plist has been called to set the user's password" do
991
+ expect(provider).to receive(:get_users_plist).and_return('users_plist')
992
+ expect(provider).to receive(:get_shadow_hash_data).with('users_plist').and_return(sha512_shadowhashdata)
993
+ expect(provider.class).to receive(:get_os_version).and_return('10.8')
994
+ expect(provider).to receive(:set_salted_pbkdf2).with('users_plist', {}, 'entropy', pbkdf2_password_hash)
995
+ provider.write_password_to_users_plist(pbkdf2_password_hash)
996
+ end
950
997
  end
951
998
  end
952
999
 
@@ -974,16 +1021,7 @@ end
974
1021
  describe '#set_shadow_hash_data' do
975
1022
  let(:users_plist) { {'ShadowHashData' => ['string_data'] } }
976
1023
 
977
- it 'should flush the plist data to disk on OS X < 10.15' do
978
- allow(provider.class).to receive(:get_os_version).and_return('10.12')
979
-
980
- expect(provider).to receive(:write_users_plist_to_disk)
981
- provider.set_shadow_hash_data(users_plist, pbkdf2_embedded_plist)
982
- end
983
-
984
- it 'should flush the plist data a temporary file on OS X >= 10.15' do
985
- allow(provider.class).to receive(:get_os_version).and_return('10.15')
986
-
1024
+ it 'should flush the plist data to a temporary file' do
987
1025
  expect(provider).to receive(:write_and_import_shadow_hash_data)
988
1026
  provider.set_shadow_hash_data(users_plist, pbkdf2_embedded_plist)
989
1027
  end
@@ -1033,13 +1071,6 @@ end
1033
1071
  end
1034
1072
  end
1035
1073
 
1036
- describe '#write_users_plist_to_disk' do
1037
- it 'should save the passed plist to disk and convert it to a binary plist' do
1038
- expect(Puppet::Util::Plist).to receive(:write_plist_file).with(user_plist_xml, "#{users_plist_dir}/nonexistent_user.plist", :binary)
1039
- provider.write_users_plist_to_disk(user_plist_xml)
1040
- end
1041
- end
1042
-
1043
1074
  describe '#write_and_import_shadow_hash_data' do
1044
1075
  it 'should save the passed plist to a temporary file and import it' do
1045
1076
  tmpfile = double('tempfile', :path => "/tmp/dsimport_#{username}", :flush => nil)
@@ -1111,7 +1142,7 @@ end
1111
1142
  provider.class.instance_variable_set(:@os_version, nil) if provider.class.instance_variable_defined? :@os_version
1112
1143
  end
1113
1144
 
1114
- it 'should call Facter.value(:macosx_productversion_major) ONLY ONCE no matter how ' +
1145
+ it 'should call Puppet.runtime[:facter].value(:macosx_productversion_major) ONLY ONCE no matter how ' +
1115
1146
  'many times get_os_version() is called' do
1116
1147
  expect(Facter).to receive(:value).with(:macosx_productversion_major).once.and_return('10.8')
1117
1148
  expect(provider.class.get_os_version).to eq('10.8')
@@ -1203,6 +1234,7 @@ end
1203
1234
  before :each do
1204
1235
  allow(provider.class).to receive(:get_all_users).and_return(all_users_hash)
1205
1236
  allow(provider.class).to receive(:get_list_of_groups).and_return(group_plist_hash_guid)
1237
+ allow(provider).to receive(:merge_attribute_with_dscl).with('Users', username, 'AuthenticationAuthority', any_args)
1206
1238
  provider.class.prefetch({})
1207
1239
  end
1208
1240