puppet 6.15.0-x86-mingw32 → 6.19.1-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 (418) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +2 -7
  3. data/Gemfile +4 -2
  4. data/Gemfile.lock +29 -27
  5. data/README.md +3 -4
  6. data/Rakefile +4 -12
  7. data/lib/puppet.rb +32 -8
  8. data/lib/puppet/agent.rb +18 -4
  9. data/lib/puppet/agent/locker.rb +0 -7
  10. data/lib/puppet/application/agent.rb +23 -8
  11. data/lib/puppet/application/apply.rb +18 -20
  12. data/lib/puppet/application/device.rb +1 -1
  13. data/lib/puppet/application/doc.rb +1 -1
  14. data/lib/puppet/application/lookup.rb +16 -4
  15. data/lib/puppet/application/plugin.rb +1 -0
  16. data/lib/puppet/application/ssl.rb +1 -1
  17. data/lib/puppet/configurer.rb +61 -21
  18. data/lib/puppet/configurer/downloader.rb +31 -10
  19. data/lib/puppet/confine.rb +2 -2
  20. data/lib/puppet/confine/any.rb +1 -1
  21. data/lib/puppet/context/trusted_information.rb +14 -8
  22. data/lib/puppet/daemon.rb +13 -27
  23. data/lib/puppet/defaults.rb +119 -39
  24. data/lib/puppet/environments.rb +51 -10
  25. data/lib/puppet/face/catalog.rb +1 -1
  26. data/lib/puppet/face/config.rb +46 -16
  27. data/lib/puppet/face/facts.rb +1 -1
  28. data/lib/puppet/face/help.rb +29 -3
  29. data/lib/puppet/face/module/search.rb +5 -0
  30. data/lib/puppet/face/node.rb +3 -3
  31. data/lib/puppet/face/node/clean.rb +2 -2
  32. data/lib/puppet/face/plugin.rb +1 -1
  33. data/lib/puppet/face/status.rb +1 -1
  34. data/lib/puppet/feature/base.rb +1 -1
  35. data/lib/puppet/file_bucket/dipper.rb +1 -1
  36. data/lib/puppet/file_serving/http_metadata.rb +14 -2
  37. data/lib/puppet/file_serving/metadata.rb +4 -1
  38. data/lib/puppet/file_serving/mount/locales.rb +1 -2
  39. data/lib/puppet/file_serving/mount/pluginfacts.rb +1 -2
  40. data/lib/puppet/file_serving/mount/plugins.rb +1 -2
  41. data/lib/puppet/file_serving/terminus_selector.rb +7 -8
  42. data/lib/puppet/file_system/file_impl.rb +4 -4
  43. data/lib/puppet/file_system/uniquefile.rb +12 -16
  44. data/lib/puppet/forge.rb +1 -1
  45. data/lib/puppet/forge/cache.rb +1 -1
  46. data/lib/puppet/forge/repository.rb +4 -7
  47. data/lib/puppet/functions/filter.rb +1 -0
  48. data/lib/puppet/functions/lstrip.rb +4 -4
  49. data/lib/puppet/functions/new.rb +8 -3
  50. data/lib/puppet/functions/reverse_each.rb +1 -1
  51. data/lib/puppet/functions/rstrip.rb +4 -4
  52. data/lib/puppet/functions/step.rb +1 -1
  53. data/lib/puppet/functions/strip.rb +4 -4
  54. data/lib/puppet/gettext/config.rb +5 -5
  55. data/lib/puppet/gettext/module_translations.rb +4 -4
  56. data/lib/puppet/http.rb +1 -0
  57. data/lib/puppet/http/client.rb +28 -12
  58. data/lib/puppet/http/external_client.rb +0 -6
  59. data/lib/puppet/http/redirector.rb +9 -7
  60. data/lib/puppet/http/resolver.rb +5 -8
  61. data/lib/puppet/http/resolver/server_list.rb +18 -36
  62. data/lib/puppet/http/resolver/settings.rb +4 -4
  63. data/lib/puppet/http/resolver/srv.rb +5 -5
  64. data/lib/puppet/http/response.rb +19 -0
  65. data/lib/puppet/http/service.rb +3 -1
  66. data/lib/puppet/http/service/compiler.rb +1 -1
  67. data/lib/puppet/http/service/file_server.rb +1 -1
  68. data/lib/puppet/http/service/puppetserver.rb +39 -0
  69. data/lib/puppet/http/session.rb +5 -4
  70. data/lib/puppet/indirector.rb +1 -1
  71. data/lib/puppet/indirector/catalog/compiler.rb +1 -1
  72. data/lib/puppet/indirector/exec.rb +1 -1
  73. data/lib/puppet/indirector/facts/facter.rb +3 -3
  74. data/lib/puppet/indirector/facts/yaml.rb +1 -1
  75. data/lib/puppet/indirector/file_content/http.rb +5 -0
  76. data/lib/puppet/indirector/file_content/rest.rb +1 -1
  77. data/lib/puppet/indirector/file_metadata/http.rb +28 -8
  78. data/lib/puppet/indirector/file_metadata/rest.rb +2 -2
  79. data/lib/puppet/indirector/hiera.rb +4 -0
  80. data/lib/puppet/indirector/indirection.rb +1 -1
  81. data/lib/puppet/indirector/json.rb +1 -1
  82. data/lib/puppet/indirector/msgpack.rb +1 -1
  83. data/lib/puppet/indirector/report/processor.rb +2 -2
  84. data/lib/puppet/indirector/request.rb +5 -5
  85. data/lib/puppet/indirector/rest.rb +7 -1
  86. data/lib/puppet/indirector/yaml.rb +1 -1
  87. data/lib/puppet/module.rb +1 -2
  88. data/lib/puppet/network/format_support.rb +2 -2
  89. data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
  90. data/lib/puppet/network/http/api/master/v3/environment.rb +3 -0
  91. data/lib/puppet/network/http/api/master/v3/environments.rb +0 -1
  92. data/lib/puppet/network/http/compression.rb +7 -0
  93. data/lib/puppet/network/http/connection.rb +2 -0
  94. data/lib/puppet/network/http/connection_adapter.rb +184 -0
  95. data/lib/puppet/network/http/nocache_pool.rb +1 -0
  96. data/lib/puppet/network/http/route.rb +2 -2
  97. data/lib/puppet/network/http_pool.rb +2 -2
  98. data/lib/puppet/node/environment.rb +12 -5
  99. data/lib/puppet/node/facts.rb +17 -0
  100. data/lib/puppet/pal/catalog_compiler.rb +5 -0
  101. data/lib/puppet/pal/pal_impl.rb +31 -4
  102. data/lib/puppet/parameter.rb +1 -1
  103. data/lib/puppet/parser/ast/leaf.rb +5 -5
  104. data/lib/puppet/parser/ast/pops_bridge.rb +0 -4
  105. data/lib/puppet/parser/compiler.rb +29 -26
  106. data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +2 -0
  107. data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +2 -0
  108. data/lib/puppet/parser/environment_compiler.rb +4 -1
  109. data/lib/puppet/parser/functions.rb +21 -17
  110. data/lib/puppet/parser/functions/create_resources.rb +11 -7
  111. data/lib/puppet/parser/functions/filter.rb +1 -0
  112. data/lib/puppet/parser/resource.rb +3 -2
  113. data/lib/puppet/parser/resource/param.rb +6 -0
  114. data/lib/puppet/parser/type_loader.rb +2 -2
  115. data/lib/puppet/pops/adaptable.rb +7 -13
  116. data/lib/puppet/pops/adapters.rb +8 -4
  117. data/lib/puppet/pops/evaluator/collectors/abstract_collector.rb +1 -3
  118. data/lib/puppet/pops/evaluator/evaluator_impl.rb +5 -5
  119. data/lib/puppet/pops/evaluator/runtime3_converter.rb +2 -2
  120. data/lib/puppet/pops/issues.rb +5 -0
  121. data/lib/puppet/pops/loader/runtime3_type_loader.rb +4 -2
  122. data/lib/puppet/pops/loaders.rb +18 -11
  123. data/lib/puppet/pops/lookup/context.rb +1 -1
  124. data/lib/puppet/pops/lookup/hiera_config.rb +14 -1
  125. data/lib/puppet/pops/resource/resource_type_impl.rb +2 -0
  126. data/lib/puppet/pops/types/iterable.rb +34 -8
  127. data/lib/puppet/pops/types/p_meta_type.rb +1 -1
  128. data/lib/puppet/pops/types/p_type_set_type.rb +4 -0
  129. data/lib/puppet/pops/validation/checker4_0.rb +29 -15
  130. data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
  131. data/lib/puppet/provider/file/windows.rb +1 -1
  132. data/lib/puppet/provider/package/aix.rb +17 -2
  133. data/lib/puppet/provider/package/apt.rb +38 -1
  134. data/lib/puppet/provider/package/aptitude.rb +1 -1
  135. data/lib/puppet/provider/package/dnfmodule.rb +24 -4
  136. data/lib/puppet/provider/package/dpkg.rb +1 -1
  137. data/lib/puppet/provider/package/gem.rb +4 -2
  138. data/lib/puppet/provider/package/pip.rb +60 -37
  139. data/lib/puppet/provider/package/pip2.rb +17 -0
  140. data/lib/puppet/provider/package/portage.rb +2 -2
  141. data/lib/puppet/provider/package/puppet_gem.rb +5 -0
  142. data/lib/puppet/provider/package/puppetserver_gem.rb +180 -0
  143. data/lib/puppet/provider/package/yum.rb +9 -1
  144. data/lib/puppet/provider/package/zypper.rb +62 -1
  145. data/lib/puppet/provider/service/systemd.rb +21 -4
  146. data/lib/puppet/provider/service/windows.rb +23 -7
  147. data/lib/puppet/provider/user/aix.rb +1 -1
  148. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  149. data/lib/puppet/provider/user/useradd.rb +16 -5
  150. data/lib/puppet/provider/user/windows_adsi.rb +18 -1
  151. data/lib/puppet/reports/http.rb +7 -3
  152. data/lib/puppet/resource.rb +2 -1
  153. data/lib/puppet/resource/type.rb +10 -1
  154. data/lib/puppet/rest/route.rb +2 -2
  155. data/lib/puppet/runtime.rb +25 -2
  156. data/lib/puppet/settings.rb +43 -6
  157. data/lib/puppet/ssl/ssl_context.rb +2 -2
  158. data/lib/puppet/ssl/ssl_provider.rb +20 -1
  159. data/lib/puppet/ssl/state_machine.rb +33 -8
  160. data/lib/puppet/ssl/validator/default_validator.rb +1 -1
  161. data/lib/puppet/ssl/verifier_adapter.rb +9 -1
  162. data/lib/puppet/test/test_helper.rb +19 -14
  163. data/lib/puppet/transaction.rb +2 -2
  164. data/lib/puppet/transaction/persistence.rb +1 -1
  165. data/lib/puppet/transaction/report.rb +12 -8
  166. data/lib/puppet/trusted_external.rb +29 -1
  167. data/lib/puppet/type.rb +15 -7
  168. data/lib/puppet/type/file.rb +40 -15
  169. data/lib/puppet/type/file/checksum.rb +4 -4
  170. data/lib/puppet/type/file/source.rb +33 -13
  171. data/lib/puppet/type/filebucket.rb +1 -1
  172. data/lib/puppet/type/notify.rb +2 -2
  173. data/lib/puppet/type/package.rb +16 -1
  174. data/lib/puppet/type/service.rb +59 -8
  175. data/lib/puppet/type/user.rb +19 -10
  176. data/lib/puppet/util.rb +41 -3
  177. data/lib/puppet/util/autoload.rb +10 -25
  178. data/lib/puppet/util/character_encoding.rb +9 -5
  179. data/lib/puppet/util/checksums.rb +19 -4
  180. data/lib/puppet/util/connection.rb +8 -8
  181. data/lib/puppet/util/execution.rb +2 -2
  182. data/lib/puppet/util/fileparsing.rb +2 -2
  183. data/lib/puppet/util/log/destinations.rb +1 -10
  184. data/lib/puppet/util/package/version/range.rb +4 -1
  185. data/lib/puppet/util/package/version/range/eq.rb +14 -0
  186. data/lib/puppet/util/provider_features.rb +1 -1
  187. data/lib/puppet/util/reference.rb +1 -1
  188. data/lib/puppet/util/run_mode.rb +5 -1
  189. data/lib/puppet/util/windows.rb +1 -0
  190. data/lib/puppet/util/windows/api_types.rb +60 -33
  191. data/lib/puppet/util/windows/eventlog.rb +1 -6
  192. data/lib/puppet/util/windows/monkey_patches/dir.rb +40 -0
  193. data/lib/puppet/util/windows/principal.rb +8 -6
  194. data/lib/puppet/util/windows/registry.rb +11 -11
  195. data/lib/puppet/util/windows/security.rb +4 -4
  196. data/lib/puppet/util/windows/service.rb +43 -26
  197. data/lib/puppet/util/windows/user.rb +242 -8
  198. data/lib/puppet/version.rb +1 -1
  199. data/locales/puppet.pot +541 -427
  200. data/man/man5/puppet.conf.5 +84 -19
  201. data/man/man8/puppet-agent.8 +7 -4
  202. data/man/man8/puppet-apply.8 +1 -1
  203. data/man/man8/puppet-catalog.8 +1 -1
  204. data/man/man8/puppet-config.8 +6 -6
  205. data/man/man8/puppet-describe.8 +1 -1
  206. data/man/man8/puppet-device.8 +1 -1
  207. data/man/man8/puppet-doc.8 +1 -1
  208. data/man/man8/puppet-epp.8 +1 -1
  209. data/man/man8/puppet-facts.8 +1 -1
  210. data/man/man8/puppet-filebucket.8 +1 -1
  211. data/man/man8/puppet-generate.8 +1 -1
  212. data/man/man8/puppet-help.8 +6 -3
  213. data/man/man8/puppet-key.8 +1 -1
  214. data/man/man8/puppet-lookup.8 +2 -2
  215. data/man/man8/puppet-man.8 +1 -1
  216. data/man/man8/puppet-module.8 +4 -1
  217. data/man/man8/puppet-node.8 +4 -4
  218. data/man/man8/puppet-parser.8 +1 -1
  219. data/man/man8/puppet-plugin.8 +1 -1
  220. data/man/man8/puppet-report.8 +1 -1
  221. data/man/man8/puppet-resource.8 +1 -1
  222. data/man/man8/puppet-script.8 +1 -1
  223. data/man/man8/puppet-ssl.8 +1 -1
  224. data/man/man8/puppet-status.8 +2 -2
  225. data/man/man8/puppet.8 +2 -2
  226. data/spec/fixtures/integration/application/apply/environments/spec/modules/amod/lib/puppet/provider/applytest/applytest.rb +2 -0
  227. data/spec/fixtures/integration/application/apply/environments/spec/modules/amod/lib/puppet/type/applytest.rb +25 -0
  228. data/spec/fixtures/unit/forge/bacula-releases.json +128 -0
  229. data/spec/fixtures/unit/forge/bacula.tar.gz +0 -0
  230. data/spec/fixtures/unit/provider/package/dnfmodule/{dnf-module-list-enabled.txt → dnf-module-list.txt} +6 -0
  231. data/spec/fixtures/unit/provider/package/puppetserver_gem/gem-list-local-packages +30 -0
  232. data/spec/fixtures/unit/provider/package/zypper/zypper-search-uninstalled.out +13 -0
  233. data/spec/integration/application/agent_spec.rb +202 -52
  234. data/spec/integration/application/apply_spec.rb +149 -149
  235. data/spec/integration/application/config_spec.rb +74 -0
  236. data/spec/integration/application/doc_spec.rb +16 -6
  237. data/spec/integration/application/filebucket_spec.rb +70 -21
  238. data/spec/integration/application/help_spec.rb +42 -0
  239. data/spec/integration/application/lookup_spec.rb +13 -0
  240. data/spec/integration/application/module_spec.rb +68 -0
  241. data/spec/integration/application/plugin_spec.rb +75 -2
  242. data/spec/integration/configurer_spec.rb +14 -0
  243. data/spec/integration/data_binding_spec.rb +82 -0
  244. data/spec/integration/defaults_spec.rb +27 -3
  245. data/spec/integration/directory_environments_spec.rb +17 -17
  246. data/spec/integration/http/client_spec.rb +6 -1
  247. data/spec/integration/indirector/facts/facter_spec.rb +8 -6
  248. data/spec/integration/network/http_pool_spec.rb +73 -0
  249. data/spec/integration/node/environment_spec.rb +1 -1
  250. data/spec/integration/parser/compiler_spec.rb +11 -0
  251. data/spec/integration/type/file_spec.rb +1 -1
  252. data/spec/integration/util/execution_spec.rb +22 -0
  253. data/spec/integration/util/windows/adsi_spec.rb +7 -2
  254. data/spec/integration/util/windows/monkey_patches/dir_spec.rb +11 -0
  255. data/spec/integration/util/windows/process_spec.rb +26 -32
  256. data/spec/integration/util/windows/registry_spec.rb +7 -7
  257. data/spec/integration/util/windows/user_spec.rb +47 -5
  258. data/spec/integration/util_spec.rb +7 -33
  259. data/spec/lib/puppet_spec/https.rb +6 -0
  260. data/spec/lib/puppet_spec/matchers.rb +0 -80
  261. data/spec/lib/puppet_spec/puppetserver.rb +8 -0
  262. data/spec/shared_contexts/types_setup.rb +2 -0
  263. data/spec/unit/agent_spec.rb +47 -1
  264. data/spec/unit/application/agent_spec.rb +7 -8
  265. data/spec/unit/application/doc_spec.rb +2 -2
  266. data/spec/unit/application/face_base_spec.rb +6 -4
  267. data/spec/unit/application/facts_spec.rb +41 -10
  268. data/spec/unit/application/man_spec.rb +52 -0
  269. data/spec/unit/application/resource_spec.rb +3 -1
  270. data/spec/unit/application/ssl_spec.rb +15 -2
  271. data/spec/unit/application_spec.rb +9 -4
  272. data/spec/unit/configurer/downloader_spec.rb +10 -0
  273. data/spec/unit/configurer/fact_handler_spec.rb +4 -4
  274. data/spec/unit/configurer_spec.rb +86 -37
  275. data/spec/unit/confine_spec.rb +2 -1
  276. data/spec/unit/context/trusted_information_spec.rb +25 -2
  277. data/spec/unit/daemon_spec.rb +5 -64
  278. data/spec/unit/environments_spec.rb +99 -32
  279. data/spec/unit/face/config_spec.rb +59 -1
  280. data/spec/unit/face/module/search_spec.rb +17 -0
  281. data/spec/unit/face/node_spec.rb +2 -2
  282. data/spec/unit/file_serving/http_metadata_spec.rb +37 -14
  283. data/spec/unit/file_serving/mount/locales_spec.rb +2 -2
  284. data/spec/unit/file_serving/mount/pluginfacts_spec.rb +2 -2
  285. data/spec/unit/file_serving/mount/plugins_spec.rb +2 -2
  286. data/spec/unit/file_serving/terminus_selector_spec.rb +45 -26
  287. data/spec/unit/file_system/uniquefile_spec.rb +29 -0
  288. data/spec/unit/file_system_spec.rb +1 -2
  289. data/spec/unit/http/client_spec.rb +74 -19
  290. data/spec/unit/http/external_client_spec.rb +9 -9
  291. data/spec/unit/http/resolver_spec.rb +24 -5
  292. data/spec/unit/http/response_spec.rb +6 -0
  293. data/spec/unit/http/service/ca_spec.rb +2 -3
  294. data/spec/unit/http/service/compiler_spec.rb +2 -3
  295. data/spec/unit/http/service/file_server_spec.rb +2 -3
  296. data/spec/unit/http/service/puppetserver_spec.rb +82 -0
  297. data/spec/unit/http/service/report_spec.rb +2 -3
  298. data/spec/unit/http/service_spec.rb +0 -1
  299. data/spec/unit/http/session_spec.rb +8 -21
  300. data/spec/unit/indirector/catalog/compiler_spec.rb +1 -0
  301. data/spec/unit/indirector/catalog/json_spec.rb +1 -1
  302. data/spec/unit/indirector/catalog/rest_spec.rb +1 -1
  303. data/spec/unit/indirector/facts/rest_spec.rb +1 -1
  304. data/spec/unit/indirector/file_metadata/http_spec.rb +194 -0
  305. data/spec/unit/indirector/file_metadata/rest_spec.rb +15 -14
  306. data/spec/unit/indirector/json_spec.rb +8 -8
  307. data/spec/unit/indirector/msgpack_spec.rb +8 -8
  308. data/spec/unit/indirector/node/rest_spec.rb +1 -1
  309. data/spec/unit/indirector/request_spec.rb +5 -5
  310. data/spec/unit/indirector/rest_spec.rb +14 -1
  311. data/spec/unit/indirector/status/rest_spec.rb +1 -1
  312. data/spec/unit/indirector/yaml_spec.rb +7 -7
  313. data/spec/unit/interface_spec.rb +3 -3
  314. data/spec/unit/module_tool/tar/mini_spec.rb +20 -0
  315. data/spec/unit/network/format_support_spec.rb +3 -2
  316. data/spec/unit/network/http/api/indirected_routes_spec.rb +2 -1
  317. data/spec/unit/network/http/api/master/v3/environments_spec.rb +12 -23
  318. data/spec/unit/network/http/connection_spec.rb +552 -190
  319. data/spec/unit/network/http/nocache_pool_spec.rb +22 -0
  320. data/spec/unit/network/http_pool_spec.rb +63 -57
  321. data/spec/unit/network/http_spec.rb +1 -1
  322. data/spec/unit/node/environment_spec.rb +18 -1
  323. data/spec/unit/parser/ast/block_expression_spec.rb +1 -1
  324. data/spec/unit/parser/environment_compiler_spec.rb +7 -0
  325. data/spec/unit/parser/scope_spec.rb +1 -1
  326. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +15 -1
  327. data/spec/unit/pops/loaders/loaders_spec.rb +71 -1
  328. data/spec/unit/pops/lookup/lookup_spec.rb +25 -0
  329. data/spec/unit/pops/types/type_calculator_spec.rb +1 -11
  330. data/spec/unit/provider/exec_spec.rb +4 -3
  331. data/spec/unit/provider/package/aix_spec.rb +29 -0
  332. data/spec/unit/provider/package/apt_spec.rb +77 -0
  333. data/spec/unit/provider/package/aptitude_spec.rb +1 -0
  334. data/spec/unit/provider/package/dnfmodule_spec.rb +25 -5
  335. data/spec/unit/provider/package/dpkg_spec.rb +22 -7
  336. data/spec/unit/provider/package/openbsd_spec.rb +2 -0
  337. data/spec/unit/provider/package/pip2_spec.rb +36 -0
  338. data/spec/unit/provider/package/pip_spec.rb +42 -16
  339. data/spec/unit/provider/package/portage_spec.rb +5 -0
  340. data/spec/unit/provider/package/puppet_gem_spec.rb +4 -1
  341. data/spec/unit/provider/package/puppetserver_gem_spec.rb +137 -0
  342. data/spec/unit/provider/package/yum_spec.rb +47 -8
  343. data/spec/unit/provider/package/zypper_spec.rb +98 -0
  344. data/spec/unit/provider/service/base_spec.rb +2 -4
  345. data/spec/unit/provider/service/bsd_spec.rb +5 -1
  346. data/spec/unit/provider/service/daemontools_spec.rb +1 -1
  347. data/spec/unit/provider/service/debian_spec.rb +3 -5
  348. data/spec/unit/provider/service/freebsd_spec.rb +1 -1
  349. data/spec/unit/provider/service/gentoo_spec.rb +4 -5
  350. data/spec/unit/provider/service/init_spec.rb +46 -5
  351. data/spec/unit/provider/service/launchd_spec.rb +5 -6
  352. data/spec/unit/provider/service/openbsd_spec.rb +9 -0
  353. data/spec/unit/provider/service/openrc_spec.rb +4 -5
  354. data/spec/unit/provider/service/openwrt_spec.rb +2 -1
  355. data/spec/unit/provider/service/redhat_spec.rb +10 -1
  356. data/spec/unit/provider/service/runit_spec.rb +2 -1
  357. data/spec/unit/provider/service/smf_spec.rb +1 -1
  358. data/spec/unit/provider/service/src_spec.rb +3 -5
  359. data/spec/unit/provider/service/systemd_spec.rb +87 -19
  360. data/spec/unit/provider/service/upstart_spec.rb +4 -5
  361. data/spec/unit/provider/service/windows_spec.rb +50 -14
  362. data/spec/unit/provider/user/openbsd_spec.rb +1 -0
  363. data/spec/unit/provider/user/useradd_spec.rb +30 -16
  364. data/spec/unit/provider/user/windows_adsi_spec.rb +82 -0
  365. data/spec/unit/puppet_pal_2pec.rb +40 -0
  366. data/spec/unit/puppet_pal_catalog_spec.rb +43 -0
  367. data/spec/unit/puppet_spec.rb +33 -0
  368. data/spec/unit/reports/http_spec.rb +1 -1
  369. data/spec/unit/reports/store_spec.rb +17 -13
  370. data/spec/unit/resource_spec.rb +3 -3
  371. data/spec/unit/rest/route_spec.rb +4 -4
  372. data/spec/unit/settings_spec.rb +182 -22
  373. data/spec/unit/ssl/ssl_provider_spec.rb +69 -43
  374. data/spec/unit/ssl/state_machine_spec.rb +52 -8
  375. data/spec/unit/test/test_helper_spec.rb +17 -0
  376. data/spec/unit/transaction/persistence_spec.rb +15 -0
  377. data/spec/unit/transaction/report_spec.rb +3 -1
  378. data/spec/unit/type/file/source_spec.rb +4 -4
  379. data/spec/unit/type/file_spec.rb +122 -96
  380. data/spec/unit/type/filebucket_spec.rb +1 -1
  381. data/spec/unit/type/service_spec.rb +218 -8
  382. data/spec/unit/type/user_spec.rb +32 -3
  383. data/spec/unit/type_spec.rb +50 -0
  384. data/spec/unit/util/autoload_spec.rb +2 -1
  385. data/spec/unit/util/character_encoding_spec.rb +4 -4
  386. data/spec/unit/util/checksums_spec.rb +16 -0
  387. data/spec/unit/util/command_line_spec.rb +11 -6
  388. data/spec/unit/util/log/destinations_spec.rb +1 -29
  389. data/spec/unit/util/package/version/range_spec.rb +22 -1
  390. data/spec/unit/util/run_mode_spec.rb +6 -6
  391. data/spec/unit/util/windows/api_types_spec.rb +104 -40
  392. data/spec/unit/util/windows/service_spec.rb +4 -4
  393. data/spec/unit/util_spec.rb +3 -3
  394. data/spec/unit/x509/cert_provider_spec.rb +1 -1
  395. data/tasks/manpages.rake +5 -35
  396. metadata +43 -49
  397. data/spec/integration/faces/config_spec.rb +0 -91
  398. data/spec/integration/faces/documentation_spec.rb +0 -57
  399. data/spec/integration/file_bucket/file_spec.rb +0 -50
  400. data/spec/integration/file_serving/content_spec.rb +0 -7
  401. data/spec/integration/file_serving/fileset_spec.rb +0 -12
  402. data/spec/integration/file_serving/metadata_spec.rb +0 -8
  403. data/spec/integration/file_serving/terminus_helper_spec.rb +0 -20
  404. data/spec/integration/file_system/uniquefile_spec.rb +0 -26
  405. data/spec/integration/module_tool/forge_spec.rb +0 -51
  406. data/spec/integration/module_tool/tar/mini_spec.rb +0 -28
  407. data/spec/integration/provider/service/init_spec.rb +0 -48
  408. data/spec/integration/provider/service/systemd_spec.rb +0 -25
  409. data/spec/integration/provider/service/windows_spec.rb +0 -50
  410. data/spec/integration/reference/providers_spec.rb +0 -21
  411. data/spec/integration/reports_spec.rb +0 -13
  412. data/spec/integration/ssl/certificate_request_spec.rb +0 -44
  413. data/spec/integration/ssl/host_spec.rb +0 -72
  414. data/spec/integration/ssl/key_spec.rb +0 -99
  415. data/spec/integration/test/test_helper_spec.rb +0 -31
  416. data/spec/shared_behaviours/file_serving_model.rb +0 -51
  417. data/spec/unit/face/man_spec.rb +0 -25
  418. data/spec/unit/man_spec.rb +0 -31
