puppet 6.17.0-x64-mingw32 → 6.21.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 (401) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +2 -16
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +38 -34
  5. data/README.md +1 -2
  6. data/Rakefile +4 -12
  7. data/lib/puppet/agent/locker.rb +0 -7
  8. data/lib/puppet/application.rb +10 -6
  9. data/lib/puppet/application/agent.rb +9 -3
  10. data/lib/puppet/application/apply.rb +20 -21
  11. data/lib/puppet/application/device.rb +1 -0
  12. data/lib/puppet/application/doc.rb +1 -1
  13. data/lib/puppet/application/filebucket.rb +2 -2
  14. data/lib/puppet/application/lookup.rb +16 -4
  15. data/lib/puppet/application/script.rb +1 -0
  16. data/lib/puppet/application_support.rb +7 -0
  17. data/lib/puppet/configurer.rb +50 -8
  18. data/lib/puppet/configurer/downloader.rb +31 -10
  19. data/lib/puppet/confine.rb +1 -1
  20. data/lib/puppet/confine/any.rb +1 -1
  21. data/lib/puppet/defaults.rb +88 -38
  22. data/lib/puppet/environments.rb +84 -59
  23. data/lib/puppet/face/catalog.rb +1 -1
  24. data/lib/puppet/face/config.rb +56 -16
  25. data/lib/puppet/face/epp.rb +12 -2
  26. data/lib/puppet/face/facts.rb +60 -0
  27. data/lib/puppet/face/node.rb +3 -3
  28. data/lib/puppet/face/node/clean.rb +2 -2
  29. data/lib/puppet/face/status.rb +1 -1
  30. data/lib/puppet/feature/base.rb +1 -1
  31. data/lib/puppet/ffi/posix.rb +10 -0
  32. data/lib/puppet/ffi/posix/constants.rb +14 -0
  33. data/lib/puppet/ffi/posix/functions.rb +24 -0
  34. data/lib/puppet/file_bucket/dipper.rb +1 -1
  35. data/lib/puppet/file_serving/mount/locales.rb +1 -2
  36. data/lib/puppet/file_serving/mount/pluginfacts.rb +1 -2
  37. data/lib/puppet/file_serving/mount/plugins.rb +1 -2
  38. data/lib/puppet/file_system/file_impl.rb +3 -3
  39. data/lib/puppet/functions/epp.rb +1 -0
  40. data/lib/puppet/functions/inline_epp.rb +1 -0
  41. data/lib/puppet/functions/lstrip.rb +4 -4
  42. data/lib/puppet/functions/new.rb +8 -3
  43. data/lib/puppet/functions/reverse_each.rb +1 -1
  44. data/lib/puppet/functions/rstrip.rb +4 -4
  45. data/lib/puppet/functions/step.rb +1 -1
  46. data/lib/puppet/functions/strip.rb +4 -4
  47. data/lib/puppet/gettext/config.rb +5 -5
  48. data/lib/puppet/gettext/module_translations.rb +4 -4
  49. data/lib/puppet/http.rb +1 -0
  50. data/lib/puppet/http/client.rb +1 -1
  51. data/lib/puppet/http/resolver.rb +5 -8
  52. data/lib/puppet/http/resolver/server_list.rb +18 -36
  53. data/lib/puppet/http/resolver/settings.rb +4 -4
  54. data/lib/puppet/http/resolver/srv.rb +5 -5
  55. data/lib/puppet/http/service.rb +3 -1
  56. data/lib/puppet/http/service/compiler.rb +1 -1
  57. data/lib/puppet/http/service/file_server.rb +1 -1
  58. data/lib/puppet/http/service/puppetserver.rb +39 -0
  59. data/lib/puppet/http/session.rb +5 -4
  60. data/lib/puppet/indirector/catalog/compiler.rb +1 -1
  61. data/lib/puppet/indirector/exec.rb +1 -1
  62. data/lib/puppet/indirector/fact_search.rb +60 -0
  63. data/lib/puppet/indirector/facts/facter.rb +3 -3
  64. data/lib/puppet/indirector/facts/json.rb +27 -0
  65. data/lib/puppet/indirector/facts/yaml.rb +4 -59
  66. data/lib/puppet/indirector/file_metadata/http.rb +1 -0
  67. data/lib/puppet/indirector/hiera.rb +4 -0
  68. data/lib/puppet/indirector/indirection.rb +1 -1
  69. data/lib/puppet/indirector/json.rb +5 -1
  70. data/lib/puppet/indirector/msgpack.rb +1 -1
  71. data/lib/puppet/indirector/node/json.rb +8 -0
  72. data/lib/puppet/indirector/report/json.rb +34 -0
  73. data/lib/puppet/indirector/report/processor.rb +2 -2
  74. data/lib/puppet/indirector/request.rb +4 -4
  75. data/lib/puppet/indirector/yaml.rb +1 -1
  76. data/lib/puppet/module.rb +1 -2
  77. data/lib/puppet/module_tool/applications/installer.rb +48 -2
  78. data/lib/puppet/module_tool/errors/shared.rb +17 -2
  79. data/lib/puppet/network/format_support.rb +2 -2
  80. data/lib/puppet/network/formats.rb +2 -1
  81. data/lib/puppet/network/http/api/master/v3/environments.rb +0 -1
  82. data/lib/puppet/network/http/route.rb +2 -2
  83. data/lib/puppet/node/environment.rb +12 -5
  84. data/lib/puppet/node/facts.rb +17 -0
  85. data/lib/puppet/pal/pal_impl.rb +90 -13
  86. data/lib/puppet/parameter.rb +1 -1
  87. data/lib/puppet/parser/ast/leaf.rb +3 -2
  88. data/lib/puppet/parser/functions.rb +21 -17
  89. data/lib/puppet/parser/functions/create_resources.rb +11 -7
  90. data/lib/puppet/parser/templatewrapper.rb +1 -1
  91. data/lib/puppet/parser/type_loader.rb +2 -2
  92. data/lib/puppet/pops/adaptable.rb +7 -13
  93. data/lib/puppet/pops/adapters.rb +8 -4
  94. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -3
  95. data/lib/puppet/pops/evaluator/deferred_resolver.rb +5 -3
  96. data/lib/puppet/pops/evaluator/evaluator_impl.rb +22 -3
  97. data/lib/puppet/pops/evaluator/runtime3_converter.rb +2 -2
  98. data/lib/puppet/pops/loader/runtime3_type_loader.rb +4 -2
  99. data/lib/puppet/pops/loaders.rb +18 -11
  100. data/lib/puppet/pops/lookup/context.rb +1 -1
  101. data/lib/puppet/pops/lookup/hiera_config.rb +14 -1
  102. data/lib/puppet/pops/model/ast_transformer.rb +1 -1
  103. data/lib/puppet/pops/types/iterable.rb +34 -8
  104. data/lib/puppet/pops/types/p_meta_type.rb +1 -1
  105. data/lib/puppet/pops/types/p_type_set_type.rb +4 -0
  106. data/lib/puppet/pops/validation/checker4_0.rb +19 -15
  107. data/lib/puppet/property/list.rb +1 -1
  108. data/lib/puppet/provider/file/windows.rb +1 -1
  109. data/lib/puppet/provider/group/groupadd.rb +13 -8
  110. data/lib/puppet/provider/package/apt.rb +67 -1
  111. data/lib/puppet/provider/package/aptitude.rb +6 -0
  112. data/lib/puppet/provider/package/dpkg.rb +1 -1
  113. data/lib/puppet/provider/package/gem.rb +4 -2
  114. data/lib/puppet/provider/package/pip2.rb +17 -0
  115. data/lib/puppet/provider/package/puppet_gem.rb +5 -0
  116. data/lib/puppet/provider/package/puppetserver_gem.rb +180 -0
  117. data/lib/puppet/provider/package/yum.rb +1 -0
  118. data/lib/puppet/provider/package/zypper.rb +3 -0
  119. data/lib/puppet/provider/service/debian.rb +2 -0
  120. data/lib/puppet/provider/user/aix.rb +3 -3
  121. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  122. data/lib/puppet/provider/user/useradd.rb +55 -8
  123. data/lib/puppet/provider/user/windows_adsi.rb +18 -1
  124. data/lib/puppet/reference/configuration.rb +6 -5
  125. data/lib/puppet/resource/type.rb +2 -1
  126. data/lib/puppet/rest/route.rb +2 -2
  127. data/lib/puppet/settings.rb +63 -21
  128. data/lib/puppet/settings/alias_setting.rb +37 -0
  129. data/lib/puppet/settings/base_setting.rb +26 -2
  130. data/lib/puppet/ssl/validator/default_validator.rb +1 -1
  131. data/lib/puppet/test/test_helper.rb +10 -3
  132. data/lib/puppet/transaction.rb +2 -2
  133. data/lib/puppet/transaction/persistence.rb +1 -1
  134. data/lib/puppet/transaction/report.rb +12 -8
  135. data/lib/puppet/trusted_external.rb +2 -2
  136. data/lib/puppet/type.rb +4 -3
  137. data/lib/puppet/type/file.rb +2 -2
  138. data/lib/puppet/type/file/source.rb +28 -8
  139. data/lib/puppet/type/filebucket.rb +1 -1
  140. data/lib/puppet/type/notify.rb +2 -2
  141. data/lib/puppet/type/package.rb +3 -3
  142. data/lib/puppet/type/service.rb +4 -0
  143. data/lib/puppet/type/user.rb +18 -3
  144. data/lib/puppet/util.rb +26 -12
  145. data/lib/puppet/util/autoload.rb +10 -15
  146. data/lib/puppet/util/character_encoding.rb +9 -5
  147. data/lib/puppet/util/connection.rb +8 -8
  148. data/lib/puppet/util/execution.rb +2 -2
  149. data/lib/puppet/util/fact_dif.rb +62 -0
  150. data/lib/puppet/util/posix.rb +54 -5
  151. data/lib/puppet/util/rubygems.rb +5 -1
  152. data/lib/puppet/util/run_mode.rb +5 -1
  153. data/lib/puppet/util/windows.rb +1 -0
  154. data/lib/puppet/util/windows/api_types.rb +15 -1
  155. data/lib/puppet/util/windows/monkey_patches/dir.rb +40 -0
  156. data/lib/puppet/util/windows/security.rb +4 -4
  157. data/lib/puppet/util/windows/service.rb +1 -1
  158. data/lib/puppet/util/windows/user.rb +219 -0
  159. data/lib/puppet/version.rb +1 -1
  160. data/locales/puppet.pot +342 -312
  161. data/man/man5/puppet.conf.5 +53 -18
  162. data/man/man8/puppet-agent.8 +7 -4
  163. data/man/man8/puppet-apply.8 +2 -2
  164. data/man/man8/puppet-catalog.8 +1 -1
  165. data/man/man8/puppet-config.8 +6 -6
  166. data/man/man8/puppet-describe.8 +1 -1
  167. data/man/man8/puppet-device.8 +2 -2
  168. data/man/man8/puppet-doc.8 +1 -1
  169. data/man/man8/puppet-epp.8 +1 -1
  170. data/man/man8/puppet-facts.8 +32 -1
  171. data/man/man8/puppet-filebucket.8 +3 -3
  172. data/man/man8/puppet-generate.8 +1 -1
  173. data/man/man8/puppet-help.8 +1 -1
  174. data/man/man8/puppet-key.8 +1 -1
  175. data/man/man8/puppet-lookup.8 +2 -2
  176. data/man/man8/puppet-man.8 +1 -1
  177. data/man/man8/puppet-module.8 +1 -1
  178. data/man/man8/puppet-node.8 +7 -4
  179. data/man/man8/puppet-parser.8 +1 -1
  180. data/man/man8/puppet-plugin.8 +1 -1
  181. data/man/man8/puppet-report.8 +4 -1
  182. data/man/man8/puppet-resource.8 +1 -1
  183. data/man/man8/puppet-script.8 +2 -2
  184. data/man/man8/puppet-ssl.8 +1 -1
  185. data/man/man8/puppet-status.8 +2 -2
  186. data/man/man8/puppet.8 +2 -2
  187. data/spec/fixtures/integration/application/agent/cached_deferred_catalog.json +91 -0
  188. data/spec/fixtures/integration/application/apply/environments/spec/modules/amod/lib/puppet/provider/applytest/applytest.rb +2 -0
  189. data/spec/fixtures/integration/application/apply/environments/spec/modules/amod/lib/puppet/type/applytest.rb +25 -0
  190. data/spec/fixtures/unit/forge/bacula-releases.json +128 -0
  191. data/spec/fixtures/unit/forge/bacula.tar.gz +0 -0
  192. data/spec/fixtures/unit/provider/package/puppetserver_gem/gem-list-local-packages +30 -0
  193. data/spec/fixtures/unit/provider/user/aix/aix_passwd_file.out +4 -0
  194. data/spec/integration/application/agent_spec.rb +208 -55
  195. data/spec/integration/application/apply_spec.rb +168 -149
  196. data/spec/integration/application/doc_spec.rb +16 -6
  197. data/spec/integration/application/filebucket_spec.rb +70 -21
  198. data/spec/integration/application/help_spec.rb +42 -0
  199. data/spec/integration/application/lookup_spec.rb +13 -0
  200. data/spec/integration/application/module_spec.rb +68 -0
  201. data/spec/integration/application/plugin_spec.rb +53 -3
  202. data/spec/integration/configurer_spec.rb +14 -0
  203. data/spec/integration/data_binding_spec.rb +82 -0
  204. data/spec/integration/defaults_spec.rb +19 -1
  205. data/spec/integration/directory_environments_spec.rb +17 -17
  206. data/spec/integration/environments/setting_hooks_spec.rb +1 -1
  207. data/spec/integration/indirector/facts/facter_spec.rb +8 -6
  208. data/spec/integration/node/environment_spec.rb +1 -1
  209. data/spec/integration/resource/type_collection_spec.rb +2 -6
  210. data/spec/integration/transaction_spec.rb +4 -9
  211. data/spec/integration/util/execution_spec.rb +22 -0
  212. data/spec/integration/util/windows/adsi_spec.rb +5 -3
  213. data/spec/integration/util/windows/monkey_patches/dir_spec.rb +11 -0
  214. data/spec/integration/util/windows/process_spec.rb +26 -32
  215. data/spec/integration/util/windows/registry_spec.rb +0 -10
  216. data/spec/integration/util/windows/user_spec.rb +7 -0
  217. data/spec/integration/util_spec.rb +7 -33
  218. data/spec/lib/puppet_spec/matchers.rb +0 -80
  219. data/spec/lib/puppet_spec/puppetserver.rb +8 -0
  220. data/spec/lib/puppet_spec/settings.rb +6 -1
  221. data/spec/shared_contexts/types_setup.rb +2 -0
  222. data/spec/spec_helper.rb +1 -4
  223. data/spec/unit/agent_spec.rb +8 -6
  224. data/spec/unit/application/agent_spec.rb +3 -5
  225. data/spec/unit/application/config_spec.rb +224 -4
  226. data/spec/unit/application/doc_spec.rb +2 -2
  227. data/spec/unit/application/face_base_spec.rb +6 -4
  228. data/spec/unit/application/facts_spec.rb +41 -10
  229. data/spec/unit/application/filebucket_spec.rb +0 -2
  230. data/spec/unit/application/man_spec.rb +52 -0
  231. data/spec/unit/application/resource_spec.rb +3 -1
  232. data/spec/unit/application/ssl_spec.rb +15 -2
  233. data/spec/unit/application_spec.rb +60 -13
  234. data/spec/unit/configurer/downloader_spec.rb +10 -0
  235. data/spec/unit/configurer_spec.rb +86 -37
  236. data/spec/unit/confine/feature_spec.rb +1 -1
  237. data/spec/unit/confine_spec.rb +10 -3
  238. data/spec/unit/defaults_spec.rb +20 -1
  239. data/spec/unit/environments_spec.rb +176 -32
  240. data/spec/unit/face/config_spec.rb +65 -12
  241. data/spec/unit/face/node_spec.rb +2 -13
  242. data/spec/unit/file_serving/configuration/parser_spec.rb +0 -1
  243. data/spec/unit/file_serving/metadata_spec.rb +3 -3
  244. data/spec/unit/file_serving/mount/locales_spec.rb +2 -2
  245. data/spec/unit/file_serving/mount/pluginfacts_spec.rb +2 -2
  246. data/spec/unit/file_serving/mount/plugins_spec.rb +2 -2
  247. data/spec/unit/file_serving/terminus_helper_spec.rb +11 -4
  248. data/spec/unit/file_system/uniquefile_spec.rb +18 -0
  249. data/spec/unit/file_system_spec.rb +1 -2
  250. data/spec/unit/forge/module_release_spec.rb +2 -7
  251. data/spec/unit/functions/inline_epp_spec.rb +26 -1
  252. data/spec/unit/http/client_spec.rb +0 -1
  253. data/spec/unit/http/resolver_spec.rb +24 -5
  254. data/spec/unit/http/service/ca_spec.rb +2 -3
  255. data/spec/unit/http/service/compiler_spec.rb +51 -3
  256. data/spec/unit/http/service/file_server_spec.rb +2 -3
  257. data/spec/unit/http/service/puppetserver_spec.rb +82 -0
  258. data/spec/unit/http/service/report_spec.rb +2 -3
  259. data/spec/unit/http/service_spec.rb +1 -2
  260. data/spec/unit/http/session_spec.rb +8 -21
  261. data/spec/unit/indirector/catalog/json_spec.rb +1 -1
  262. data/spec/unit/indirector/catalog/rest_spec.rb +1 -1
  263. data/spec/unit/indirector/face_spec.rb +0 -1
  264. data/spec/unit/indirector/facts/facter_spec.rb +0 -1
  265. data/spec/unit/indirector/facts/json_spec.rb +255 -0
  266. data/spec/unit/indirector/facts/rest_spec.rb +1 -1
  267. data/spec/unit/indirector/file_bucket_file/selector_spec.rb +26 -8
  268. data/spec/unit/indirector/indirection_spec.rb +8 -12
  269. data/spec/unit/indirector/json_spec.rb +8 -8
  270. data/spec/unit/indirector/key/file_spec.rb +0 -1
  271. data/spec/unit/indirector/msgpack_spec.rb +8 -8
  272. data/spec/unit/indirector/node/json_spec.rb +33 -0
  273. data/spec/unit/indirector/node/rest_spec.rb +1 -1
  274. data/spec/{integration/indirector/report/yaml.rb → unit/indirector/report/json_spec.rb} +13 -24
  275. data/spec/unit/indirector/report/yaml_spec.rb +72 -8
  276. data/spec/unit/indirector/request_spec.rb +4 -4
  277. data/spec/unit/indirector/rest_spec.rb +1 -1
  278. data/spec/unit/indirector/status/rest_spec.rb +1 -1
  279. data/spec/unit/indirector/yaml_spec.rb +7 -7
  280. data/spec/unit/indirector_spec.rb +2 -2
  281. data/spec/unit/module_tool/applications/installer_spec.rb +66 -0
  282. data/spec/unit/module_tool/tar/mini_spec.rb +20 -0
  283. data/spec/unit/network/authconfig_spec.rb +0 -3
  284. data/spec/unit/network/format_support_spec.rb +3 -2
  285. data/spec/unit/network/http/api/indirected_routes_spec.rb +0 -9
  286. data/spec/unit/network/http/api/master/v3/environments_spec.rb +12 -23
  287. data/spec/unit/network/http/handler_spec.rb +0 -5
  288. data/spec/unit/node/environment_spec.rb +18 -1
  289. data/spec/unit/parser/compiler_spec.rb +3 -19
  290. data/spec/unit/parser/resource_spec.rb +14 -8
  291. data/spec/unit/parser/templatewrapper_spec.rb +4 -3
  292. data/spec/unit/pops/evaluator/deferred_resolver_spec.rb +20 -0
  293. data/spec/unit/pops/loaders/loaders_spec.rb +70 -0
  294. data/spec/unit/pops/lookup/lookup_spec.rb +25 -0
  295. data/spec/unit/property_spec.rb +1 -0
  296. data/spec/unit/provider/exec_spec.rb +4 -3
  297. data/spec/unit/provider/group/groupadd_spec.rb +5 -2
  298. data/spec/unit/provider/nameservice_spec.rb +66 -65
  299. data/spec/unit/provider/package/apt_spec.rb +85 -3
  300. data/spec/unit/provider/package/aptitude_spec.rb +1 -0
  301. data/spec/unit/provider/package/base_spec.rb +6 -5
  302. data/spec/unit/provider/package/dpkg_spec.rb +22 -7
  303. data/spec/unit/provider/package/openbsd_spec.rb +2 -0
  304. data/spec/unit/provider/package/pacman_spec.rb +18 -12
  305. data/spec/unit/provider/package/pip2_spec.rb +36 -0
  306. data/spec/unit/provider/package/pip_spec.rb +6 -11
  307. data/spec/unit/provider/package/pkgdmg_spec.rb +0 -4
  308. data/spec/unit/provider/package/puppet_gem_spec.rb +4 -1
  309. data/spec/unit/provider/package/puppetserver_gem_spec.rb +137 -0
  310. data/spec/unit/provider/package/yum_spec.rb +31 -0
  311. data/spec/unit/provider/package/zypper_spec.rb +14 -0
  312. data/spec/unit/provider/service/base_spec.rb +2 -4
  313. data/spec/unit/provider/service/bsd_spec.rb +5 -1
  314. data/spec/unit/provider/service/daemontools_spec.rb +1 -1
  315. data/spec/unit/provider/service/debian_spec.rb +3 -5
  316. data/spec/unit/provider/service/freebsd_spec.rb +1 -1
  317. data/spec/unit/provider/service/gentoo_spec.rb +4 -5
  318. data/spec/unit/provider/service/init_spec.rb +45 -5
  319. data/spec/unit/provider/service/launchd_spec.rb +5 -6
  320. data/spec/unit/provider/service/openrc_spec.rb +4 -5
  321. data/spec/unit/provider/service/openwrt_spec.rb +1 -1
  322. data/spec/unit/provider/service/redhat_spec.rb +1 -1
  323. data/spec/unit/provider/service/runit_spec.rb +2 -1
  324. data/spec/unit/provider/service/smf_spec.rb +1 -1
  325. data/spec/unit/provider/service/src_spec.rb +3 -5
  326. data/spec/unit/provider/service/systemd_spec.rb +3 -6
  327. data/spec/unit/provider/service/upstart_spec.rb +4 -5
  328. data/spec/unit/provider/service/windows_spec.rb +28 -0
  329. data/spec/unit/provider/user/aix_spec.rb +5 -0
  330. data/spec/unit/provider/user/hpux_spec.rb +1 -1
  331. data/spec/unit/provider/user/pw_spec.rb +2 -0
  332. data/spec/unit/provider/user/useradd_spec.rb +56 -3
  333. data/spec/unit/provider/user/windows_adsi_spec.rb +82 -0
  334. data/spec/unit/provider_spec.rb +8 -10
  335. data/spec/unit/puppet_pal_2pec.rb +40 -0
  336. data/spec/unit/puppet_pal_catalog_spec.rb +45 -0
  337. data/spec/unit/reports/store_spec.rb +17 -13
  338. data/spec/unit/resource/capability_finder_spec.rb +6 -1
  339. data/spec/unit/resource/type_spec.rb +1 -1
  340. data/spec/unit/resource_spec.rb +11 -10
  341. data/spec/unit/rest/route_spec.rb +4 -4
  342. data/spec/unit/settings_spec.rb +576 -239
  343. data/spec/unit/ssl/base_spec.rb +0 -1
  344. data/spec/unit/ssl/host_spec.rb +0 -5
  345. data/spec/unit/ssl/ssl_provider_spec.rb +14 -8
  346. data/spec/unit/transaction/additional_resource_generator_spec.rb +3 -7
  347. data/spec/unit/transaction/event_manager_spec.rb +14 -11
  348. data/spec/unit/transaction/persistence_spec.rb +15 -0
  349. data/spec/unit/transaction/report_spec.rb +2 -0
  350. data/spec/unit/transaction_spec.rb +13 -4
  351. data/spec/unit/type/file/content_spec.rb +0 -1
  352. data/spec/unit/type/file/selinux_spec.rb +0 -2
  353. data/spec/unit/type/file/source_spec.rb +1 -1
  354. data/spec/unit/type/file_spec.rb +0 -6
  355. data/spec/unit/type/filebucket_spec.rb +1 -1
  356. data/spec/unit/type/group_spec.rb +13 -6
  357. data/spec/unit/type/resources_spec.rb +7 -7
  358. data/spec/unit/type/service_spec.rb +36 -3
  359. data/spec/unit/type/tidy_spec.rb +0 -1
  360. data/spec/unit/type/user_spec.rb +31 -2
  361. data/spec/unit/type_spec.rb +2 -2
  362. data/spec/unit/util/at_fork_spec.rb +2 -2
  363. data/spec/unit/util/autoload_spec.rb +5 -1
  364. data/spec/unit/util/backups_spec.rb +1 -2
  365. data/spec/unit/util/character_encoding_spec.rb +4 -4
  366. data/spec/unit/util/command_line_spec.rb +11 -6
  367. data/spec/unit/util/execution_spec.rb +15 -11
  368. data/spec/unit/util/inifile_spec.rb +6 -14
  369. data/spec/unit/util/log_spec.rb +8 -7
  370. data/spec/unit/util/logging_spec.rb +3 -3
  371. data/spec/unit/util/posix_spec.rb +363 -15
  372. data/spec/unit/util/rubygems_spec.rb +2 -2
  373. data/spec/unit/util/run_mode_spec.rb +6 -6
  374. data/spec/unit/util/selinux_spec.rb +76 -52
  375. data/spec/unit/util/storage_spec.rb +3 -1
  376. data/spec/unit/util/suidmanager_spec.rb +44 -41
  377. data/spec/unit/util_spec.rb +13 -6
  378. metadata +49 -50
  379. data/spec/integration/faces/config_spec.rb +0 -91
  380. data/spec/integration/faces/documentation_spec.rb +0 -57
  381. data/spec/integration/file_bucket/file_spec.rb +0 -50
  382. data/spec/integration/file_serving/content_spec.rb +0 -7
  383. data/spec/integration/file_serving/fileset_spec.rb +0 -12
  384. data/spec/integration/file_serving/metadata_spec.rb +0 -8
  385. data/spec/integration/file_serving/terminus_helper_spec.rb +0 -20
  386. data/spec/integration/file_system/uniquefile_spec.rb +0 -26
  387. data/spec/integration/module_tool/forge_spec.rb +0 -51
  388. data/spec/integration/module_tool/tar/mini_spec.rb +0 -28
  389. data/spec/integration/provider/service/init_spec.rb +0 -48
  390. data/spec/integration/provider/service/systemd_spec.rb +0 -25
  391. data/spec/integration/provider/service/windows_spec.rb +0 -50
  392. data/spec/integration/reference/providers_spec.rb +0 -21
  393. data/spec/integration/reports_spec.rb +0 -13
  394. data/spec/integration/ssl/certificate_request_spec.rb +0 -44
  395. data/spec/integration/ssl/host_spec.rb +0 -72
  396. data/spec/integration/ssl/key_spec.rb +0 -99
  397. data/spec/shared_behaviours/file_serving_model.rb +0 -51
  398. data/spec/unit/face/catalog_spec.rb +0 -6
  399. data/spec/unit/face/man_spec.rb +0 -25
  400. data/spec/unit/face/module_spec.rb +0 -3
  401. data/spec/unit/man_spec.rb +0 -31
