puppet 6.4.5-universal-darwin → 6.5.0-universal-darwin

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 (329) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +10 -10
  3. data/Gemfile +6 -6
  4. data/Gemfile.lock +46 -52
  5. data/ext/build_defaults.yaml +0 -1
  6. data/ext/project_data.yaml +3 -3
  7. data/ext/regexp_nodes/regexp_nodes.rb +4 -4
  8. data/ext/solaris/smf/puppet.xml +0 -2
  9. data/ext/windows/eventlog/Rakefile +32 -0
  10. data/ext/windows/eventlog/puppetres.dll +0 -0
  11. data/ext/windows/eventlog/puppetres.mc +18 -0
  12. data/ext/windows/service/daemon.rb +8 -38
  13. data/install.rb +24 -6
  14. data/lib/puppet.rb +3 -1
  15. data/lib/puppet/application.rb +1 -1
  16. data/lib/puppet/application/agent.rb +11 -34
  17. data/lib/puppet/application/apply.rb +6 -6
  18. data/lib/puppet/application/describe.rb +9 -3
  19. data/lib/puppet/application/device.rb +4 -14
  20. data/lib/puppet/application/doc.rb +1 -1
  21. data/lib/puppet/application/lookup.rb +2 -2
  22. data/lib/puppet/application/resource.rb +4 -4
  23. data/lib/puppet/application/script.rb +2 -2
  24. data/lib/puppet/application/ssl.rb +10 -9
  25. data/lib/puppet/configurer.rb +30 -86
  26. data/lib/puppet/configurer/downloader.rb +6 -2
  27. data/lib/puppet/defaults.rb +50 -44
  28. data/lib/puppet/error.rb +14 -9
  29. data/lib/puppet/face/catalog.rb +20 -1
  30. data/lib/puppet/face/config.rb +48 -10
  31. data/lib/puppet/face/facts.rb +1 -1
  32. data/lib/puppet/face/help.rb +1 -1
  33. data/lib/puppet/face/module/list.rb +5 -5
  34. data/lib/puppet/face/module/search.rb +1 -1
  35. data/lib/puppet/face/module/uninstall.rb +1 -1
  36. data/lib/puppet/face/module/upgrade.rb +1 -1
  37. data/lib/puppet/face/parser.rb +48 -9
  38. data/lib/puppet/face/plugin.rb +2 -9
  39. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  40. data/lib/puppet/file_system.rb +12 -2
  41. data/lib/puppet/file_system/file_impl.rb +6 -3
  42. data/lib/puppet/file_system/memory_file.rb +1 -1
  43. data/lib/puppet/file_system/posix.rb +2 -3
  44. data/lib/puppet/forge.rb +3 -3
  45. data/lib/puppet/functions.rb +2 -1
  46. data/lib/puppet/functions/camelcase.rb +2 -2
  47. data/lib/puppet/functions/epp.rb +4 -4
  48. data/lib/puppet/functions/find_file.rb +9 -9
  49. data/lib/puppet/functions/inline_epp.rb +5 -5
  50. data/lib/puppet/functions/regsubst.rb +6 -8
  51. data/lib/puppet/gettext/module_translations.rb +1 -1
  52. data/lib/puppet/graph/rb_tree_map.rb +2 -2
  53. data/lib/puppet/graph/simple_graph.rb +3 -4
  54. data/lib/puppet/indirector/catalog/compiler.rb +5 -11
  55. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  56. data/lib/puppet/indirector/hiera.rb +0 -2
  57. data/lib/puppet/indirector/resource/ral.rb +3 -1
  58. data/lib/puppet/indirector/resource/validator.rb +1 -1
  59. data/lib/puppet/interface.rb +1 -2
  60. data/lib/puppet/loaders.rb +1 -0
  61. data/lib/puppet/metatype/manager.rb +1 -1
  62. data/lib/puppet/module.rb +1 -1
  63. data/lib/puppet/module/task.rb +4 -20
  64. data/lib/puppet/module_tool/applications/installer.rb +1 -1
  65. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
  66. data/lib/puppet/module_tool/metadata.rb +1 -1
  67. data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
  68. data/lib/puppet/module_tool/tar/mini.rb +2 -12
  69. data/lib/puppet/network/http/api/indirected_routes.rb +11 -12
  70. data/lib/puppet/network/http/connection.rb +12 -10
  71. data/lib/puppet/network/http/factory.rb +11 -1
  72. data/lib/puppet/network/http/pool.rb +0 -2
  73. data/lib/puppet/network/http/site.rb +1 -1
  74. data/lib/puppet/network/resolver.rb +2 -2
  75. data/lib/puppet/node/environment.rb +2 -4
  76. data/lib/puppet/pal/pal_impl.rb +2 -2
  77. data/lib/puppet/parser/ast.rb +1 -1
  78. data/lib/puppet/parser/ast/resourceparam.rb +1 -1
  79. data/lib/puppet/parser/functions.rb +1 -1
  80. data/lib/puppet/parser/functions/epp.rb +3 -3
  81. data/lib/puppet/parser/functions/fail.rb +8 -1
  82. data/lib/puppet/parser/functions/inline_epp.rb +5 -5
  83. data/lib/puppet/parser/scope.rb +7 -8
  84. data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
  85. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
  86. data/lib/puppet/pops/evaluator/external_syntax_support.rb +2 -3
  87. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -4
  88. data/lib/puppet/pops/loader/null_loader.rb +60 -0
  89. data/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +6 -4
  90. data/lib/puppet/pops/loader/task_instantiator.rb +0 -4
  91. data/lib/puppet/pops/loaders.rb +1 -1
  92. data/lib/puppet/pops/lookup/hiera_config.rb +0 -1
  93. data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
  94. data/lib/puppet/pops/merge_strategy.rb +18 -22
  95. data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
  96. data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
  97. data/lib/puppet/pops/parser/locator.rb +1 -1
  98. data/lib/puppet/pops/parser/pn_parser.rb +16 -17
  99. data/lib/puppet/pops/puppet_stack.rb +49 -51
  100. data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
  101. data/lib/puppet/pops/types/string_converter.rb +10 -10
  102. data/lib/puppet/pops/types/types.rb +6 -5
  103. data/lib/puppet/property.rb +1 -1
  104. data/lib/puppet/property/ensure.rb +1 -1
  105. data/lib/puppet/provider/exec.rb +2 -6
  106. data/lib/puppet/provider/file/posix.rb +0 -5
  107. data/lib/puppet/provider/nameservice.rb +3 -10
  108. data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
  109. data/lib/puppet/provider/nameservice/pw.rb +2 -2
  110. data/lib/puppet/provider/package.rb +0 -2
  111. data/lib/puppet/provider/package/apt.rb +1 -5
  112. data/lib/puppet/provider/package/dnf.rb +1 -1
  113. data/lib/puppet/provider/package/dpkg.rb +18 -34
  114. data/lib/puppet/provider/package/openbsd.rb +1 -1
  115. data/lib/puppet/provider/package/pip.rb +13 -37
  116. data/lib/puppet/provider/package/portage.rb +4 -4
  117. data/lib/puppet/provider/package/puppet_gem.rb +1 -1
  118. data/lib/puppet/provider/package/rpm.rb +18 -56
  119. data/lib/puppet/provider/package/windows/package.rb +1 -1
  120. data/lib/puppet/provider/package/yum.rb +5 -9
  121. data/lib/puppet/provider/package_targetable.rb +4 -7
  122. data/lib/puppet/provider/parsedfile.rb +1 -1
  123. data/lib/puppet/provider/service/daemontools.rb +9 -9
  124. data/lib/puppet/provider/service/launchd.rb +5 -20
  125. data/lib/puppet/provider/service/openbsd.rb +1 -1
  126. data/lib/puppet/provider/service/rcng.rb +2 -2
  127. data/lib/puppet/provider/service/runit.rb +8 -2
  128. data/lib/puppet/provider/service/systemd.rb +19 -14
  129. data/lib/puppet/provider/service/windows.rb +0 -8
  130. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  131. data/lib/puppet/provider/user/hpux.rb +1 -1
  132. data/lib/puppet/provider/user/pw.rb +3 -12
  133. data/lib/puppet/provider/user/user_role_add.rb +1 -5
  134. data/lib/puppet/provider/user/useradd.rb +20 -45
  135. data/lib/puppet/provider/user/windows_adsi.rb +5 -4
  136. data/lib/puppet/reference/configuration.rb +3 -3
  137. data/lib/puppet/reference/indirection.rb +2 -2
  138. data/lib/puppet/reference/metaparameter.rb +3 -1
  139. data/lib/puppet/reference/providers.rb +3 -1
  140. data/lib/puppet/reference/type.rb +9 -3
  141. data/lib/puppet/reports.rb +1 -1
  142. data/lib/puppet/resource.rb +1 -18
  143. data/lib/puppet/resource/catalog.rb +1 -1
  144. data/lib/puppet/rest/routes.rb +30 -17
  145. data/lib/puppet/settings.rb +3 -43
  146. data/lib/puppet/settings/environment_conf.rb +0 -1
  147. data/lib/puppet/ssl/certificate_request.rb +12 -2
  148. data/lib/puppet/ssl/host.rb +2 -2
  149. data/lib/puppet/ssl/oids.rb +1 -1
  150. data/lib/puppet/ssl/ssl_provider.rb +11 -5
  151. data/lib/puppet/ssl/state_machine.rb +102 -98
  152. data/lib/puppet/test/test_helper.rb +1 -0
  153. data/lib/puppet/transaction.rb +11 -33
  154. data/lib/puppet/transaction/report.rb +1 -1
  155. data/lib/puppet/type.rb +4 -2
  156. data/lib/puppet/type/exec.rb +17 -23
  157. data/lib/puppet/type/file.rb +39 -11
  158. data/lib/puppet/type/file/data_sync.rb +1 -5
  159. data/lib/puppet/type/group.rb +2 -4
  160. data/lib/puppet/type/notify.rb +3 -4
  161. data/lib/puppet/type/package.rb +3 -20
  162. data/lib/puppet/type/schedule.rb +1 -1
  163. data/lib/puppet/type/service.rb +3 -8
  164. data/lib/puppet/type/user.rb +2 -4
  165. data/lib/puppet/util.rb +29 -39
  166. data/lib/puppet/util/command_line/trollop.rb +1 -1
  167. data/lib/puppet/util/execution.rb +3 -4
  168. data/lib/puppet/util/http_proxy.rb +19 -27
  169. data/lib/puppet/util/log.rb +2 -2
  170. data/lib/puppet/util/log/destinations.rb +2 -2
  171. data/lib/puppet/util/logging.rb +20 -32
  172. data/lib/puppet/util/metric.rb +2 -2
  173. data/lib/puppet/util/monkey_patches.rb +33 -0
  174. data/lib/puppet/util/pidlock.rb +2 -3
  175. data/lib/puppet/util/provider_features.rb +4 -2
  176. data/lib/puppet/util/rdoc.rb +1 -1
  177. data/lib/puppet/util/reference.rb +1 -1
  178. data/lib/puppet/util/resource_template.rb +1 -1
  179. data/lib/puppet/util/selinux.rb +2 -8
  180. data/lib/puppet/util/skip_tags.rb +4 -0
  181. data/lib/puppet/util/windows/adsi.rb +18 -48
  182. data/lib/puppet/util/windows/process.rb +8 -8
  183. data/lib/puppet/util/windows/registry.rb +5 -7
  184. data/lib/puppet/util/windows/security.rb +0 -2
  185. data/lib/puppet/util/windows/service.rb +4 -149
  186. data/lib/puppet/util/windows/sid.rb +0 -1
  187. data/lib/puppet/vendor.rb +1 -1
  188. data/lib/puppet/version.rb +1 -1
  189. data/lib/puppet/x509/cert_provider.rb +81 -24
  190. data/locales/puppet.pot +462 -482
  191. data/man/man5/puppet.conf.5 +43 -44
  192. data/man/man8/puppet-agent.8 +1 -1
  193. data/man/man8/puppet-apply.8 +3 -3
  194. data/man/man8/puppet-catalog.8 +31 -3
  195. data/man/man8/puppet-config.8 +1 -1
  196. data/man/man8/puppet-describe.8 +1 -1
  197. data/man/man8/puppet-device.8 +1 -1
  198. data/man/man8/puppet-doc.8 +1 -1
  199. data/man/man8/puppet-epp.8 +1 -1
  200. data/man/man8/puppet-facts.8 +1 -1
  201. data/man/man8/puppet-filebucket.8 +1 -1
  202. data/man/man8/puppet-generate.8 +1 -1
  203. data/man/man8/puppet-help.8 +1 -1
  204. data/man/man8/puppet-key.8 +1 -1
  205. data/man/man8/puppet-lookup.8 +1 -1
  206. data/man/man8/puppet-man.8 +1 -1
  207. data/man/man8/puppet-module.8 +1 -1
  208. data/man/man8/puppet-node.8 +1 -1
  209. data/man/man8/puppet-parser.8 +1 -1
  210. data/man/man8/puppet-plugin.8 +1 -1
  211. data/man/man8/puppet-report.8 +1 -1
  212. data/man/man8/puppet-resource.8 +1 -1
  213. data/man/man8/puppet-script.8 +1 -1
  214. data/man/man8/puppet-ssl.8 +1 -1
  215. data/man/man8/puppet-status.8 +1 -1
  216. data/man/man8/puppet.8 +3 -3
  217. data/spec/fixtures/ssl/127.0.0.1-key.pem +56 -56
  218. data/spec/fixtures/ssl/127.0.0.1.pem +27 -27
  219. data/spec/fixtures/ssl/bad-basic-constraints.pem +32 -32
  220. data/spec/fixtures/ssl/bad-int-basic-constraints.pem +30 -30
  221. data/spec/fixtures/ssl/ca.pem +30 -30
  222. data/spec/fixtures/ssl/crl.pem +15 -15
  223. data/spec/fixtures/ssl/ec-key.pem +18 -0
  224. data/spec/fixtures/ssl/ec.pem +40 -0
  225. data/spec/fixtures/ssl/encrypted-ec-key.pem +21 -0
  226. data/spec/fixtures/ssl/encrypted-key.pem +57 -57
  227. data/spec/fixtures/ssl/intermediate-agent-crl.pem +16 -16
  228. data/spec/fixtures/ssl/intermediate-agent.pem +33 -33
  229. data/spec/fixtures/ssl/intermediate-crl.pem +17 -17
  230. data/spec/fixtures/ssl/intermediate.pem +31 -31
  231. data/spec/fixtures/ssl/pluto-key.pem +56 -56
  232. data/spec/fixtures/ssl/pluto.pem +28 -28
  233. data/spec/fixtures/ssl/request-key.pem +56 -56
  234. data/spec/fixtures/ssl/request.pem +24 -24
  235. data/spec/fixtures/ssl/revoked-key.pem +56 -56
  236. data/spec/fixtures/ssl/revoked.pem +25 -25
  237. data/spec/fixtures/ssl/signed-key.pem +56 -56
  238. data/spec/fixtures/ssl/signed.pem +25 -25
  239. data/spec/fixtures/ssl/tampered-cert.pem +27 -27
  240. data/spec/fixtures/ssl/tampered-csr.pem +24 -24
  241. data/spec/fixtures/unit/pops/loaders/loaders/mix_4x_and_3x_functions/usee/lib/puppet/parser/functions/func_with_syntax_error.rb +9 -0
  242. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +24 -0
  243. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +24 -0
  244. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +24 -0
  245. data/spec/integration/configurer_spec.rb +0 -52
  246. data/spec/integration/provider/service/init_spec.rb +1 -0
  247. data/spec/integration/provider/service/systemd_spec.rb +5 -8
  248. data/spec/integration/type/file_spec.rb +38 -28
  249. data/spec/integration/util/execution_spec.rb +0 -27
  250. data/spec/lib/puppet/certificate_factory.rb +2 -2
  251. data/spec/lib/puppet/test_ca.rb +17 -4
  252. data/spec/lib/puppet_spec/fixtures.rb +4 -0
  253. data/spec/spec_helper.rb +0 -28
  254. data/spec/unit/application/agent_spec.rb +34 -67
  255. data/spec/unit/application/device_spec.rb +1 -27
  256. data/spec/unit/application/ssl_spec.rb +60 -35
  257. data/spec/unit/configurer_spec.rb +399 -395
  258. data/spec/unit/defaults_spec.rb +4 -4
  259. data/spec/unit/face/facts_spec.rb +0 -9
  260. data/spec/unit/face/parser_spec.rb +69 -22
  261. data/spec/unit/face/plugin_spec.rb +0 -8
  262. data/spec/unit/file_system_spec.rb +30 -1
  263. data/spec/unit/forge/forge_spec.rb +3 -1
  264. data/spec/unit/forge/repository_spec.rb +3 -1
  265. data/spec/unit/indirector/catalog/compiler_spec.rb +5 -62
  266. data/spec/unit/indirector/resource/ral_spec.rb +4 -4
  267. data/spec/unit/module_tool/tar/mini_spec.rb +1 -1
  268. data/spec/unit/network/http/api/indirected_routes_spec.rb +10 -25
  269. data/spec/unit/network/http/connection_spec.rb +145 -119
  270. data/spec/unit/network/http/factory_spec.rb +5 -27
  271. data/spec/unit/parser/scope_spec.rb +0 -10
  272. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +3 -8
  273. data/spec/unit/pops/loaders/loaders_spec.rb +4 -0
  274. data/spec/unit/pops/loaders/module_loaders_spec.rb +0 -37
  275. data/spec/unit/pops/types/types_spec.rb +27 -0
  276. data/spec/unit/provider/exec_spec.rb +0 -209
  277. data/spec/unit/provider/package/aptrpm_spec.rb +1 -1
  278. data/spec/unit/provider/package/dnf_spec.rb +0 -7
  279. data/spec/unit/provider/package/dpkg_spec.rb +80 -240
  280. data/spec/unit/provider/package/pip_spec.rb +8 -61
  281. data/spec/unit/provider/package/portage_spec.rb +4 -4
  282. data/spec/unit/provider/package/rpm_spec.rb +16 -150
  283. data/spec/unit/provider/package/yum_spec.rb +0 -7
  284. data/spec/unit/provider/service/daemontools_spec.rb +0 -24
  285. data/spec/unit/provider/service/launchd_spec.rb +0 -28
  286. data/spec/unit/provider/service/runit_spec.rb +0 -24
  287. data/spec/unit/provider/service/systemd_spec.rb +25 -39
  288. data/spec/unit/provider/service/windows_spec.rb +0 -20
  289. data/spec/unit/provider/user/hpux_spec.rb +2 -2
  290. data/spec/unit/provider/user/pw_spec.rb +0 -37
  291. data/spec/unit/provider/user/useradd_spec.rb +0 -88
  292. data/spec/unit/resource_spec.rb +1 -26
  293. data/spec/unit/ssl/host_spec.rb +5 -0
  294. data/spec/unit/ssl/ssl_provider_spec.rb +36 -11
  295. data/spec/unit/ssl/state_machine_spec.rb +233 -158
  296. data/spec/unit/transaction_spec.rb +0 -64
  297. data/spec/unit/type/exec_spec.rb +12 -15
  298. data/spec/unit/type/file/content_spec.rb +3 -9
  299. data/spec/unit/type/file/source_spec.rb +4 -4
  300. data/spec/unit/type/file_spec.rb +15 -11
  301. data/spec/unit/type/package_spec.rb +0 -5
  302. data/spec/unit/type/schedule_spec.rb +1 -3
  303. data/spec/unit/type/service_spec.rb +0 -16
  304. data/spec/unit/util/execution_spec.rb +0 -16
  305. data/spec/unit/util/http_proxy_spec.rb +21 -151
  306. data/spec/unit/util/ldap/manager_spec.rb +0 -15
  307. data/spec/unit/util/log/destinations_spec.rb +3 -7
  308. data/spec/unit/util/log_spec.rb +138 -0
  309. data/spec/unit/util/logging_spec.rb +0 -200
  310. data/spec/unit/util/pidlock_spec.rb +0 -26
  311. data/spec/unit/util/skip_tags_spec.rb +14 -0
  312. data/spec/unit/util/windows/adsi_spec.rb +0 -51
  313. data/spec/unit/util/windows/service_spec.rb +0 -9
  314. data/spec/unit/util_spec.rb +10 -0
  315. data/spec/unit/x509/cert_provider_spec.rb +82 -43
  316. data/tasks/generate_cert_fixtures.rake +13 -1
  317. data/tasks/manpages.rake +0 -1
  318. metadata +26 -20
  319. data/ext/cert_inspector +0 -140
  320. data/ext/envpuppet +0 -139
  321. data/ext/envpuppet.bat +0 -14
  322. data/ext/puppet-test +0 -476
  323. data/ext/pure_ruby_dsl/dsl_test.rb +0 -7
  324. data/ext/upload_facts.rb +0 -119
  325. data/lib/puppet/provider/package/dnfmodule.rb +0 -87
  326. data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +0 -11
  327. data/spec/integration/type/notify_spec.rb +0 -46
  328. data/spec/unit/provider/package/dnfmodule_spec.rb +0 -186
  329. data/spec/unit/provider/package_targetable_spec.rb +0 -60