@@ -347,8 +347,7 @@ module Puppet
347
347
  :default => "ansi",
348
348
  :type => :string,
349
349
  :desc => "Whether to use colors when logging to the console. Valid values are
350
- `ansi` (equivalent to `true`), `html`, and `false`, which produces no color.
351
- Defaults to false on Windows, as its console does not support ansi colors.",
350
+ `ansi` (equivalent to `true`), `html`, and `false`, which produces no color."
352
351
  },
353
352
  :mkusers => {
354
353
  :default => false,
@@ -375,7 +374,7 @@ module Puppet
375
374
  from the parent process.
376
375
 
377
376
  This setting can only be set in the `[main]` section of puppet.conf; it cannot
378
- be set in `[master]`, `[agent]`, or an environment config section.",
377
+ be set in `[server]`, `[agent]`, or an environment config section.",
379
378
  :call_hook => :on_define_and_write,
380
379
  :hook => proc do |value|
381
380
  Puppet::Util.set_env('PATH', '') if Puppet::Util.get_env('PATH').nil?
@@ -563,7 +562,7 @@ module Puppet
563
562
  config = File.expand_path(File.join(settings[:confdir], 'hiera.yaml')) if config.nil?
564
563
  config
565
564
  end,
566
- :desc => "The hiera configuration file. Puppet only reads this file on startup, so you must restart the puppet master every time you edit it.",
565
+ :desc => "The hiera configuration file. Puppet only reads this file on startup, so you must restart the puppet server every time you edit it.",
567
566
  :type => :file,
568
567
  },