@@ -328,6 +328,7 @@ defaultfor :osfamily => :redhat, :operatingsystemmajrelease => (4..7).to_a
328
328
  return "#{upd[:epoch]}:#{upd[:version]}-#{upd[:release]}"
329
329
  else
330
330
  # Yum didn't find updates, pretend the current version is the latest
331
+ self.debug "Yum didn't find updates, current version (#{properties[:ensure]}) is the latest"
331
332
  version = properties[:ensure]
332
333
  raise Puppet::DevError, _("Tried to get latest on a missing package") if version == :absent || version == :purged
333
334
  return version
@@ -187,6 +187,9 @@ Puppet::Type.type(:package).provide :zypper, :parent => :rpm, :source => :rpm do
187
187
  if should.is_a?(String)
188
188
  begin
189
189
  should_version = Puppet::Util::Package::Version::Range.parse(should, Puppet::Util::Package::Version::Rpm)
190
+ if should_version.is_a?(RPM_VERSION_RANGE::Eq)
191
+ return super
192
+ end
190
193
  rescue Puppet::Util::Package::Version::Range::ValidationFailure, Puppet::Util::Package::Version::Rpm::ValidationFailure
191
194
  Puppet.debug("Cannot parse #{should} as a RPM version range")
192
195
  return super
@@ -17,6 +17,8 @@ Puppet::Type.type(:service).provide :debian, :parent => :init do
17
17
  commands :invoke_rc => "/usr/sbin/invoke-rc.d"