@@ -145,6 +145,7 @@ module Puppet::Test
145
145
  Puppet::Util::Profiler.clear
146
146
 
147
147
  Puppet::SSL::Host.reset
148
+ Puppet::Rest::Routes.clear
148
149
 
149
150
  Puppet.clear_deprecation_warnings
150
151
  end
@@ -57,11 +57,7 @@ class Puppet::Transaction
57
57
 
58
58
  @prefetch_failed_providers = Hash.new { |h,k| h[k] = {} }
59
59
 
60
- # With merge_dependency_warnings, notify and warn about class dependency failures ... just once per class. TJK 2019-09-09
61
- @merge_dependency_warnings = Puppet[:merge_dependency_warnings]
62
60
  @failed_dependencies_already_notified = Set.new()
63
- @failed_class_dependencies_already_notified = Set.new()
64
- @failed_class_dependencies_already_warned = Set.new()
65
61
  end
66
62
 
67
63
  # Invoke the pre_run_check hook in every resource in the catalog.
@@ -291,25 +287,15 @@ class Puppet::Transaction
291
287
  # explosion of edges, we also ended up reporting failures for containers
292
288
  # like class and stage. This is undesirable; while just skipping the
293
289
  # output isn't perfect, it is RC-safe. --daniel 2011-06-07