569
568
  :binder_config => {
@@ -590,13 +589,22 @@ module Puppet
590
589
  },
591
590
  :trusted_external_command => {
592
591
  :default => nil,
593
- :desc => "The external trusted facts script to use.
592
+ :type => :file_or_directory,
593
+ :desc => "The external trusted facts script or directory to use.
594
594
  This setting's value can be set to the path to an executable command that
595
- can produce external trusted facts. The command must:
595
+ can produce external trusted facts or to a directory containing those
596
+ executable commands. The command(s) must:
596
597
 
597
598
  * Take the name of a node as a command-line argument.
598
599
  * Return a JSON hash with the external trusted facts for this node.
599
- * For unknown or invalid nodes, exit with a non-zero exit code.",
600
+ * For unknown or invalid nodes, exit with a non-zero exit code.
601
+
602
+ If the setting points to an executable command, then the external trusted
603
+ facts will be stored in the 'external' key of the trusted facts hash. Otherwise
604
+ for each executable file in the directory, the external trusted facts will be
605
+ stored in the `<basename>` key of the `trusted['external']` hash. For example,
606
+ if the files foo.rb and bar.sh are in the directory, then `trusted['external']`
607
+ will be the hash `{ 'foo' => <foo.rb output>, 'bar' => <bar.sh output> }`.",
600
608
  },