18
18
  commands :service => "/usr/sbin/service"
19
19
 
20
+ confine :false => Puppet::FileSystem.exist?('/proc/1/comm') && Puppet::FileSystem.read('/proc/1/comm').include?('systemd')
21
+
20
22
  defaultfor :operatingsystem => :cumuluslinux, :operatingsystemmajrelease => ['1','2']
21
23
  defaultfor :operatingsystem => :debian, :operatingsystemmajrelease => ['5','6','7']
22
24
  defaultfor :operatingsystem => :devuan
@@ -178,7 +178,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
178
178
  # does not have a password.
179
179
  break if line =~ /^\S+:$/
180
180
 
181
- match_obj = /password = (\S+)/.match(line)
181
+ match_obj = /password\s+=\s+(\S+)/.match(line)
182
182
  end
183
183
  return :absent unless match_obj
184
184
 
@@ -211,7 +211,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
211
211
  tempfile = Tempfile.new("puppet_#{user}_pw", :encoding => Encoding::ASCII)
212
212
  tempfile << "#{user}:#{value}\n"
213
213
  tempfile.close()
214
-
214
+
215
215
  # Options '-e', '-c', use encrypted password and clear flags
216
216
  # Must receive "user:enc_password" as input
217
217
  # command, arguments = {:failonfail => true, :combine => true}
