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
@@ -215,7 +215,7 @@ class Parser
215
215
  opts[:type] = opts[:type] || type_from_default || :flag
216
216
 
217
217
  ## fill in :long
218
- opts[:long] = opts[:long] ? opts[:long].to_s : name.to_s.tr("_", "-")
218
+ opts[:long] = opts[:long] ? opts[:long].to_s : name.to_s.gsub("_", "-")
219
219
  opts[:long] =
220
220
  case opts[:long]
221
221
  when /^--([^-].*)$/
@@ -162,16 +162,15 @@ module Puppet::Util::Execution
162
162
 
163
163
  options = default_options.merge(options)
164
164
 
165
- if command.is_a?(Array)
165
+ if options[:sensitive]
166
+ command_str = '[redacted]'
167
+ elsif command.is_a?(Array)
166
168
  command = command.flatten.map(&:to_s)
167
169
  command_str = command.join(" ")
168
170
  elsif command.is_a?(String)
169
171
  command_str = command
170
172
  end
171
173
 
172
- # do this after processing 'command' array or string
173
- command_str = '[redacted]' if options[:sensitive]
174
-
175
174
  user_log_s = ''
176
175
  if options[:uid]
177
176
  user_log_s << " uid=#{options[:uid]}"
@@ -4,15 +4,13 @@ require 'puppet/network/http'
4
4
 
5
5
  module Puppet::Util::HttpProxy
6
6
  def self.proxy(uri)
7
- if http_proxy_host && !no_proxy?(uri)
8
- Net::HTTP.new(uri.host, uri.port, self.http_proxy_host, self.http_proxy_port, self.http_proxy_user, self.http_proxy_password)
7
+ if self.no_proxy?(uri)
8
+ proxy_class = Net::HTTP::Proxy(nil)
9
9
  else
10
- http = Net::HTTP.new(uri.host, uri.port, nil, nil, nil, nil)
11
- # Net::HTTP defaults the proxy port even though we said not to
12
- # use one. Set it to nil so caller is not surprised
13
- http.proxy_port = nil if http.respond_to?(:proxy_port=)
14
- http
10
+ proxy_class = Net::HTTP::Proxy(self.http_proxy_host, self.http_proxy_port, self.http_proxy_user, self.http_proxy_password)
15
11
  end
12
+
13
+ return proxy_class.new(uri.host, uri.port)
16
14
  end
17
15
 
18
16
  def self.http_proxy_env
@@ -35,7 +33,7 @@ module Puppet::Util::HttpProxy
35
33
  # .example.com
36
34
  # We'll accommodate both here.
37
35
  def self.no_proxy?(dest)
38
- unless no_proxy = self.no_proxy
36
+ unless no_proxy_env = ENV["no_proxy"] || ENV["NO_PROXY"]
39
37
  return false
40
38
  end
41
39
 
@@ -47,10 +45,18 @@ module Puppet::Util::HttpProxy
47
45
  end
48
46
  end
49
47
 
50
- no_proxy.split(/\s*,\s*/).each do |d|
48
+ no_proxy_env.split(/\s*,\s*/).each do |d|
51
49
  host, port = d.split(':')
52
50
  host = Regexp.escape(host).gsub('\*', '.*')
53
51
 
52
+ #If the host of this no_proxy value starts with '.', this entry is
53
+ #a domain level entry. Don't pin the regex to the beginning of the entry.
54
+ #If it does not start with a '.' then it is a host specific entry and
55
+ #should be matched to the destination starting at the beginning.
56
+ unless host =~ /^\\\./
57
+ host = "^#{host}"
58
+ end
59
+
54
60
  #If this no_proxy entry specifies a port, we want to match it against
55
61
  #the destination port. Otherwise just match hosts.
56
62
  if port
@@ -121,20 +127,6 @@ module Puppet::Util::HttpProxy
121
127
  return Puppet.settings[:http_proxy_password]
122
128
  end
123
129
 
124
- def self.no_proxy
125
- no_proxy_env = ENV["no_proxy"] || ENV["NO_PROXY"]
126
-
127
- if no_proxy_env
128
- return no_proxy_env
129
- end
130
-
131
- if Puppet.settings[:no_proxy] == 'none'
132
- return nil
133
- end
134
-
135
- return Puppet.settings[:no_proxy]
136
- end
137
-
138
130
  # Return a Net::HTTP::Proxy object.