601
609
  :default_file_terminus => {
602
610
  :type => :terminus,
@@ -692,40 +700,54 @@ Valid values are 0 (never cache) and 15 (15 second minimum wait time).
692
700
  :environment_timeout => {
693
701
  :default => "0",
694
702
  :type => :ttl,
695
- :desc => "How long the Puppet master should cache data it loads from an
703
+ :desc => "How long the Puppet server should cache data it loads from an
696
704
  environment.
697
705
 
698
706
  A value of `0` will disable caching. This setting can also be set to
699
- `unlimited`, which will cache environments until the master is restarted
700
- or told to refresh the cache.
707
+ `unlimited`, which will cache environments until the server is restarted
708
+ or told to refresh the cache. All other values will result in Puppet
709
+ server evicting expired environments. The expiration time is computed
710
+ based on either when the environment was created or last accessed, see
711
+ `environment_timeout_mode`.
701
712
 
702
713
  You should change this setting once your Puppet deployment is doing
703
714
  non-trivial work. We chose the default value of `0` because it lets new
704
715
  users update their code without any extra steps, but it lowers the
705
- performance of your Puppet master.
706
-
707
- We recommend setting this to `unlimited` and explicitly refreshing your
708
- Puppet master as part of your code deployment process.
709
-
710
- * With Puppet Server, you should refresh environments by calling the
711
- `environment-cache` API endpoint. See the docs for the Puppet Server
712
- [administrative API](https://puppet.com/docs/puppetserver/latest/admin-api/v1/environment-cache.html).
713
-
714
- Any value other than `0` or `unlimited` is deprecated, since most Puppet
715
- servers use a pool of Ruby interpreters which all have their own cache
716
- timers. When these timers drift out of sync, agents can be served
717
- inconsistent catalogs.",
716
+ performance of your Puppet server. We recommend either:
717
+
718
+ * Setting this to `unlimited` and explicitly refreshing your Puppet server
719
+ as part of your code deployment process.
720
+
721
+ * Setting this to a number that will keep your most actively used
722
+ environments cached, but allow testing environments to fall out of the
723
+ cache and reduce memory usage. A value of 3 minutes (3m) is a reasonable
724
+ value. This option requires setting `environment_timeout_mode` to
725
+ `from_last_used`.
726
+
727
+ Once you set `environment_timeout` to a non-zero value, you need to tell
728
+ Puppet server to read new code from disk using the `environment-cache` API
729
+ endpoint after you deploy new code. See the docs for the Puppet Server
730
+ [administrative API](https://puppet.com/docs/puppetserver/latest/admin-api/v1/environment-cache.html).
731
+ ",
718
732
  :hook => proc do |val|
719
- unless [0, 'unlimited', Float::INFINITY].include?(val)
720
- Puppet.deprecation_warning(<<-WARNING)
721
- Fine grained control of environment timeouts is deprecated,
722
- please use `0` or `unlimited` to control default caching behavior
723
- and the environment-cache endpoint in Puppet Server's administrative
724
- API to expire the cache as needed
725
- WARNING
733
+ if Puppet[:environment_timeout_mode] == :from_created
734
+ unless [0, 'unlimited', Float::INFINITY].include?(val)
735
+ Puppet.deprecation_warning("Evicting environments based on their creation time is deprecated, please set `environment_timeout_mode` to `from_last_used` instead.")
736
+ end
726
737
  end
727
738
  end
728
739
  },
740
+ :environment_timeout_mode => {
741
+ :default => :from_created,
742
+ :type => :symbolic_enum,
743
+ :values => [:from_created, :from_last_used],
744
+ :desc => "How Puppet interprets the `environment_timeout` setting when
745
+ `environment_timeout` is neither `0` nor `unlimited`. If set to
746
+ `from_created`, then the environment will be evicted `environment_timeout`
747
+ seconds from when it was created. If set to `from_last_used` then the
748
+ environment will be evicted `environment_timeout` seconds from when it
749
+ was last used."
750
+ },
729
751
  :environment_data_provider => {
730
752
  :desc => "The name of a registered environment data provider used when obtaining environment
731
753
  specific data. The three built in and registered providers are 'none' (no data), 'function' (data
@@ -814,7 +836,9 @@ API to expire the cache as needed
814
836
  only use lowercase letters, numbers, periods, underscores, and dashes. (That is,
815
837
  it should match `/\A[a-z0-9._-]+\Z/`.)
816
838
  * The special value `ca` is reserved, and can't be used as the certname
817
- for a normal node.
839
+ for a normal node.
840
+
841
+ **Note:** You must set the certname in the main section of the puppet.conf file. Setting it in a different section causes errors.
818
842
 
819
843
  Defaults to the node's fully qualified domain name.",
820
844
  :hook => proc { |value| raise(ArgumentError, _("Certificate names must be lower case")) unless value == value.downcase }},
@@ -992,6 +1016,15 @@ EOT
992
1016
  and reject the CA certificate if the values do not match. This only applies
993
1017
  during the first download of the CA certificate."
994
1018
  },
1019
+ :ssl_trust_store => {
1020
+ :default => nil,
1021
+ :type => :file,
1022
+ :desc => "A file containing CA certificates in PEM format that puppet should trust
1023
+ when making HTTPS requests. This **only** applies to https requests to non-puppet
1024
+ infrastructure, such as retrieving file metadata and content from https file sources,
1025
+ puppet module tool and the 'http' report processor. This setting is ignored when
1026
+ making requests to puppet:// URLs such as catalog and report requests.",
1027
+ },
995
1028
  :ssl_client_ca_auth => {
996
1029
  :type => :file,
997
1030
  :mode => "0644",
@@ -1284,7 +1317,7 @@ EOT
1284
1317
  }
1285
1318
  )
1286
1319
 
1287
- settings.define_settings(:master,
1320
+ settings.define_settings(:server,
1288
1321
  :user => {
1289
1322
  :default => "puppet",
1290
1323
  :desc => "The user Puppet Server will run as. Used to ensure
@@ -1334,11 +1367,23 @@ EOT
1334
1367
  by `puppet`, and should only be set if you're writing your own Puppet
1335
1368
  executable.",
1336
1369
  },
1370
+ :serverport => {
1371
+ :default => 8140,
1372
+ :desc => "The default port puppet subcommands use to communicate
1373
+ with Puppet Server. (eg `puppet facts upload`, `puppet agent`). May be
1374
+ overridden by more specific settings (see `ca_port`, `report_port`).",
1375
+ :hook => proc do |value|
1376
+ Puppet[:masterport] = value unless Puppet.settings.set_by_config?(:masterport)
1377
+ end
1378
+ },
1337
1379
  :masterport => {
1338
1380
  :default => 8140,
1339
1381
  :desc => "The default port puppet subcommands use to communicate
1340
1382
  with Puppet Server. (eg `puppet facts upload`, `puppet agent`). May be
1341
1383
  overridden by more specific settings (see `ca_port`, `report_port`).",
1384
+ :hook => proc do |value|
1385
+ Puppet[:serverport] = value unless Puppet.settings.set_by_config?(:serverport)
1386
+ end
1342
1387
  },
1343
1388
  :node_name => {
1344
1389
  :default => 'cert',
@@ -1536,7 +1581,7 @@ EOT
1536
1581
  :statefile => {
1537
1582
  :default => "$statedir/state.yaml",
1538
1583
  :type => :file,
1539
- :mode => "0660",
1584
+ :mode => "0640",
1540
1585
  :desc => "Where puppet agent and puppet master store state associated
1541
1586
  with the running configuration. In the case of puppet master,
1542
1587
  this file reflects the state discovered through interacting
@@ -1558,7 +1603,7 @@ EOT
1558
1603
  :transactionstorefile => {
1559
1604
  :default => "$statedir/transactionstore.yaml",
1560
1605
  :type => :file,
1561
- :mode => "0660",
1606
+ :mode => "0640",
1562
1607
  :desc => "Transactional storage file for persisting data between
1563
1608
  transactions for the purposes of infering information (such as
1564
1609
  corrective_change) on new data received."
@@ -1684,8 +1729,7 @@ EOT
1684
1729
  :type => :duration,
1685
1730
  :desc => "How often puppet agent applies the catalog.
1686
1731
  Note that a runinterval of 0 means \"run continuously\" rather than
1687
- \"never run.\" If you want puppet agent to never run, you should start
1688
- it with the `--no-client` option. #{AS_DURATION}",
1732
+ \"never run.\" #{AS_DURATION}",
1689
1733
  },
1690
1734
  :runtimeout => {
1691
1735
  :default => "1h",
@@ -1701,7 +1745,7 @@ EOT
1701
1745
  and does not need to horizontally scale.",
1702
1746
  },
1703
1747
  :ca_port => {
1704
- :default => "$masterport",
1748
+ :default => "$serverport",
1705
1749
  :desc => "The port to use for the certificate authority.",
1706
1750
  },
1707
1751
  :preferred_serialization_format => {
@@ -1790,7 +1834,7 @@ EOT
1790
1834
  :desc => "The server to send transaction reports to.",
1791
1835
  },
1792
1836
  :report_port => {
1793
- :default => "$masterport",
1837
+ :default => "$serverport",
1794
1838
  :desc => "The port to communicate with the report_server.",
1795
1839
  },
1796
1840
  :report => {
@@ -1882,6 +1926,25 @@ EOT
1882
1926
  certificate request to be signed. A value of `unlimited` will cause puppet agent
1883
1927
  to ask for a signed certificate indefinitely.
1884
1928
  #{AS_DURATION}",
1929
+ },
1930
+ :waitforlock => {
1931
+ :default => "0",
1932
+ :type => :duration,
1933
+ :desc => "How frequently puppet agent should try running when there is an
1934
+ already ongoing puppet agent instance.
1935
+
1936
+ This argument is by default disabled (value set to 0). In this case puppet agent will
1937
+ immediately exit if it cannot run at that moment. When a value other than 0 is set, this
1938
+ can also be used in combination with the `maxwaitforlock` argument.
1939
+ #{AS_DURATION}",
1940
+ },
1941
+ :maxwaitforlock => {
1942
+ :default => "1m",
1943
+ :type => :ttl,
1944
+ :desc => "The maximum amount of time the puppet agent should wait for an
1945
+ already running puppet agent to finish before starting a new one. This is set by default to 1 minute.
1946
+ A value of `unlimited` will cause puppet agent to wait indefinitely.
1947
+ #{AS_DURATION}",
1885
1948
  }
1886
1949
  )
1887
1950
 
@@ -1922,9 +1985,26 @@ EOT
1922
1985
  is used for retrieval, so anything that is a valid file source can
1923
1986
  be used here.",
1924
1987
  },
1988
+ :pluginsync => {
1989
+ :default => true,
1990
+ :type => :boolean,
1991
+ :desc => "Whether plugins should be synced with the central server. This setting is
1992
+ deprecated.",
1993
+ :hook => proc { |value|
1994
+ #TRANSLATORS 'pluginsync' is a setting and should not be translated
1995
+ Puppet.deprecation_warning(_("Setting 'pluginsync' is deprecated."))
1996
+ }
1997
+ },
1925
1998
  :pluginsignore => {
1926
1999
  :default => ".svn CVS .git .hg",
1927
2000
  :desc => "What files to ignore when pulling down plugins.",
2001
+ },
2002
+ :ignore_plugin_errors => {
2003
+ :default => true,
2004
+ :type => :boolean,
2005
+ :desc => "Whether the puppet run should ignore errors during pluginsync. If the setting
2006
+ is false and there are errors during pluginsync, then the agent will abort the run and
2007
+ submit a report containing information about the failed run."
1928
2008
  }
1929
2009
  )
1930
2010
 
@@ -2069,7 +2149,7 @@ EOT
2069
2149
  }
2070
2150
  )
2071
2151
 
2072
- settings.define_settings(:master,
2152
+ settings.define_settings(:server,
2073
2153
  :storeconfigs => {
2074
2154
  :default => false,
2075
2155
  :type => :boolean,
@@ -159,8 +159,8 @@ module Puppet::Environments
159
159
  # Reads environments from a directory on disk. Each environment is
160
160
  # represented as a sub-directory. The environment's manifest setting is the
161
161
  # `manifest` directory of the environment directory. The environment's
162
- # modulepath setting is the global modulepath (from the `[master]` section
163
- # for the master) prepended with the `modules` directory of the environment
162
+ # modulepath setting is the global modulepath (from the `[server]` section
163
+ # for the server) prepended with the `modules` directory of the environment
164
164
  # directory.
165
165
  #
166
166
  # @api private
@@ -277,7 +277,7 @@ module Puppet::Environments
277
277
  def get(name)
278
278
  @loaders.each do |loader|
279
279
  env = loader.get(name)
280
- if env
280
+ if env
281
281
  return env
282
282
  end
283
283
  end
@@ -305,13 +305,23 @@ module Puppet::Environments
305
305
  include Puppet::Concurrent::Synchronized
306
306
 
307
307
  class DefaultCacheExpirationService
308
+ # Called when the environment is created.
309
+ #
310
+ # @param [Puppet::Node::Environment] env
308
311
  def created(env)
309
312
  end
310
313
 
314
+ # Is the environment with this name expired?
315
+ #
316
+ # @param [Symbol] env_name The symbolic environment name
317
+ # @return [Boolean]
311
318
  def expired?(env_name)
312
319
  false
313
320
  end
314
321
 
322
+ # The environment with this name was evicted.
323
+ #
324
+ # @param [Symbol] env_name The symbolic environment name
315
325
  def evicted(env_name)
316
326
  end
317
327
  end
@@ -362,7 +372,9 @@ module Puppet::Environments
362
372
  clear_all_expired
363
373
  result = @cache[name]
364
374
  if result
375
+ Puppet.debug {"Found in cache '#{name}' #{result.label}"}
365
376
  # found in cache
377
+ result.touch
366
378
  return result.value
367
379
  elsif (result = @loader.get(name))
368
380
  # environment loaded, cache it
@@ -411,7 +423,7 @@ module Puppet::Environments
411
423
  to_expire = @cache.select { |name, entry| entry.expires < t || @cache_expiration_service.expired?(name.to_sym) }
412
424
  to_expire.each do |name, entry|
413
425
  Puppet.debug {"Evicting cache entry for environment '#{name}'"}
414
- @cache_expiration_service.evicted(name)
426
+ @cache_expiration_service.evicted(name.to_sym)
415
427
  clear(name)
416
428
  @expirations.delete(entry.expires)
417
429
  Puppet.settings.clear_environment_settings(name)
@@ -435,23 +447,32 @@ module Puppet::Environments
435
447
  # Creates a suitable cache entry given the time to live for one environment
436
448
  #
437
449
  def entry(env)
438
- ttl = (conf = get_conf(env.name)) ? conf.environment_timeout : Puppet.settings.value(:environment_timeout)
450
+ ttl = if (conf = get_conf(env.name))
451
+ conf.environment_timeout
452
+ else
453
+ Puppet[:environment_timeout]
454
+ end
455
+
439
456
  case ttl
440
457
  when 0
441
458
  NotCachedEntry.new(env) # Entry that is always expired (avoids syscall to get time)
442
459
  when Float::INFINITY
443
460
  Entry.new(env) # Entry that never expires (avoids syscall to get time)
444
461
  else
445
- TTLEntry.new(env, ttl)
462
+ if Puppet[:environment_timeout_mode] == :from_last_used
463
+ MRUEntry.new(env, ttl) # Entry that expires in ttl from when it was last touched
464
+ else
465
+ TTLEntry.new(env, ttl) # Entry that expires in ttl from when it was created
466
+ end
446
467
  end
447
468
  end
448
469
 
449
470
  # Evicts the entry if it has expired
450
471
  # Also clears caches in Settings that may prevent the entry from being updated
451
472
  def evict_if_expired(name)
452
- if (result = @cache[name]) && (result.expired? || @cache_expiration_service.expired?(name))
473
+ if (result = @cache[name]) && (result.expired? || @cache_expiration_service.expired?(name.to_sym))
453
474
  Puppet.debug {"Evicting cache entry for environment '#{name}'"}
454
- @cache_expiration_service.evicted(name)
475
+ @cache_expiration_service.evicted(name.to_sym)
455
476
  clear(name)
456
477
  Puppet.settings.clear_environment_settings(name)
457
478
  end
@@ -465,6 +486,9 @@ module Puppet::Environments
465
486
  @value = value
466
487
  end
467
488
 
489
+ def touch
490
+ end
491
+
468
492
  def expired?
469
493
  false
470
494
  end
@@ -493,10 +517,10 @@ module Puppet::Environments
493
517
  end
494
518
  end
495
519
 
496
- # Time to Live eviction policy entry
520
+ # Policy that expires in ttl_seconds from when it was created
497
521
  class TTLEntry < Entry
498
522
  def initialize(value, ttl_seconds)
499
- super value
523
+ super(value)
500
524
  @ttl = Time.now + ttl_seconds
501
525
  @ttl_seconds = ttl_seconds
502
526
  end
@@ -513,5 +537,22 @@ module Puppet::Environments
513
537
  @ttl
514
538
  end
515
539
  end
540
+
541
+ # Policy that expires if it hasn't been touched within ttl_seconds
542
+ class MRUEntry < TTLEntry
543
+ def initialize(value, ttl_seconds)
544
+ super(value, ttl_seconds)
545
+
546
+ touch
547
+ end
548
+
549
+ def touch
550
+ @ttl = Time.now + @ttl_seconds
551
+ end
552
+
553
+ def label
554
+ "(mru = #{@ttl_seconds} sec)"
555
+ end
556
+ end
516
557
  end
517
558
  end
@@ -97,7 +97,7 @@ Puppet::Indirector::Face.define(:catalog, '0.0.1') do
97
97
  A serialized catalog.
98
98
  EOT
99
99
  when_invoked do |*args|
100
- Puppet.settings.preferred_run_mode = :master
100
+ Puppet.settings.preferred_run_mode = :server
101
101
  Puppet::Face[:catalog, :current].find(*args)
102
102
  end
103
103
  end
@@ -20,10 +20,10 @@ Puppet::Face.define(:config, '0.0.1') do
20
20
  description <<-EOT
21
21
  The section of the puppet.conf configuration file to interact with.
22
22
 
23
- The three most commonly used sections are 'main', 'master', and 'agent'.
23
+ The three most commonly used sections are 'main', 'server', and 'agent'.
24
24
  'Main' is the default, and is used by all Puppet applications. Other
25
25
  sections can override 'main' values for specific applications --- the
26
- 'master' section affects Puppet Server, and the 'agent'
26
+ 'server' section affects Puppet Server, and the 'agent'
27
27
  section affects puppet agent.
28
28
 
29
29
  Less commonly used is the 'user' section, which affects puppet apply. Any
@@ -52,9 +52,9 @@ Puppet::Face.define(:config, '0.0.1') do
52
52
 
53
53
  $ puppet config print rundir
54
54
 
55
- Get a list of important directories from the master's config:
55
+ Get a list of important directories from the server's config:
56
56
 
57
- $ puppet config print all --section master | grep -E "(path|dir)"
57
+ $ puppet config print all --section server | grep -E "(path|dir)"
58
58
  EOT
59
59
 
60
60
  when_invoked do |*args|
@@ -144,7 +144,7 @@ Puppet::Face.define(:config, '0.0.1') do
144
144
 
145
145
  if name == 'environment' && options[:section] == 'main'
146
146
  Puppet.warning _(<<-EOM).chomp
147
- The environment should be set in either the `[user]`, `[agent]`, or `[master]`
147
+ The environment should be set in either the `[user]`, `[agent]`, or `[server]`
148
148
  section. Variables set in the `[agent]` section are used when running
149
149
  `puppet agent`. Variables set in the `[user]` section are used when running
150
150
  various other puppet subcommands, like `puppet apply` and `puppet module`; these
@@ -163,7 +163,24 @@ https://puppet.com/docs/puppet/latest/configuration.html#environment
163
163
  Puppet::FileSystem.touch(path)
164
164
  Puppet::FileSystem.open(path, nil, 'r+:UTF-8') do |file|
165
165
  Puppet::Settings::IniFile.update(file) do |config|
166
- config.set(options[:section], name, value)
166
+ if options[:section] == "master"
167
+ # delete requested master section if it exists,
168
+ # as server section should be used
169
+ setting_string = config.delete("master", name)
170
+ if setting_string
171
+
172
+ if Puppet::Util::Log.sendlevel?(:info)
173
+ report_section_and_environment(options[:section], Puppet.settings[:environment])
174
+ end
175
+
176
+ puts(_("Deleted setting from '%{section_name}': '%{setting_string}', and adding it to 'server' section") %
177
+ { section_name: options[:section], name: name, setting_string: setting_string.strip })
178
+ end
179
+ # add the setting to the to server section instead of master section
180
+ config.set("server", name, value)
181
+ else
182
+ config.set(options[:section], name, value)
183
+ end
167
184
  end
168
185
  end
169
186
  nil
@@ -185,9 +202,9 @@ https://puppet.com/docs/puppet/latest/configuration.html#environment
185
202
 
186
203
  $ puppet config delete setting_name
187
204
 
188
- Delete the setting 'setting_name' from the 'master' configuration domain:
205
+ Delete the setting 'setting_name' from the 'server' configuration domain:
189
206
 
190
- $ puppet config delete setting_name --section master
207
+ $ puppet config delete setting_name --section server
191
208
  EOT
192
209
 
193
210
  when_invoked do |name, options|
@@ -202,18 +219,31 @@ https://puppet.com/docs/puppet/latest/configuration.html#environment
202
219
  if Puppet::FileSystem.exist?(path)
203
220
  Puppet::FileSystem.open(path, nil, 'r+:UTF-8') do |file|
204
221
  Puppet::Settings::IniFile.update(file) do |config|
205
- setting_string = config.delete(options[:section], name)
206
- if setting_string
207
222
 
208
- if Puppet::Util::Log.sendlevel?(:info)
209
- report_section_and_environment(options[:section], Puppet.settings[:environment])
210
- end
223
+ # delete from both master section and server section
224
+ if options[:section] == "master" || options[:section] == "server"
225
+ master_setting_string = config.delete("master", name)
226
+ puts(_("Deleted setting from '%{section_name}': '%{setting_string}'") %
227
+ { section_name: 'master', name: name, setting_string: master_setting_string.strip[/[^=]+/] }) if master_setting_string
211
228
 
229
+ server_setting_string = config.delete("server", name)
212
230
  puts(_("Deleted setting from '%{section_name}': '%{setting_string}'") %
213
- { section_name: options[:section], name: name, setting_string: setting_string.strip })
231
+ { section_name: 'server', name: name, setting_string: server_setting_string.strip[/[^=]+/] }) if server_setting_string
232
+
214
233
  else
215
- Puppet.warning(_("No setting found in configuration file for section '%{section_name}' setting name '%{name}'") %
216
- { section_name: options[:section], name: name })
234
+ setting_string = config.delete(options[:section], name)
235
+ if setting_string
236
+
237
+ if Puppet::Util::Log.sendlevel?(:info)
238
+ report_section_and_environment(options[:section], Puppet.settings[:environment])
239
+ end
240
+
241
+ puts(_("Deleted setting from '%{section_name}': '%{setting_string}'") %
242
+ { section_name: options[:section], name: name, setting_string: setting_string.strip })
243
+ else
244
+ Puppet.warning(_("No setting found in configuration file for section '%{section_name}' setting name '%{name}'") %
245
+ { section_name: options[:section], name: name })
246
+ end
217
247
  end
218
248
  end
219
249
  end