294
- is_puppet_class = resource.class == Puppet::Type.type(:whit)
295
- # With merge_dependency_warnings, notify about class dependency failures ... just once per class. TJK 2019-09-09
290
+ suppress_report = (resource.class == Puppet::Type.type(:whit))
291
+
296
292
  s = resource_status(resource)
297
293
  if s && s.dependency_failed?
298
- if @merge_dependency_warnings && is_puppet_class
299
- # Notes: Puppet::Resource::Status.failed_dependencies() is an Array of Puppet::Resource(s) and
300
- # Puppet::Resource.ref() calls Puppet::Resource.to_s() which is: "#{type}[#{title}]" and
301
- # Puppet::Resource.resource_status(resource) calls Puppet::Resource.to_s()
302
- class_dependencies_to_be_notified = (s.failed_dependencies.map(&:ref) - @failed_class_dependencies_already_notified.to_a)
303
- class_dependencies_to_be_notified.each do |dep_ref|
304
- resource.notice _("Class dependency %{dep} has failures: %{status}") % { dep: dep_ref, status: resource_status(dep_ref).failed }
305
- end
306
- @failed_class_dependencies_already_notified.merge(class_dependencies_to_be_notified)
307
- else
308
- unless @merge_dependency_warnings || is_puppet_class
309
- s.failed_dependencies.find_all { |d| !(@failed_dependencies_already_notified.include?(d.ref)) }.each do |dep|
310
- resource.notice _("Dependency %{dep} has failures: %{status}") % { dep: dep, status: resource_status(dep).failed }
311
- @failed_dependencies_already_notified.add(dep.ref)
312
- end
294
+ # See above. --daniel 2011-06-06
295
+ unless suppress_report then
296
+ s.failed_dependencies.find_all { |d| !(@failed_dependencies_already_notified.include?(d.ref)) }.each do |dep|
297
+ resource.notice _("Dependency %{dep} has failures: %{status}") % { dep: dep, status: resource_status(dep).failed }
298
+ @failed_dependencies_already_notified.add(dep.ref)
313
299
  end