139
131
  #
140
132
  # This method optionally configures SSL correctly if the URI scheme is
@@ -186,10 +178,10 @@ module Puppet::Util::HttpProxy
186
178
 
187
179
  headers = { 'Accept' => '*/*', 'User-Agent' => Puppet[:http_user_agent] }
188
180
  if Puppet.features.zlib?
189
- headers["Accept-Encoding"] = Puppet::Network::HTTP::Compression::ACCEPT_ENCODING
181
+ headers.merge!({"Accept-Encoding" => Puppet::Network::HTTP::Compression::ACCEPT_ENCODING})
190
182
  end
191
183
 
192
- response = proxy.send(:head, current_uri, headers)
184
+ response = proxy.send(:head, current_uri.path, headers)
193
185
  Puppet.debug("HTTP HEAD request to #{current_uri} returned #{response.code} #{response.message}")
194
186
 
195
187
  if [301, 302, 307].include?(response.code.to_i)
@@ -200,9 +192,9 @@ module Puppet::Util::HttpProxy
200
192
 
201
193
  if method != :head
202
194
  if block_given?
203
- response = proxy.send("request_#{method}".to_sym, current_uri, headers, &block)
195
+ response = proxy.send("request_#{method}".to_sym, current_uri.path, headers, &block)
204
196
  else
205
- response = proxy.send(method, current_uri, headers)
197
+ response = proxy.send(method, current_uri.path, headers)
206
198
  end
207
199
 
208
200
  Puppet.debug("HTTP #{method.to_s.upcase} request to #{current_uri} returned #{response.code} #{response.message}")
@@ -175,7 +175,7 @@ class Puppet::Util::Log
175
175
  # We only select the last 10 callers in the stack to avoid being spammy
176
176
  message = _("Received a Log attribute with invalid encoding:%{log_message}") %
177
177
  { log_message: Puppet::Util::CharacterEncoding.convert_to_utf_8(str.dump)}
178
- message += '\n' + _("Backtrace:\n%{backtrace}") % { backtrace: caller(1, 10).join("\n") }
178
+ message += '\n' + _("Backtrace:\n%{backtrace}") % { backtrace: caller[0..10].join("\n") }
179
179
  message
180
180
  end
181
181
  private_class_method :coerce_string
@@ -392,7 +392,7 @@ class Puppet::Util::Log
392
392
  end
393
393
 
394
394
  def to_report
395
- "#{time} #{source} (#{level}): #{self}"
395
+ "#{time} #{source} (#{level}): #{to_s}"
396
396
  end
397
397
 
398
398
  def to_s
@@ -34,7 +34,7 @@ Puppet::Util::Log.newdesttype :syslog do
34
34
  end
35
35
  else
36
36
  msg.to_s.split("\n").each do |line|