@@ -288,7 +288,7 @@ Puppet::Type.type(:user).provide :aix, :parent => Puppet::Provider::AixObject do
288
288
  # UNSUPPORTED
289
289
  #- **roles**
290
290
  # The roles the user has. Multiple roles should be
291
- # specified as an array. Requires features manages_solaris_rbac.
291
+ # specified as an array. Requires features manages_roles.
292
292
  # UNSUPPORTED
293
293
  #- **key_membership**
294
294
  # Whether specified key value pairs should be treated as the only
@@ -33,7 +33,7 @@ Puppet::Type.type(:user).provide :user_role_add, :parent => :useradd, :source =>
33
33
  set("shell", value)
34
34
  end
35
35
 
36
- has_features :manages_homedir, :allows_duplicates, :manages_solaris_rbac, :manages_passwords, :manages_password_age, :manages_shell
36
+ has_features :manages_homedir, :allows_duplicates, :manages_solaris_rbac, :manages_roles, :manages_passwords, :manages_password_age, :manages_shell
37
37
 
38
38
  def check_valid_shell
39
39
  unless File.exist?(@resource.should(:shell))
@@ -59,23 +59,37 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
59
59
  get(:uid)
60
60
  end
61
61
 
62
+ def gid
63
+ return localgid if @resource.forcelocal?
64
+ get(:gid)
65
+ end
66
+
62
67
  def comment