314
300
  end
315
301
  end
@@ -409,19 +395,11 @@ class Puppet::Transaction
409
395
  # explosion of edges, we also ended up reporting failures for containers
410
396
  # like class and stage. This is undesirable; while just skipping the
411
397
  # output isn't perfect, it is RC-safe. --daniel 2011-06-07
412
- # With merge_dependency_warnings, warn about class dependency failures ... just once per class. TJK 2019-09-09
413
- unless resource.class == Puppet::Type.type(:whit)
414
- if @merge_dependency_warnings && resource.parent && failed_dependencies?(resource.parent)
415
- ps = resource_status(resource.parent)
416
- ps.failed_dependencies.find_all { |d| !(@failed_class_dependencies_already_warned.include?(d.ref)) }.each do |dep|
417
- resource.parent.warning _("Skipping resources in class because of failed class dependencies")
418
- @failed_class_dependencies_already_warned.add(dep.ref)
419
- end
420
- else
421
- resource.warning _("Skipping because of failed dependencies")
422
- end
398
+ unless resource.class == Puppet::Type.type(:whit) then
399
+ resource.warning _("Skipping because of failed dependencies")
423
400
  end
424
- elsif resource_status(resource).failed? && @prefetch_failed_providers[resource.type][resource.provider.class.name]
401
+ elsif resource_status(resource).failed? &&
402
+ @prefetch_failed_providers[resource.type][resource.provider.class.name]
425
403
  #Do not try to evaluate a resource with a known failed provider