37
- @syslog.send(msg.level, "(%s) %s" % [msg.source.to_s.delete("%"),
37
+ @syslog.send(msg.level, "(%s) %s" % [msg.source.to_s.gsub("%", ""),
38
38
  line.gsub("%", '%%')
39
39
  ]
40
40
  )
@@ -78,7 +78,7 @@ Puppet::Util::Log.newdesttype :file do
78
78
 
79
79
  # create the log file, if it doesn't already exist
80
80
  need_array_start = false
81
- file_exists = Puppet::FileSystem.exist?(path)
81
+ file_exists = File.exists?(path)
82
82
  if @json == 1
83
83
  need_array_start = true
84
84
  if file_exists
@@ -48,13 +48,12 @@ module Logging
48
48
  # wish to log a message at all; in this case it is likely that you are only calling this method in order
49
49
  # to take advantage of the backtrace logging.
50
50
  def log_exception(exception, message = :default, options = {})
51
+ trace = Puppet[:trace] || options[:trace]
51
52
  level = options[:level] || :err
52
- combined_trace = Puppet[:trace] || options[:trace]
53
- puppet_trace = Puppet[:puppet_trace] || options[:puppet_trace]
54
-
55
53
  if message == :default && exception.is_a?(Puppet::ParseErrorWithIssue)
56
54
  # Retain all detailed info and keep plain message and stacktrace separate
57
- backtrace = build_exception_trace(exception, combined_trace, puppet_trace)
55
+ backtrace = []
56
+ build_exception_trace(backtrace, exception, trace)
58
57
  Puppet::Util::Log.create({
59
58
  :level => level,
60
59
  :source => log_source,
@@ -68,27 +67,28 @@ module Logging
68
67
  :node => exception.node
69
68
  }.merge(log_metadata))
70
69
  else
71
- send_log(level, format_exception(exception, message, combined_trace, puppet_trace))
70
+ send_log(level, format_exception(exception, message, trace))
72
71
  end
73
72
  end
74
73
 
75
- def build_exception_trace(exception, combined_trace = true, puppet_trace = false)
76
- built_trace = format_backtrace(exception, combined_trace, puppet_trace)
77
-
74
+ def build_exception_trace(arr, exception, trace = true)
75
+ if trace and exception.backtrace
76
+ exception.backtrace.each do |line|
77
+ arr << line =~ /^(.+):(\d+.*)$/ ? ("#{Pathname($1).realpath}:#{$2}" rescue line) : line
78
+ end
79
+ end
78
80
  if exception.respond_to?(:original)
79
81
  original = exception.original
80
82
  unless original.nil?
81
- built_trace << _('Wrapped exception:')
82
- built_trace << original.message
83
- built_trace += build_exception_trace(original, combined_trace, puppet_trace)
83
+ arr << _('Wrapped exception:')
84
+ arr << original.message
85
+ build_exception_trace(arr, original, trace)
84
86
  end
85
87
  end
86
-
87
- built_trace
88
88
  end
89
89
  private :build_exception_trace
90
90
 
91
- def format_exception(exception, message = :default, combined_trace = true, puppet_trace = false)
91
+ def format_exception(exception, message = :default, trace = true)
92
92
  arr = []
93
93
  case message
94
94
  when :default
@@ -99,28 +99,16 @@ module Logging
99
99
  arr << message
100
100
  end
101
101
 
102
- arr += format_backtrace(exception, combined_trace, puppet_trace)
103
-
102
+ if trace and exception.backtrace
103
+ arr << Puppet::Util.pretty_backtrace(exception.backtrace)
104
+ end
104
105
  if exception.respond_to?(:original) and exception.original
105
106
  arr << _("Wrapped exception:")
106
- arr << format_exception(exception.original, :default, combined_trace, puppet_trace)
107
+ arr << format_exception(exception.original, :default, trace)
107
108
  end
108
-
109
109
  arr.flatten.join("\n")
110
110
  end
111
111
 
112
- def format_backtrace(exception, combined_trace, puppet_trace)
113
- puppetstack = exception.respond_to?(:puppetstack) ? exception.puppetstack : []
114
-
115
- if combined_trace and exception.backtrace
116
- Puppet::Util.format_backtrace_array(exception.backtrace, puppetstack)
117
- elsif puppet_trace && !puppetstack.empty?
118
- Puppet::Util.format_backtrace_array(puppetstack)
119
- else
120
- []
121
- end
122
- end
123
-
124
112
  def log_and_raise(exception, message)
125
113
  log_exception(exception, message)
126
114
  raise exception, message + "\n" + exception.to_s, exception.backtrace
@@ -206,9 +194,9 @@ module Logging
206
194
  # let's find the offending line; we need to jump back up the stack a few steps to find the method that called
207
195
  # the deprecated method
208
196
  if Puppet[:trace]
209
- caller(3)
197
+ caller()[2..-1]
210
198
  else
211
- [caller(3, 1).first]
199
+ [caller()[2]]
212
200
  end
213
201
  end
214
202
 
@@ -54,11 +54,11 @@ class Puppet::Util::Metric
54
54
  end
55
55
 
56
56
  def values
57
- @values.sort_by { |a| a[1] }
57
+ @values.sort { |a, b| a[1] <=> b[1] }
58
58
  end
59
59
 
60
60
  # Convert a name into a label.
61
61
  def self.labelize(name)
62
- name.to_s.capitalize.tr("_", " ")
62
+ name.to_s.capitalize.gsub("_", " ")
63
63
  end
64
64
  end
@@ -99,6 +99,39 @@ unless OpenSSL::X509::Name.instance_methods.include?(:to_utf8)
99
99
  end
100
100
  end
101
101
 
102
+ if RUBY_VERSION =~ /^2\.3/
103
+ module OpenSSL::PKey
104
+ alias __original_read read
105
+ def read(*args)
106
+ __original_read(*args)
107
+ rescue ArgumentError => e
108
+ # ruby <= 2.3 raises ArgumentError if it can't decrypt
109
+ # passphrase protected private keys, fixed in 2.4.0
110
+ # see https://bugs.ruby-lang.org/issues/11774
111
+ raise OpenSSL::PKey::PKeyError, e.message
112
+ end
113
+ module_function :read
114
+ module_function :__original_read
115
+ end
116
+ end
117
+
118
+ unless OpenSSL::PKey::EC.instance_methods.include?(:private?)
119
+ class OpenSSL::PKey::EC
120
+ # Added in ruby 2.4.0 in https://github.com/ruby/ruby/commit/7c971e61f04
121
+ alias :private? :private_key?
122
+ end
123
+ end
124
+
125
+ unless OpenSSL::PKey::EC.singleton_methods.include?(:generate)
126
+ class OpenSSL::PKey::EC
127
+ # Added in ruby 2.4.0 in https://github.com/ruby/ruby/commit/85500b66342
128
+ def self.generate(string)
129
+ ec = OpenSSL::PKey::EC.new(string)
130
+ ec.generate_key
131
+ end
132
+ end
133
+ end
134
+
102
135
  # The Enumerable#uniq method was added in Ruby 2.4.0 (https://bugs.ruby-lang.org/issues/11090)
103
136
  # This is a backport to earlier Ruby versions.
104
137
  #
@@ -62,13 +62,12 @@ class Puppet::Util::Pidlock
62
62
  # POSIX and Windows platforms (PUP-9247).
63
63
  if Puppet.features.posix?
64
64
  procname = Puppet::Util::Execution.execute(["ps", "-p", lock_pid, "-o", "comm="]).strip
65
- args = Puppet::Util::Execution.execute(["ps", "-p", lock_pid, "-o", "args="]).strip
66
- @lockfile.unlock unless procname =~ /ruby/ && args =~ /puppet/ || procname =~ /puppet(-.*)?$/
65
+ @lockfile.unlock unless procname =~ /puppet(-.*)?$/
67
66
  elsif Puppet.features.microsoft_windows?
68
67
  # On Windows, we're checking if the filesystem path name of the running
69
68
  # process is our vendored ruby:
70
69
  exe_path = Puppet::Util::Windows::Process::get_process_image_name_by_pid(lock_pid)
71
- @lockfile.unlock unless exe_path =~ /\\bin\\ruby.exe$/
70
+ @lockfile.unlock unless exe_path =~ /Puppet\\puppet\\bin\\ruby.exe/
72
71
  end
73
72
  end
74
73
  private :clear_if_stale
@@ -78,7 +78,7 @@ module Puppet::Util::ProviderFeatures
78
78
  str = ""
79
79
  @features ||= {}
80
80
  return nil if @features.empty?
81
- names = @features.keys.sort_by(&:to_s)
81
+ names = @features.keys.sort { |a,b| a.to_s <=> b.to_s }
82
82
  names.each do |name|
83
83
  doc = @features[name].docs.gsub(/\n\s+/, " ")
84
84
  str << "- *#{name}*: #{doc}\n"
@@ -127,7 +127,9 @@ module Puppet::Util::ProviderFeatures
127
127
  # Create a method that will list all functional features.
128
128
  @feature_module.send(:define_method, :features) do
129
129
  return false unless defined?(features)
130
- features.keys.find_all { |n| feature?(n) }.sort_by(&:to_s)
130
+ features.keys.find_all { |n| feature?(n) }.sort { |a,b|
131
+ a.to_s <=> b.to_s
132
+ }
131
133
  end
132
134
 
133
135
  # Create a method that will determine if a provided list of
@@ -31,7 +31,7 @@ module Puppet::Util::RDoc
31
31
  # uses relative_path_from that will generate errors when the slashes don't
32
32
  # properly match. This is a workaround for that issue.
33
33
  if Puppet::Util::Platform.windows? && RDoc::VERSION !~ /^[0-3]\./
34
- options += [ "--root", Dir.pwd.tr('\\', '/')]
34
+ options += [ "--root", Dir.pwd.gsub(/\\/, '/')]
35
35
  end
36
36
  options += files
37
37
 
@@ -58,7 +58,7 @@ class Puppet::Util::Reference
58
58
 
59
59
  def self.references(environment)
60
60
  instance_loader(:reference).loadall(environment)
61
- loaded_instances(:reference).sort_by(&:to_s)
61
+ loaded_instances(:reference).sort { |a,b| a.to_s <=> b.to_s }
62
62
  end
63
63
 
64
64
  attr_accessor :page, :depth, :header, :title, :dynamic
@@ -53,7 +53,7 @@ class Puppet::Util::ResourceTemplate
53
53
 
54
54
  def set_resource_variables
55
55
  @resource.to_hash.each do |param, value|
56
- var = "@#{param}"
56
+ var = "@#{param.to_s}"
57
57
  instance_variable_set(var, value)
58
58
  end
59
59
  end
@@ -13,7 +13,7 @@ require 'pathname'
13
13
 
14
14
  module Puppet::Util::SELinux
15
15
 
16
- def self.selinux_support?
16
+ def selinux_support?
17
17
  return false unless defined?(Selinux)
18
18
  if Selinux.is_selinux_enabled == 1
19
19
  return true
@@ -21,10 +21,6 @@ module Puppet::Util::SELinux
21
21
  false
22
22
  end
23
23
 
24
- def selinux_support?
25
- Puppet::Util::SELinux.selinux_support?
26
- end
27
-
28
24
  # Retrieve and return the full context of the file. If we don't have
29
25
  # SELinux support or if the SELinux call fails then return nil.
30
26
  def get_selinux_current_context(file)
@@ -206,9 +202,7 @@ module Puppet::Util::SELinux
206
202
  # If possible we use read_nonblock in a loop rather than read to work-
207
203
  # a linux kernel bug. See ticket #1963 for details.
208
204
  mountfh = File.open("/proc/mounts")
209
- loop do
210
- mounts += mountfh.read_nonblock(1024)
211
- end
205
+ mounts += mountfh.read_nonblock(1024) while true
212
206
  else
213
207
  # Otherwise we shell out and let cat do it for us
214
208
  mountfh = IO.popen("/bin/cat /proc/mounts")
@@ -6,4 +6,8 @@ class Puppet::Util::SkipTags
6
6
  def initialize(stags)
7
7
  self.tags = stags unless defined?(@tags)
8
8
  end
9
+
10
+ def split_qualified_tags?
11
+ false
12
+ end
9
13
  end
@@ -1,23 +1,6 @@
1
1
  module Puppet::Util::Windows::ADSI
2
2
  require 'ffi'
3
3
 
4
- # https://docs.microsoft.com/en-us/windows/win32/api/dsrole/ne-dsrole-dsrole_machine_role
5
- STANDALONE_WORKSTATION = 0
6
- MEMBER_WORKSTATION = 1
7
- STANDALONE_SERVER = 2
8
- MEMBER_SERVER = 3
9
- BACKUP_DOMAIN_CONTROLLER = 4
10
- PRIMARY_DOMAIN_CONTROLLER = 5
11
-
12
- DOMAIN_ROLES = {
13
- STANDALONE_WORKSTATION => :STANDALONE_WORKSTATION,
14
- MEMBER_WORKSTATION => :MEMBER_WORKSTATION,
15
- STANDALONE_SERVER => :STANDALONE_SERVER,
16
- MEMBER_SERVER => :MEMBER_SERVER,
17
- BACKUP_DOMAIN_CONTROLLER => :BACKUP_DOMAIN_CONTROLLER,
18
- PRIMARY_DOMAIN_CONTROLLER => :PRIMARY_DOMAIN_CONTROLLER,
19
- }
20
-
21
4
  class << self
22
5
  extend FFI::Library
23
6
 
@@ -111,14 +94,6 @@ module Puppet::Util::Windows::ADSI
111
94
  wmi_connection.execquery(query)
112
95
  end
113
96
 
114
- def domain_role
115
- unless @domain_role
116
- query_result = Puppet::Util::Windows::ADSI.execquery('select DomainRole from Win32_ComputerSystem').to_enum.first
117
- @domain_role = DOMAIN_ROLES[query_result.DomainRole] if query_result
118
- end
119
- @domain_role
120
- end
121
-
122
97
  ffi_convention :stdcall
123
98
 
124
99
  # https://msdn.microsoft.com/en-us/library/windows/desktop/ms724295(v=vs.85).aspx
@@ -201,12 +176,7 @@ module Puppet::Util::Windows::ADSI
201
176
  well_known = false
202
177
  if (sid = Puppet::Util::Windows::SID.name_to_principal(name_or_sid))
203
178
  # Examples of SidType include SidTypeUser, SidTypeGroup
204
- if sid.account_type == "SidType#{@object_class.capitalize}".to_sym
205
- # Check if we're getting back a local user when domain-joined
206
- return true unless [:MEMBER_WORKSTATION, :MEMBER_SERVER].include?(Puppet::Util::Windows::ADSI.domain_role)
207
- # The resource domain and the computer name are not always case-matching
208
- return sid.domain.casecmp(Puppet::Util::Windows::ADSI.computer_name) == 0
209
- end
179
+ return true if sid.account_type == "SidType#{@object_class.capitalize}".to_sym
210
180
 
211
181
  # 'well known group' is special as it can be a group like Everyone OR a user like SYSTEM
212
182
  # so try to resolve it
@@ -416,23 +386,23 @@ module Puppet::Util::Windows::ADSI
416
386
  ADS_UF_SCRIPT: 0x0001,
417
387
  ADS_UF_ACCOUNTDISABLE: 0x0002,
418
388
  ADS_UF_HOMEDIR_REQUIRED: 0x0008,
419
- ADS_UF_LOCKOUT: 0x0010,
420
- ADS_UF_PASSWD_NOTREQD: 0x0020,
421
- ADS_UF_PASSWD_CANT_CHANGE: 0x0040,
422
- ADS_UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED: 0x0080,
423
- ADS_UF_TEMP_DUPLICATE_ACCOUNT: 0x0100,
424
- ADS_UF_NORMAL_ACCOUNT: 0x0200,
425
- ADS_UF_INTERDOMAIN_TRUST_ACCOUNT: 0x0800,
426
- ADS_UF_WORKSTATION_TRUST_ACCOUNT: 0x1000,
427
- ADS_UF_SERVER_TRUST_ACCOUNT: 0x2000,
428
- ADS_UF_DONT_EXPIRE_PASSWD: 0x10000,
429
- ADS_UF_MNS_LOGON_ACCOUNT: 0x20000,
430
- ADS_UF_SMARTCARD_REQUIRED: 0x40000,
431
- ADS_UF_TRUSTED_FOR_DELEGATION: 0x80000,
432
- ADS_UF_NOT_DELEGATED: 0x100000,
433
- ADS_UF_USE_DES_KEY_ONLY: 0x200000,
434
- ADS_UF_DONT_REQUIRE_PREAUTH: 0x400000,
435
- ADS_UF_PASSWORD_EXPIRED: 0x800000,
389
+ ADS_UF_LOCKOUT: 0x0010,
390
+ ADS_UF_PASSWD_NOTREQD: 0x0020,
391
+ ADS_UF_PASSWD_CANT_CHANGE: 0x0040,
392
+ ADS_UF_ENCRYPTED_TEXT_PASSWORD_ALLOWED: 0x0080,
393
+ ADS_UF_TEMP_DUPLICATE_ACCOUNT: 0x0100,
394
+ ADS_UF_NORMAL_ACCOUNT: 0x0200,
395
+ ADS_UF_INTERDOMAIN_TRUST_ACCOUNT: 0x0800,
396
+ ADS_UF_WORKSTATION_TRUST_ACCOUNT: 0x1000,
397
+ ADS_UF_SERVER_TRUST_ACCOUNT: 0x2000,
398
+ ADS_UF_DONT_EXPIRE_PASSWD: 0x10000,
399
+ ADS_UF_MNS_LOGON_ACCOUNT: 0x20000,
400
+ ADS_UF_SMARTCARD_REQUIRED: 0x40000,
401
+ ADS_UF_TRUSTED_FOR_DELEGATION: 0x80000,
402
+ ADS_UF_NOT_DELEGATED: 0x100000,
403
+ ADS_UF_USE_DES_KEY_ONLY: 0x200000,
404
+ ADS_UF_DONT_REQUIRE_PREAUTH: 0x400000,
405
+ ADS_UF_PASSWORD_EXPIRED: 0x800000,
436
406
  ADS_UF_TRUSTED_TO_AUTHENTICATE_FOR_DELEGATION: 0x1000000
437
407
  }
438
408