63
68
  return localcomment if @resource.forcelocal?
64
69
  get(:comment)
65
70
  end
66
71
 
72
+ def groups
73
+ return localgroups if @resource.forcelocal?
74
+ super
75
+ end
76
+
67
77
  def finduser(key, value)
68
- passwd_file = "/etc/passwd"
78
+ passwd_file = '/etc/passwd'
69
79
  passwd_keys = [:account, :password, :uid, :gid, :gecos, :directory, :shell]
70
- index = passwd_keys.index(key)
71
- @passwd_content ||= File.read(passwd_file)
72
- @passwd_content.each_line do |line|
73
- user = line.split(":")
74
- if user[index] == value
75
- return Hash[passwd_keys.zip(user)]
80
+
81
+ unless @users
82
+ unless Puppet::FileSystem.exist?(passwd_file)
83
+ raise Puppet::Error.new("Forcelocal set for user resource '#{resource[:name]}', but #{passwd_file} does not exist")
84
+ end
85
+
86
+ @users = []
87
+ Puppet::FileSystem.each_line(passwd_file) do |line|
88
+ user = line.chomp.split(':')
89
+ @users << Hash[passwd_keys.zip(user)]
76
90
  end
77
91
  end
78
- false
92
+ @users.find { |param| param[key] == value } || false
79
93
  end