426
404
  resource.warning _("Skipping because provider prefetch failed")
427
405
  elsif resource.virtual?
@@ -346,7 +346,7 @@ class Puppet::Transaction::Report
346
346
  report = raw_summary
347
347
 
348
348
  ret = ""
349
- report.keys.sort_by(&:to_s).each do |key|
349
+ report.keys.sort { |a,b| a.to_s <=> b.to_s }.each do |key|
350
350
  ret += "#{Puppet::Util::Metric.labelize(key)}:\n"
351
351
 
352
352
  report[key].keys.sort { |a,b|
@@ -1454,7 +1454,7 @@ class Type
1454
1454
  }
1455
1455
 
1456
1456
  Tags are useful for things like applying a subset of a host's configuration
1457
- with [the `tags` setting](https://puppet.com/docs/puppet/latest/configuration.html#tags)
1457
+ with [the `tags` setting](/puppet/latest/configuration.html#tags)
1458
1458
  (e.g. `puppet agent --test --tags bootstrap`)."
1459
1459
 
1460
1460
  munge do |tags|
@@ -1916,7 +1916,9 @@ end
1916
1916
  # Since we're mixing @doc with text from other sources, we must normalize
1917
1917
  # its indentation with scrub. But we don't need to manually scrub the
1918
1918
  # provider's doc string, since markdown_definitionlist sanitizes its inputs.
1919
- scrub(@doc) + "Available providers are:\n\n" + parenttype.providers.sort_by(&:to_s).collect { |i|
1919
+ scrub(@doc) + "Available providers are:\n\n" + parenttype.providers.sort { |a,b|
1920
+ a.to_s <=> b.to_s
1921
+ }.collect { |i|
1920
1922
  markdown_definitionlist( i, scrub(parenttype().provider(i).doc) )
1921
1923
  }.join
1922
1924
  end
@@ -23,6 +23,9 @@ module Puppet
23
23
  consider developing a custom resource type instead, as it will be much
24
24
  more predictable and maintainable.
25
25
 
26
+ **Duplication:** Even though `command` is the namevar, Puppet allows
27
+ multiple `exec` resources with the same `command` value.
28
+
26
29
  **Refresh:** `exec` resources can respond to refresh events (via
27
30
  `notify`, `subscribe`, or the `~>` arrow). The refresh behavior of execs
28
31
  is non-standard, and can be affected by the `refresh` and
@@ -150,13 +153,9 @@ module Puppet
150
153
  end
151
154
  end
152
155
  unless log == :false
153
- if @resource.parameter(:command).sensitive
154
- self.send(log, "[output redacted]")
155
- else
156
- @output.split(/\n/).each { |line|
157
- self.send(log, line)
158
- }
159
- end
156
+ @output.split(/\n/).each { |line|
157
+ self.send(log, line)
158
+ }
160
159
  end
161
160
  end
162
161
 
@@ -180,7 +179,10 @@ module Puppet
180
179
  succeeds, any output produced will be logged at the instance's
181
180
  normal log level (usually `notice`), but if the command fails
182
181
  (meaning its return code does not match the specified code) then
183
- any output is logged at the `err` log level."
182
+ any output is logged at the `err` log level.
183
+
184
+ Multiple `exec` resources can use the same `command` value; Puppet
185
+ only uses the resource title to ensure `exec`s are unique."
184
186
 
185
187
  validate do |command|
186
188
  raise ArgumentError, _("Command must be a String, got value of class %{klass}") % { klass: command.class } unless command.is_a? String
@@ -461,13 +463,9 @@ module Puppet
461
463
  return false
462
464
  end
463
465
 
464
- if sensitive
465
- self.debug("[output redacted]")
466
- else
467
- output.split(/\n/).each { |line|
468
- self.debug(line)
469
- }
470
- end
466
+ output.split(/\n/).each { |line|
467
+ self.debug(line)
468
+ }
471
469
 
472
470
  status.exitstatus != 0
473
471
  end
@@ -517,13 +515,9 @@ module Puppet
517
515
  return false
518
516
  end
519
517
 
520
- if sensitive
521
- self.debug("[output redacted]")
522
- else
523
- output.split(/\n/).each { |line|
524
- self.debug(line)
525
- }
526
- end
518
+ output.split(/\n/).each { |line|
519
+ self.debug(line)
520
+ }
527
521
 
528
522
  status.exitstatus == 0
529
523
  end
@@ -640,7 +634,7 @@ module Puppet
640
634
  sensitive = false
641
635
  parameters_to_check = [:command, :unless, :onlyif]
642
636
 
643
- parameters_to_check.each do |p|
637
+ parameters_to_check.each do |p|
644
638
  if sensitive_parameters.include?(p)
645
639
  sensitive_parameters.delete(p)
646
640
  sensitive = true
@@ -32,9 +32,9 @@ Puppet::Type.newtype(:file) do
32
32
  **Autorequires:** If Puppet is managing the user or group that owns a
33
33
  file, the file resource will autorequire them. If Puppet is managing any
34
34
  parent directories of a file, the file resource autorequires them.
35
-
36
- Warning: Enabling `recurse` on directories containing large numbers of
37
- files slows agent runs. To manage file attributes for many files,
35
+
36
+ Warning: Enabling `recurse` on directories containing large numbers of
37
+ files slows agent runs. To manage file attributes for many files,
38
38
  consider using alternative methods such as the `chmod_r`, `chown_r`,
39
39
  or `recursive_file_permissions` modules from the Forge."
40
40
 
@@ -298,6 +298,30 @@ Puppet::Type.newtype(:file) do
298
298
  defaultto :true
299
299
  end
300
300
 
301
+ newparam(:staging_location) do
302
+ desc "When rendering a file first render it to this location. The default
303
+ location is the same path as the desired location with a unique filename.
304
+ This parameter is useful in conjuction with validate_cmd to test a
305
+ file before moving the file to it's final location.
306
+ WARNING: File replacement is only guaranteed to be atomic if the staging
307
+ location is on the same filesystem as the final location."
308
+
309
+ validate do |value|
310
+ unless Puppet::Util.absolute_path?(value)
311
+ fail Puppet::Error, "File paths must be fully qualified, not '#{value}'"
312
+ end
313
+ end
314
+
315
+ munge do |value|
316
+ if value.start_with?('//') and ::File.basename(value) == "/"
317
+ # This is a UNC path pointing to a share, so don't add a trailing slash
318
+ ::File.expand_path(value)
319
+ else
320
+ ::File.join(::File.split(::File.expand_path(value)))
321
+ end
322
+ end
323
+ end
324
+
301
325
  newparam(:validate_cmd) do
302
326
  desc "A command for validating the file's syntax before replacing it. If
303
327
  Puppet would need to rewrite a file due to new `source` or `content`, it
@@ -577,7 +601,8 @@ Puppet::Type.newtype(:file) do
577
601
  # remote system.
578
602
  mark_children_for_purging(children) if self.purge?
579
603
 
580
- result = children.values.sort_by { |a| a[:path] }
604
+ # REVISIT: sort_by is more efficient?
605
+ result = children.values.sort { |a, b| a[:path] <=> b[:path] }
581
606
  remove_less_specific_files(result)
582
607
  end
583
608
 
@@ -861,7 +886,16 @@ Puppet::Type.newtype(:file) do
861
886
  mode_int = mode ? symbolic_mode_to_int(mode, Puppet::Util::DEFAULT_POSIX_MODE) : nil
862
887
 
863
888
  if write_temporary_file?
864
- Puppet::Util.replace_file(self[:path], mode_int) do |file|
889
+ if self[:validate_cmd]
890
+ validate_callback = proc { |path|
891
+ output = Puppet::Util::Execution.execute(self[:validate_cmd].gsub(self[:validate_replacement], path), :failonfail => true, :combine => true)
892
+ output.split(/\n/).each { |line|
893
+ self.debug(line)
894
+ }
895
+ }
896
+ end
897
+
898
+ Puppet::Util.replace_file(self[:path], mode_int, staging_location: self[:staging_location], validate_callback: validate_callback) do |file|
865
899
  file.binmode
866
900
  devfail 'a property should have been provided if write_temporary_file? returned true' if property.nil?
867
901
  content_checksum = property.write(file)
@@ -879,12 +913,6 @@ Puppet::Type.newtype(:file) do
879
913
  end
880
914
 
881
915
  fail_if_checksum_is_wrong(file.path, content_checksum) if validate_checksum?
882
- if self[:validate_cmd]
883
- output = Puppet::Util::Execution.execute(self[:validate_cmd].gsub(self[:validate_replacement], file.path), :failonfail => true, :combine => true)
884
- output.split(/\n/).each { |line|
885
- self.debug(line)
886
- }
887
- end
888
916
  end
889
917
  else
890
918
  umask = mode ? 000 : 022
@@ -42,11 +42,7 @@ module Puppet
42
42
  send resource[:loglevel], "[diff redacted]"
43
43
  else
44
44
  write_temporarily(param) do |path|
45
- diff_output = diff(resource[:path], path)
46
- if diff_output.encoding == Encoding::BINARY || !diff_output.valid_encoding?
47
- diff_output = "Binary files #{resource[:path]} and #{path} differ"
48
- end
49
- send resource[:loglevel], "\n" + diff_output
45
+ send resource[:loglevel], "\n" + diff(resource[:path], path)
50
46
  end
51
47
  end
52
48
  end
@@ -175,8 +175,7 @@ module Puppet
175
175
  end
176
176
 
177
177
  newparam(:ia_load_module, :required_features => :manages_aix_lam) do
178
- desc "The name of the I&A module to use to manage this group.
179
- This should be set to `files` if managing local groups."
178
+ desc "The name of the I&A module to use to manage this user"
180
179
  end
181
180
 
182
181
  newproperty(:attributes, :parent => Puppet::Property::KeyValue, :required_features => :manages_aix_lam) do
@@ -217,8 +216,7 @@ module Puppet
217
216
  :required_features => :libuser,
218
217
  :parent => Puppet::Parameter::Boolean) do
219
218
  desc "Forces the management of local accounts when accounts are also
220
- being managed by some other NSS. For AIX, refer to the
221
- `ia_load_module` parameter."
219
+ being managed by some other NSS"
222
220
  defaultto false
223
221
  end
224
222
 
@@ -4,19 +4,18 @@
4
4
 
5
5
  module Puppet
6
6
  Type.newtype(:notify) do
7
- @doc = "Sends an arbitrary message to the agent run-time log."
7
+ @doc = "Sends an arbitrary message to the agent run-time log. It's important to note that the notify resource type is not idempotent. As a result, notifications are shown as a change on every Puppet run."
8
8
 
9
9
  apply_to_all
10
10
 
11
11
  newproperty(:message, :idempotent => false) do
12
12
  desc "The message to be sent to the log."
13
13
  def sync
14
- message = @sensitive ? 'Sensitive [value redacted]' : self.should
15
14
  case @resource["withpath"]
16
15
  when :true
17
- send(@resource[:loglevel], message)
16
+ send(@resource[:loglevel], self.should)
18
17
  else
19
- Puppet.send(@resource[:loglevel], message)
18
+ Puppet.send(@resource[:loglevel], self.should)
20
19
  end
21
20
  return
22
21
  end
@@ -1,4 +1,3 @@
1
- # coding: utf-8
2
1
  # Define the different packaging systems. Each package system is implemented
3
2
  # in a module, which then gets used to individually extend each package object.
4
3
  # This allows packages to exist on the same machine using different packaging
@@ -57,7 +56,6 @@ module Puppet
57
56
  a user or another package. Held is considered a superset of
58
57
  installed.",
59
58
  :methods => [:hold]
60
- feature :install_only, "The provider accepts options to only install packages never update (kernels, etc.)"
61
59
  feature :install_options, "The provider accepts options to be
62
60
  passed to the installer command."
63
61
  feature :uninstall_options, "The provider accepts options to be
@@ -485,16 +483,8 @@ module Puppet
485
483
  end
486
484
 
487
485
  newparam(:flavor) do
488
- desc "OpenBSD and DNF modules support 'flavors', which are
489
- further specifications for which type of package you want."
490
- end
491
-
492
- newparam(:install_only, :boolean => false, :parent => Puppet::Parameter::Boolean, :required_features => :install_only) do
493
- desc <<-EOT
494
- It should be set for packages that should only ever be installed,
495
- never updated. Kernels in particular fall into this category.
496
- EOT
497
- defaultto false
486
+ desc "OpenBSD supports 'flavors', which are further specifications for
487
+ which type of package you want."
498
488
  end
499
489
 
500
490
  newparam(:install_options, :parent => Puppet::Parameter::PackageOptions, :required_features => :install_options) do
@@ -548,14 +538,7 @@ module Puppet
548
538
  newparam(:allow_virtual, :boolean => true, :parent => Puppet::Parameter::Boolean, :required_features => :virtual_packages) do
549
539
  desc 'Specifies if virtual package names are allowed for install and uninstall.'
550
540
 
551
- defaultto do
552
- provider_class = provider.class
553
- if provider_class.respond_to?(:defaultto_allow_virtual)
554
- provider_class.defaultto_allow_virtual
555
- else
556
- true
557
- end
558
- end
541
+ defaultto true
559
542
  end
560
543
 
561
544
  autorequire(:file) do
@@ -338,7 +338,7 @@ module Puppet
338
338
  end
339
339
 
340
340
  def weekday_integer?(value)
341
- value.is_a?(Integer) && (0..6).cover?(value)
341
+ value.is_a?(Integer) && (0..6).include?(value)
342
342
  end
343
343
 
344
344
  def weekday_string?(value)
@@ -75,11 +75,6 @@ module Puppet
75
75
  provider.enabled?
76
76
  end
77
77
 
78
- # This only works on Windows systems.
79
- newvalue(:delayed, :event => :service_delayed_start) do
80
- provider.delayed_start
81
- end
82
-
83
78
  # This only makes sense on systemd systems. Static services cannot be enabled
84
79
  # or disabled manually.
85
80
  def insync?(current)
@@ -92,8 +87,8 @@ module Puppet
92
87
  end
93
88
 
94
89
  validate do |value|
95
- if (value == :manual || value == :delayed) && !Puppet::Util::Platform.windows?
96
- raise Puppet::Error.new(_("Setting enable to %{value} is only supported on Microsoft Windows.") % { value: value.to_s} )
90
+ if value == :manual && !Puppet::Util::Platform.windows?
91
+ raise Puppet::Error.new(_("Setting enable to manual is only supported on Microsoft Windows."))
97
92
  end
98
93
  end
99
94
  end
@@ -230,7 +225,7 @@ module Puppet
230
225
  desc "The control variable used to manage services (originally for HP-UX).
231
226
  Defaults to the upcased service name plus `START` replacing dots with
232
227
  underscores, for those providers that support the `controllable` feature."
233
- defaultto { resource.name.tr(".","_").upcase + "_START" if resource.provider.controllable? }
228
+ defaultto { resource.name.gsub(".","_").upcase + "_START" if resource.provider.controllable? }
234
229
  end
235
230
 
236
231
  newparam :hasrestart do
@@ -614,8 +614,7 @@ module Puppet
614
614
  end
615
615
 
616
616
  newparam(:ia_load_module, :required_features => :manages_aix_lam) do
617
- desc "The name of the I&A module to use to manage this user.
618
- This should be set to `files` if managing local users."
617
+ desc "The name of the I&A module to use to manage this user."
619
618
  end
620
619
 
621
620
  newproperty(:attributes, :parent => Puppet::Property::KeyValue, :required_features => :manages_aix_lam) do
@@ -679,8 +678,7 @@ module Puppet
679
678
  :required_features => :libuser,
680
679
  :parent => Puppet::Parameter::Boolean) do
681
680
  desc "Forces the management of local accounts when accounts are also
682
- being managed by some other NSS. For AIX, refer to the
683
- `ia_load_module` parameter."
681
+ being managed by some other NSS"
684
682
  defaultto false
685
683
  end
686
684
 
@@ -322,7 +322,7 @@ module Util
322
322
  params = { :scheme => 'file' }
323
323
 
324
324
  if Puppet::Util::Platform.windows?
325
- path = path.tr('\\', '/')
325
+ path = path.gsub(/\\/, '/')
326
326
 
327
327
  if unc = /^\/\/([^\/]+)(\/.+)/.match(path)
328
328
  params[:host] = unc[1]
@@ -523,44 +523,21 @@ module Util
523
523
 
524
524
  module_function :thinmark
525
525
 
526
- PUPPET_STACK_INSERTION_FRAME = /.*puppet_stack\.rb.*in.*`stack'/
527
-
528
526
  # utility method to get the current call stack and format it to a human-readable string (which some IDEs/editors
529
527
  # will recognize as links to the line numbers in the trace)
530
- def self.pretty_backtrace(backtrace = caller(1), puppetstack = [])
531
- format_backtrace_array(backtrace, puppetstack).join("\n")
532
- end
533
-
534
- # arguments may be a Ruby stack, with an optional Puppet stack argument,
535
- # or just a Puppet stack.
536
- # stacks may be an Array of Strings "/foo.rb:0 in `blah'" or
537
- # an Array of Arrays that represent a frame: ["/foo.pp", 0]
538
- def self.format_backtrace_array(primary_stack, puppetstack = [])
539
- primary_stack.flat_map do |frame|
540
- frame = format_puppetstack_frame(frame) if frame.is_a?(Array)
541
- primary_frame = resolve_stackframe(frame)
542
-
543
- if primary_frame =~ PUPPET_STACK_INSERTION_FRAME && !puppetstack.empty?
544
- [resolve_stackframe(format_puppetstack_frame(puppetstack.shift)),
545
- primary_frame]
528
+ def self.pretty_backtrace(backtrace = caller(1))
529
+ backtrace.collect do |line|
530
+ _, path, rest = /^(.*):(\d+.*)$/.match(line).to_a
531
+ # If the path doesn't exist - like in one test, and like could happen in
532
+ # the world - we should just tolerate it and carry on. --daniel 2012-09-05
533
+ # Also, if we don't match, just include the whole line.
534
+ if path
535
+ path = Pathname(path).realpath rescue path
536
+ "#{path}:#{rest}"
546
537
  else
547
- primary_frame
538
+ line
548
539
  end
549
- end
550
- end
551
-
552
- def self.resolve_stackframe(frame)
553
- _, path, rest = /^(.*):(\d+.*)$/.match(frame).to_a
554
- if path
555
- path = Pathname(path).realpath rescue path
556
- "#{path}:#{rest}"
557
- else
558
- frame
559
- end
560
- end
561
-
562
- def self.format_puppetstack_frame(file_and_lineno)
563
- file_and_lineno.join(':')
540
+ end.join("\n")
564
541
  end
565
542
 
566
543
  # Replace a file, securely. This takes a block, and passes it the file
@@ -574,7 +551,7 @@ module Util
574
551
  # preserved. This works hard to avoid loss of any metadata, but will result
575
552
  # in an inode change for the file.
576
553
  #
577
- # Arguments: `filename`, `default_mode`
554
+ # Arguments: `filename`, `default_mode`, `staging_location`
578
555
  #
579
556
  # The filename is the file we are going to replace.
580
557
  #
@@ -582,11 +559,14 @@ module Util
582
559
  # exist; if the file is present we copy the existing mode/owner/group values
583
560
  # across. The default_mode can be expressed as an octal integer, a numeric string (ie '0664')
584
561
  # or a symbolic file mode.
562
+ #
563
+ # The staging_location is a location to render the temporary file before
564
+ # moving the file to it's final location.
585
565
 
586
566
  DEFAULT_POSIX_MODE = 0644
587
567
  DEFAULT_WINDOWS_MODE = nil
588
568
 
589
- def replace_file(file, default_mode, &block)
569
+ def replace_file(file, default_mode, staging_location: nil, validate_callback: nil, &block)
590
570
  raise Puppet::DevError, _("replace_file requires a block") unless block_given?
591
571
 
592
572
  if default_mode
@@ -604,9 +584,15 @@ module Util
604
584
  end
605
585
 
606
586
  begin
607
- file = Puppet::FileSystem.pathname(file)
587
+ file = Puppet::FileSystem.pathname(file)
588
+
608
589
  # encoding for Uniquefile is not important here because the caller writes to it as it sees fit
609
- tempfile = Puppet::FileSystem::Uniquefile.new(Puppet::FileSystem.basename_string(file), Puppet::FileSystem.dir_string(file))
590
+ if staging_location
591
+ tempfile = Puppet::FileSystem::Uniquefile.new(Puppet::FileSystem.basename_string(file), staging_location)
592
+ else
593
+ tempfile = Puppet::FileSystem::Uniquefile.new(Puppet::FileSystem.basename_string(file), Puppet::FileSystem.dir_string(file))
594
+ end
595
+
610
596
 
611
597
  effective_mode =
612
598
  if !Puppet::Util::Platform.windows?
@@ -646,6 +632,10 @@ module Util
646
632
 
647
633
  tempfile.close
648
634
 
635
+ if validate_callback
636
+ validate_callback.call(tempfile.path)
637
+ end
638
+
649
639
  if Puppet::Util::Platform.windows?
650
640
  # Windows ReplaceFile needs a file to exist, so touch handles this
651
641
  if !Puppet::FileSystem.exist?(file)