80
94
 
81
95
  def local_username
@@ -88,16 +102,49 @@ Puppet::Type.type(:user).provide :useradd, :parent => Puppet::Provider::NameServ
88
102
  false
89
103
  end
90
104
 
105
+ def localgid
106
+ user = finduser(:account, resource[:name])
107
+ return user[:gid] if user
108
+ false
109
+ end
110
+
91
111
  def localcomment
92
112
  user = finduser(:account, resource[:name])
93
113
  user[:gecos]
94
114
  end
95
115
 
116
+ def localgroups
117
+ @groups_of ||= {}
118
+ group_file = '/etc/group'
119
+ user = resource[:name]
120
+
121
+ return @groups_of[user] if @groups_of[user]
122
+
123
+ @groups_of[user] = []
124
+
125
+ unless Puppet::FileSystem.exist?(group_file)
126
+ raise Puppet::Error.new("Forcelocal set for user resource '#{user}', but #{group_file} does not exist")
127
+ end
128
+
129
+ Puppet::FileSystem.each_line(group_file) do |line|
130
+ data = line.chomp.split(':')
131
+ if data.last.split(',').include?(user)
132
+ @groups_of[user] << data.first
133
+ end
134
+ end
135
+
136
+ @groups_of[user]
137
+ end
138
+
96
139
  def shell=(value)
97
140
  check_valid_shell
98
141
  set(:shell, value)
99
142
  end
100
143
 
144
+ def groups=(value)
145
+ set(:groups, value)
146
+ end
147
+
101
148
  verify :gid, "GID must be an integer" do |value|
102
149
  value.is_a? Integer
103
150
  end
@@ -6,7 +6,7 @@ Puppet::Type.type(:user).provide :windows_adsi do
6
6
  defaultfor :operatingsystem => :windows
7
7
  confine :operatingsystem => :windows
8
8
 
9
- has_features :manages_homedir, :manages_passwords
9
+ has_features :manages_homedir, :manages_passwords, :manages_roles
10
10
 
11
11
  def initialize(value={})
12
12
  super(value)
@@ -17,6 +17,23 @@ Puppet::Type.type(:user).provide :windows_adsi do
17
17
  @user ||= Puppet::Util::Windows::ADSI::User.new(@resource[:name])
18
18
  end
19
19
 
20
+ def roles
21
+ Puppet::Util::Windows::User::get_rights(@resource[:name])
22
+ end
23
+
24
+ def roles=(value)
25
+ current = roles.split(',')
26
+ should = value.split(',')
27
+
28
+ add_list = should - current
29
+ Puppet::Util::Windows::User::set_rights(@resource[:name], add_list) unless add_list.empty?
30
+
31
+ if @resource[:role_membership] == :inclusive
32
+ remove_list = current - should
33
+ Puppet::Util::Windows::User::remove_rights(@resource[:name], remove_list) unless remove_list.empty?
34
+ end
35
+ end
36
+
20
37
  def groups
21
38
  @groups ||= Puppet::Util::Windows::ADSI::Group.name_sid_hash(user.groups)
22
39
  @groups.keys
@@ -55,11 +55,12 @@ config.header = <<EOT
55
55
  * Each of these settings can be specified in `puppet.conf` or on the
56
56
  command line.
57
57
  * Puppet Enterprise (PE) and open source Puppet share the configuration settings
58
- that are documented here. However, PE defaults for some settings differ from
59
- the open source Puppet defaults. Some examples of settings that have different
60
- PE defaults include `disable18n`, `environment_timeout`, `always_retry_plugins`,
61
- and the Puppet Server JRuby `max-active-instances` setting. To verify PE
62
- configuration defaults, check the `puppet.conf` file after installation.
58
+ documented here. However, PE defaults differ from open source defaults for some
59
+ settings, such as `node_terminus`, `storeconfigs`, `always_retry_plugins`,
60
+ `disable18n`, `environment_timeout` (when Code Manager is enabled), and the
61
+ Puppet Server JRuby `max-active-instances` setting. To verify PE configuration
62
+ defaults, check the `puppet.conf` or `pe-puppet-server.conf` file after
63
+ installation.
63
64
  * When using boolean settings on the command line, use `--setting` and
64
65
  `--no-setting` instead of `--setting (true|false)`. (Using `--setting false`
65
66
  results in "Error: Could not parse application options: needless argument".)
@@ -34,7 +34,7 @@ class Puppet::Resource::Type
34
34
  DOUBLE_COLON = '::'.freeze
35
35
  EMPTY_ARRAY = [].freeze
36
36
 
37
- attr_accessor :file, :line, :doc, :code, :parent, :resource_type_collection
37
+ attr_accessor :file, :line, :doc, :code, :parent, :resource_type_collection, :override
38
38
  attr_reader :namespace, :arguments, :behaves_like, :module_name
39
39
 
40
40
  # The attributes 'produces' and 'consumes' are arrays of the blueprints
@@ -63,6 +63,7 @@ class Puppet::Resource::Type
63
63
  # Are we a child of the passed class? Do a recursive search up our
64
64
  # parentage tree to figure it out.
65
65
  def child_of?(klass)
66
+ return true if override
66
67
  return false unless parent
67
68
 
68
69
  return(klass == parent_type ? true : parent_type.child_of?(klass))
@@ -14,11 +14,11 @@ module Puppet::Rest
14
14
  # construction
15
15
  # @param [Symbol] server_setting the setting to check for special
16
16
  # server configuration
17
- # @param [Symbol] port_setting the setting to check for speical
17
+ # @param [Symbol] port_setting the setting to check for special
18
18
  # port configuration
19
19
  # @param [Symbol] srv_service the name of the service when using SRV
20
20
  # records
21
- def initialize(api:, server_setting: :server, port_setting: :masterport, srv_service: :puppet)
21
+ def initialize(api:, server_setting: :server, port_setting: :serverport, srv_service: :puppet)
22
22
  @api = api
23
23
  @default_server = Puppet::Util::Connection.determine_server(server_setting)
24
24
  @default_port = Puppet::Util::Connection.determine_port(port_setting, server_setting)
@@ -32,6 +32,7 @@ class Puppet::Settings
32
32
  require 'puppet/settings/server_list_setting'
33
33
  require 'puppet/settings/http_extra_headers_setting'
34
34
  require 'puppet/settings/certificate_revocation_setting'
35
+ require 'puppet/settings/alias_setting'
35
36
 
36
37
  # local reference for convenience
37
38
  PuppetOptionParser = Puppet::Util::CommandLine::PuppetOptionParser
@@ -44,7 +45,7 @@ class Puppet::Settings
44
45
  REQUIRED_APP_SETTINGS = [:logdir, :confdir, :vardir, :codedir]
45
46
 
46
47
  # The acceptable sections of the puppet.conf configuration file.
47
- ALLOWED_SECTION_NAMES = ['main', 'master', 'agent', 'user'].freeze
48
+ ALLOWED_SECTION_NAMES = ['main', 'server', 'master', 'agent', 'user'].freeze
48
49
 
49
50
  NONE = 'none'.freeze
50
51
 
@@ -330,7 +331,7 @@ class Puppet::Settings
330
331
  end
331
332
 
332
333
  option_parser.on('--run_mode',
333
- "The effective 'run mode' of the application: master, agent, or user.",
334
+ "The effective 'run mode' of the application: server, agent, or user.",
334
335
  :REQUIRED) do |arg|
335
336
  Puppet.settings.preferred_run_mode = arg
336
337
  end
@@ -564,7 +565,7 @@ class Puppet::Settings
564
565
  # @api private
565
566
  def preferred_run_mode=(mode)
566
567
  mode = mode.to_s.downcase.intern
567
- raise ValidationError, "Invalid run mode '#{mode}'" unless [:master, :agent, :user].include?(mode)
568
+ raise ValidationError, "Invalid run mode '#{mode}'" unless [:server, :master, :agent, :user].include?(mode)
568
569
  @preferred_run_mode_name = mode
569
570
  # Changing the run mode has far-reaching consequences. Flush any cached
570
571
  # settings so they will be re-generated.
@@ -659,7 +660,7 @@ class Puppet::Settings
659
660
  if explicit_config_file?
660
661
  return self[:config]
661
662
  else
662
- return File.join(Puppet::Util::RunMode[:master].conf_dir, config_file_name)
663
+ return File.join(Puppet::Util::RunMode[:server].conf_dir, config_file_name)
663
664
  end
664
665
  end
665
666
  private :main_config_file
@@ -729,7 +730,8 @@ class Puppet::Settings
729
730
  :autosign => AutosignSetting,
730
731
  :server_list => ServerListSetting,
731
732
  :http_extra_headers => HttpExtraHeadersSetting,
732
- :certificate_revocation => CertificateRevocationSetting
733
+ :certificate_revocation => CertificateRevocationSetting,
734
+ :alias => AliasSetting
733
735
  }
734
736
 
735
737
  # Create a new setting. The value is passed in because it's used to determine
@@ -829,7 +831,16 @@ class Puppet::Settings
829
831
  SearchPathElement.new(:cli, :values),
830
832
  ]
831
833
  searchpath << SearchPathElement.new(environment.intern, :environment) if environment
832
- searchpath << SearchPathElement.new(run_mode, :section) if run_mode
834
+
835
+ if run_mode
836
+ if [:master, :server].include?(run_mode)
837
+ searchpath << SearchPathElement.new(:server, :section)
838
+ searchpath << SearchPathElement.new(:master, :section)
839
+ else
840
+ searchpath << SearchPathElement.new(run_mode, :section)
841
+ end
842
+ end
843
+
833
844
  searchpath << SearchPathElement.new(:main, :section)
834
845
  end
835
846
 
@@ -907,6 +918,16 @@ class Puppet::Settings
907
918
  end
908
919
  end
909
920
 
921
+ # Allow later inspection to determine if the setting was set by user
922
+ # config, rather than a default setting.
923
+ def set_in_section?(param, section)
924
+ param = param.to_sym
925
+ vals = searchpath_values(SearchPathElement.new(section, :section))
926
+ if vals
927
+ vals.lookup(param)
928
+ end
929
+ end
930
+
910
931
  # Patches the value for a param in a section.
911
932
  # This method is required to support the use case of unifying --dns-alt-names and
912
933
  # --dns_alt_names in the certificate face. Ideally this should be cleaned up.
@@ -1053,12 +1074,17 @@ Generated on #{Time.now}.
1053
1074
  # Create the necessary objects to use a section. This is idempotent;
1054
1075
  # you can 'use' a section as many times as you want.
1055
1076
  def use(*sections)
1077
+ Puppet.warning(":master section deprecated in favor of :server section") if sections.include?(:master)
1078
+
1079
+ # add :server if sections include :master or :master if sections include :server
1080
+ sections |= [:master, :server] if (sections & [:master, :server]).any?
1081
+
1056
1082
  sections = sections.collect { |s| s.to_sym }
1057
1083
  sections = sections.reject { |s| @used.include?(s) }
1058
1084
 
1059
1085
  return if sections.empty?
1060
1086
 
1061
- Puppet.debug("Applying settings catalog for sections #{sections.join(', ')}")
1087
+ Puppet.debug { "Applying settings catalog for sections #{sections.join(', ')}" }
1062
1088
 
1063
1089
  begin
1064
1090
  catalog = to_catalog(*sections).to_ral
@@ -1236,27 +1262,37 @@ Generated on #{Time.now}.
1236
1262
  end
1237
1263
 
1238
1264
  def add_environment_resources(catalog, sections)
1239
- path = self[:environmentpath]
1240
- envdir = path.split(File::PATH_SEPARATOR).first if path
1241
1265
  configured_environment = self[:environment]
1242
- if configured_environment == "production" && envdir && Puppet::FileSystem.exist?(envdir)
1243
- configured_environment_path = File.join(envdir, configured_environment)
1244
- # If configured_environment_path is a symlink, assume the source path is being managed
1245
- # elsewhere, so don't do any of this configuration
1246
- if !Puppet::FileSystem.symlink?(configured_environment_path)
1266
+
1267
+ if configured_environment == "production" && !production_environment_exists?
1268
+ environment_path = self[:environmentpath]
1269
+ first_environment_path = environment_path.split(File::PATH_SEPARATOR).first
1270
+
1271
+ if Puppet::FileSystem.exist?(first_environment_path)
1272
+ production_environment_path = File.join(first_environment_path, configured_environment)
1247
1273
  parameters = { :ensure => 'directory' }
1248
- unless Puppet::FileSystem.exist?(configured_environment_path)
1249
- parameters[:mode] = '0750'
1250
- if Puppet.features.root?
1251
- parameters[:owner] = Puppet[:user] if service_user_available?
1252
- parameters[:group] = Puppet[:group] if service_group_available?
1253
- end
1274
+ parameters[:mode] = '0750'
1275
+ if Puppet.features.root?
1276
+ parameters[:owner] = Puppet[:user] if service_user_available?
1277
+ parameters[:group] = Puppet[:group] if service_group_available?
1254
1278
  end
1255
- catalog.add_resource(Puppet::Resource.new(:file, configured_environment_path, :parameters => parameters))
1279
+ catalog.add_resource(Puppet::Resource.new(:file, production_environment_path, :parameters => parameters))
1256
1280
  end
1257
1281
  end
1258
1282
  end
1259
1283
 
1284
+ def production_environment_exists?
1285
+ environment_path = self[:environmentpath]
1286
+ paths = environment_path.split(File::PATH_SEPARATOR)
1287
+
1288
+ paths.any? do |path|
1289
+ # If expected_path is a symlink, assume the source path is being managed
1290
+ # elsewhere, so accept it also as a valid production environment path
1291
+ expected_path = File.join(path, 'production')
1292
+ Puppet::FileSystem.directory?(expected_path) || Puppet::FileSystem.symlink?(expected_path)
1293
+ end
1294
+ end
1295
+
1260
1296
  def add_user_resources(catalog, sections)
1261
1297
  return unless Puppet.features.root?
1262
1298
  return if Puppet::Util::Platform.windows?
@@ -1357,6 +1393,12 @@ Generated on #{Time.now}.
1357
1393
  end
1358
1394
  end
1359
1395
 
1396
+ setting = @defaults[name]
1397
+ if setting.respond_to?(:alias_name)
1398
+ val = lookup(setting.alias_name)
1399
+ return val if val
1400
+ end
1401
+
1360
1402
  @defaults[name].default
1361
1403
  end
1362
1404
 
@@ -0,0 +1,37 @@
1
+ class Puppet::Settings::AliasSetting
2
+ attr_reader :name, :alias_name
3
+
4
+ def initialize(args = {})
5
+ @name = args[:name]
6
+ @alias_name = args[:alias_for]
7
+ @alias_for = Puppet.settings.setting(alias_name)
8
+ end
9
+
10
+ def optparse_args
11
+ args = @alias_for.optparse_args
12
+ args[0].gsub!(alias_name.to_s, name.to_s)
13
+ args
14
+ end
15
+
16
+ def getopt_args
17
+ args = @alias_for.getopt_args
18
+ args[0].gsub!(alias_name.to_s, name.to_s)
19
+ args
20
+ end
21
+
22
+ def type
23
+ :alias
24
+ end
25
+
26
+ def method_missing(method, *args)
27
+ begin
28
+ alias_for.send(method, *args)
29
+ rescue => e
30
+ Puppet.log_exception(self.class, e.message)
31
+ end
32
+ end
33
+
34
+ private
35
+
36
+ attr_reader :alias_for
37
+ end