puppet 6.4.5-x64-mingw32 → 6.5.0-x64-mingw32

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

Potentially problematic release.


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

Files changed (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 +28 -22
  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
@@ -303,7 +303,7 @@ module Puppet::ModuleTool
303
303
  @environment.modules_by_path[options[:target_dir]].each do |mod|
304
304
  if mod.has_metadata?
305
305
  metadata = {
306
- :name => mod.forge_name.tr('/', '-'),
306
+ :name => mod.forge_name.gsub('/', '-'),
307
307
  :version => mod.version
308
308
  }
309
309
  next if release[:module] == metadata[:name]
@@ -52,7 +52,7 @@ module Puppet::ModuleTool
52
52
 
53
53
  def find_installed_module
54
54
  @environment.modules_by_path.values.flatten.each do |mod|
55
- mod_name = (mod.forge_name || mod.name).tr('/', '-')
55
+ mod_name = (mod.forge_name || mod.name).gsub('/', '-')
56
56
  if mod_name == @name
57
57
  @unfiltered << {
58
58
  :name => mod_name,
@@ -101,7 +101,7 @@ module Puppet::ModuleTool
101
101
  if mod.has_metadata? && !changes.empty?
102
102
  raise LocalChangesError,
103
103
  :action => :uninstall,
104
- :module_name => (mod.forge_name || mod.name).tr('/', '-'),
104
+ :module_name => (mod.forge_name || mod.name).gsub('/', '-'),
105
105
  :requested_version => @options[:version],
106
106
  :installed_version => mod.version
107
107
  end
@@ -109,7 +109,7 @@ module Puppet::ModuleTool
109
109
 
110
110
  if !@options[:force] && !mod.required_by.empty?
111
111
  raise ModuleIsRequiredError,
112
- :module_name => (mod.forge_name || mod.name).tr('/', '-'),
112
+ :module_name => (mod.forge_name || mod.name).gsub('/', '-'),
113
113
  :required_by => mod.required_by,
114
114
  :requested_version => @options[:version],
115
115
  :installed_version => mod.version
@@ -102,7 +102,7 @@ module Puppet::ModuleTool
102
102
 
103
103
  contents = data.keys.map do |k|
104
104
  value = (Puppet::Util::Json.dump(data[k], :pretty => true) rescue data[k].to_json)
105
- %Q("#{k}": #{value})
105
+ %Q("#{k.to_s}": #{value})
106
106
  end
107
107
 
108
108
  "{\n" + contents.join(",\n").gsub(/^/, ' ') + "\n}\n"
@@ -8,12 +8,12 @@ module Puppet::ModuleTool::Shared
8
8
  @installed = Hash.new { |h,k| h[k] = [] }
9
9
 
10
10
  @environment.modules_by_path.values.flatten.each do |mod|
11
- mod_name = (mod.forge_name || mod.name).tr('/', '-')
11
+ mod_name = (mod.forge_name || mod.name).gsub('/', '-')
12
12
  @installed[mod_name] << mod
13
13
  d = @local["#{mod_name}@#{mod.version}"]
14
14
  (mod.dependencies || []).each do |hash|
15
15
  name, conditions = hash['name'], hash['version_requirement']
16
- name = name.tr('/', '-')
16
+ name = name.gsub('/', '-')
17
17
  d[name] = conditions
18
18
  @conditions[name] << {
19
19
  :module => mod_name,
@@ -34,7 +34,7 @@ module Puppet::ModuleTool::Shared
34
34
  info = forge.remote_dependency_info(author, modname, @options[:version])
35
35
  info.each do |pair|
36
36
  mod_name, releases = pair
37
- mod_name = mod_name.tr('/', '-')
37
+ mod_name = mod_name.gsub('/', '-')
38
38
  releases.each do |rel|
39
39
  semver = SemanticPuppet::Version.parse(rel['version']) rescue SemanticPuppet::Version::MIN
40
40
  @versions[mod_name] << { :vstring => rel['version'], :semver => semver }
@@ -42,7 +42,7 @@ module Puppet::ModuleTool::Shared
42
42
  @urls["#{mod_name}@#{rel['version']}"] = rel['file']
43
43
  d = @remote["#{mod_name}@#{rel['version']}"]
44
44
  (rel['dependencies'] || []).each do |name, conditions|
45
- d[name.tr('/', '-')] = conditions
45
+ d[name.gsub('/', '-')] = conditions
46
46
  end
47
47
  end
48
48
  end
@@ -1,17 +1,7 @@
1
1
  class Puppet::ModuleTool::Tar::Mini
2
2
  def unpack(sourcefile, destdir, _)
3
3
  Zlib::GzipReader.open(sourcefile) do |reader|
4
- # puppet doesn't have a hard dependency on minitar, so we
5
- # can't be certain which version is installed. If it's 0.9
6
- # or above then we can prevent minitar from fsync'ing each
7
- # extracted file and directory, otherwise fallback to the
8
- # old behavior
9
- args = [reader, destdir, find_valid_files(reader)]
10
- spec = Gem::Specification.find_by_name('minitar')
11
- if spec && spec.version >= Gem::Version.new('0.9')
12
- args << {:fsync => false}
13
- end
14
- Archive::Tar::Minitar.unpack(*args) do |action, name, stats|
4
+ Archive::Tar::Minitar.unpack(reader, destdir, find_valid_files(reader)) do |action, name, stats|
15
5
  case action
16
6
  when :dir
17
7
  validate_entry(destdir, name)
@@ -93,7 +83,7 @@ class Puppet::ModuleTool::Tar::Mini
93
83
  def find_valid_files(tarfile)
94
84
  Archive::Tar::Minitar.open(tarfile).collect do |entry|
95
85
  flag = entry.typeflag
96
- if flag.nil? || flag =~ /[[:digit:]]/ && (0..7).cover?(flag.to_i)
86
+ if flag.nil? || flag =~ /[[:digit:]]/ && (0..7).include?(flag.to_i)
97
87
  entry.full_name
98
88
  else
99
89
  Puppet.debug "Invalid tar flag '#{flag}' will not be extracted: #{entry.name}"
@@ -120,17 +120,6 @@ class Puppet::Network::HTTP::API::IndirectedRoutes
120
120
  [indirection, method, key, params]
121
121
  end
122
122
 
123
- def self.request_to_uri(request)
124
- uri, body = request_to_uri_and_body(request)
125
- "#{uri}?#{body}"
126
- end
127
-
128
- def self.request_to_uri_and_body(request)
129
- url_prefix = IndirectionType.url_prefix_for(request.indirection_name.to_s)
130
- indirection = request.method == :search ? pluralize(request.indirection_name.to_s) : request.indirection_name.to_s
131
- ["#{url_prefix}/#{indirection}/#{Puppet::Util.uri_encode(request.key)}", "environment=#{request.environment.name}&#{request.query_string}"]
132
- end
133
-
134
123
  private
135
124
 
136
125
  # Execute our find.
@@ -264,10 +253,20 @@ class Puppet::Network::HTTP::API::IndirectedRoutes
264
253
  method
265
254
  end
266
255
 
256
+ def self.request_to_uri(request)
257
+ uri, body = request_to_uri_and_body(request)
258
+ "#{uri}?#{body}"
259
+ end
260
+
261
+ def self.request_to_uri_and_body(request)
262
+ url_prefix = IndirectionType.url_prefix_for(request.indirection_name.to_s)
263
+ indirection = request.method == :search ? pluralize(request.indirection_name.to_s) : request.indirection_name.to_s
264
+ ["#{url_prefix}/#{indirection}/#{Puppet::Util.uri_encode(request.key)}", "environment=#{request.environment.name}&#{request.query_string}"]
265
+ end
266
+
267
267
  def self.pluralize(indirection)
268
268
  return(indirection == "status" ? "statuses" : indirection + "s")
269
269
  end
270
- private_class_method :pluralize
271
270
 
272
271
  def plurality(indirection)
273
272
  # NOTE These specific hooks for paths are ridiculous, but it's a *many*-line
@@ -325,17 +325,19 @@ module Puppet::Network::HTTP
325
325
  rescue => exception
326
326
  elapsed = (Time.now - start).to_f.round(3)
327
327
  uri = [@site.addr, request.path.split('?')[0]].join('/')
328
+ eclass = exception.class
329
+
330
+ err = case exception
331
+ when EOFError
332
+ eclass.new(_('request %{uri} interrupted after %{elapsed} seconds') % {uri: uri, elapsed: elapsed})
333
+ when Timeout::Error
334
+ eclass.new(_('request %{uri} timed out after %{elapsed} seconds') % {uri: uri, elapsed: elapsed})
335
+ else
336
+ eclass.new(_('request %{uri} failed: %{msg}') % {uri: uri, msg: exception.message})
337
+ end
328
338
 
329
- case exception
330
- when EOFError
331
- Puppet.log_exception(exception, _('request %{uri} interrupted after %{elapsed} seconds') % {uri: uri, elapsed: elapsed})
332
- when Timeout::Error
333
- Puppet.log_exception(exception, _('request %{uri} timed out after %{elapsed} seconds') % {uri: uri, elapsed: elapsed})
334
- else
335
- Puppet.log_exception(exception, _('request %{uri} failed: %{msg}') % {uri: uri, msg: exception.message})
336
- end
337
-
338
- raise exception
339
+ err.set_backtrace(exception.backtrace) unless exception.backtrace.empty?
340
+ raise err
339
341
  end
340
342
 
341
343
  def with_connection(site, &block)
@@ -25,7 +25,17 @@ class Puppet::Network::HTTP::Factory
25
25
  def create_connection(site)
26
26
  Puppet.debug("Creating new connection for #{site}")
27
27
 
28
- http = Puppet::Util::HttpProxy.proxy(URI(site.addr))
28
+ args = [site.host, site.port]
29
+
30
+ unless Puppet::Util::HttpProxy.no_proxy?(site)
31
+ if Puppet[:http_proxy_host] == "none"
32
+ args << nil << nil
33
+ else
34
+ args << Puppet[:http_proxy_host] << Puppet[:http_proxy_port]
35
+ end
36
+ end
37
+
38
+ http = Net::HTTP.new(*args)
29
39
  http.use_ssl = site.use_ssl?
30
40
  http.read_timeout = Puppet[:http_read_timeout]
31
41
  http.open_timeout = Puppet[:http_connect_timeout]
@@ -89,8 +89,6 @@ class Puppet::Network::HTTP::Pool < Puppet::Network::HTTP::BasePool
89
89
  #
90
90
  # @api private
91
91
  def setsockopts(netio)
92
- return unless netio
93
-
94
92
  socket = netio.io
95
93
  socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
96
94
  end
@@ -15,7 +15,7 @@ class Puppet::Network::HTTP::Site
15
15
  end
16
16
 
17
17
  def addr
18
- "#{@scheme}://#{@host}:#{@port}"
18
+ "#{@scheme}://#{@host}:#{@port.to_s}"
19
19
  end
20
20
  alias to_s addr
21
21
 
@@ -50,7 +50,7 @@ module Puppet::Network
50
50
  case service_name
51
51
  when :puppet then service = '_x-puppet'
52
52
  when :file then service = '_x-puppet-fileserver'
53
- else service = "_x-puppet-#{service_name}"
53
+ else service = "_x-puppet-#{service_name.to_s}"
54
54
  end
55
55
  record_name = "#{service}._tcp.#{domain}"
56
56
 
@@ -72,7 +72,7 @@ module Puppet::Network
72
72
  else
73
73
  each_priority(records) do |recs|
74
74
  while next_rr = recs.delete(find_weighted_server(recs))
75
- Puppet.debug "Yielding next server of #{next_rr.target}:#{next_rr.port}"
75
+ Puppet.debug "Yielding next server of #{next_rr.target.to_s}:#{next_rr.port}"
76
76
  yield next_rr.target.to_s, next_rr.port
77
77
  end
78
78
  end
@@ -490,7 +490,8 @@ class Puppet::Node::Environment
490
490
  [self.class, name, full_modulepath, manifest].hash
491
491
  end
492
492
 
493
- # not private so it can be called in tests
493
+ private
494
+
494
495
  def self.extralibs()
495
496
  if Puppet::Util.get_env('PUPPETLIB')
496
497
  split_path(Puppet::Util.get_env('PUPPETLIB'))
@@ -499,15 +500,12 @@ class Puppet::Node::Environment
499
500
  end
500
501
  end
501
502
 
502
- # not private so it can be called in initialize
503
503
  def self.expand_dirs(dirs)
504
504
  dirs.collect do |dir|
505
505
  Puppet::FileSystem.expand_path(dir)
506
506
  end
507
507
  end
508
508
 
509
- private
510
-
511
509
  # Reparse the manifests for the given environment
512
510
  #
513
511
  # There are two sources that can be used for the initial parse:
@@ -462,8 +462,8 @@ module Pal
462
462
  end
463
463
  end
464
464
 
465
- rescue Puppet::Error
466
- # already logged and handled by the compiler, including Puppet::ParseErrorWithIssue
465
+ rescue Puppet::ParseErrorWithIssue, Puppet::Error
466
+ # already logged and handled by the compiler for these two cases
467
467
  raise
468
468
 
469
469
  rescue => detail
@@ -11,7 +11,7 @@ class Puppet::Parser::AST
11
11
  attr_accessor :parent, :scope, :file, :line, :pos
12
12
 
13
13
  def inspect
14
- "( #{self.class} #{self} #{@children.inspect} )"
14
+ "( #{self.class} #{self.to_s} #{@children.inspect} )"
15
15
  end
16
16
 
17
17
  # Evaluate the current object. Just a stub method, since the subclass
@@ -26,6 +26,6 @@ class Puppet::Parser::AST::ResourceParam < Puppet::Parser::AST::Branch
26
26
  end
27
27
 
28
28
  def to_s
29
- "#{@param} => #{@value}"
29
+ "#{@param} => #{@value.to_s}"
30
30
  end
31
31
  end
@@ -24,7 +24,7 @@ module Puppet::Parser::Functions
24
24
  Puppet::Util::Log.levels.each do |level|
25
25
  newfunction(level,
26
26
  :environment => root_env,
27
- :doc => "Log a message on the server at level #{level}.") do |vals|
27
+ :doc => "Log a message on the server at level #{level.to_s}.") do |vals|
28
28
  send(level, vals.join(" "))
29
29
  end
30
30
  end
@@ -7,12 +7,12 @@ result as a String.
7
7
  The first argument to this function should be a `<MODULE NAME>/<TEMPLATE FILE>`
8
8
  reference, which loads `<TEMPLATE FILE>` from `<MODULE NAME>`'s `templates`
9
9
  directory. In most cases, the last argument is optional; if used, it should be a
10
- [hash](https://puppet.com/docs/puppet/latest/lang_data_hash.html) that contains parameters to
10
+ [hash](/puppet/latest/reference/lang_data_hash.html) that contains parameters to
11
11
  pass to the template.
12
12
 
13
- - See the [template](https://puppet.com/docs/puppet/latest/lang_template.html) documentation
13
+ - See the [template](/puppet/latest/reference/lang_template.html) documentation
14
14
  for general template usage information.
15
- - See the [EPP syntax](https://puppet.com/docs/puppet/latest/lang_template_epp.html)
15
+ - See the [EPP syntax](/puppet/latest/reference/lang_template_epp.html)
16
16
  documentation for examples of EPP.
17
17
 
18
18
  For example, to call the apache module's `templates/vhost/_docroot.epp`
@@ -1,4 +1,11 @@
1
- Puppet::Parser::Functions::newfunction(:fail, :arity => -1, :doc => "Fail with a parse error.") do |vals|
1
+ Puppet::Parser::Functions::newfunction(
2
+ :fail,
3
+ :arity => -1,
4
+ :doc => <<DOC
5
+ Fail with a parse error. Any parameters will be stringified,
6
+ concatenated, and passed to the exception-handler.
7
+ DOC
8
+ ) do |vals|
2
9
  vals = vals.collect { |s| s.to_s }.join(" ") if vals.is_a? Array
3
10
  raise Puppet::ParseError, vals.to_s
4
11
  end
@@ -6,12 +6,12 @@ text result as a String.
6
6
 
7
7
  The first argument to this function should be a string containing an EPP
8
8
  template. In most cases, the last argument is optional; if used, it should be a
9
- [hash](https://puppet.com/docs/puppet/latest/lang_data_hash.html) that contains parameters to
9
+ [hash](/puppet/latest/reference/lang_data_hash.html) that contains parameters to
10
10
  pass to the template.
11
11
 
12
- - See the [template](https://puppet.com/docs/puppet/latest/lang_template.html) documentation
12
+ - See the [template](/puppet/latest/reference/lang_template.html) documentation
13
13
  for general template usage information.
14
- - See the [EPP syntax](https://puppet.com/docs/puppet/latest/lang_template_epp.html)
14
+ - See the [EPP syntax](/puppet/latest/reference/lang_template_epp.html)
15
15
  documentation for examples of EPP.
16
16
 
17
17
  For example, to evaluate an inline EPP template and pass it the `docroot` and
@@ -29,7 +29,7 @@ parameter tag without default values. Puppet produces an error if the
29
29
  `inline_epp` function fails to pass any required parameter.
30
30
 
31
31
  An inline EPP template should be written as a single-quoted string or
32
- [heredoc](https://puppet.com/docs/puppet/latest/lang_data_string.html#heredocs).
32
+ [heredoc](/puppet/latest/reference/lang_data_string.html#heredocs).
33
33
  A double-quoted string is subject to expression interpolation before the string
34
34
  is parsed as an EPP template.
35
35
 
@@ -45,7 +45,7 @@ END
45
45
  ~~~
46
46
 
47
47
  - Since 3.5
48
- - Requires [future parser](https://puppet.com/docs/puppet/3.8/experiments_future.html) in Puppet 3.5 to 3.8") do |arguments|
48
+ - Requires [future parser](/puppet/3.8/reference/experiments_future.html) in Puppet 3.5 to 3.8") do |arguments|
49
49
 
50
50
  Puppet::Parser::Functions::Error.is4x('inline_epp')
51
51
  end
@@ -67,8 +67,8 @@ class Puppet::Parser::Scope
67
67
  false
68
68
  end
69
69
 
70
- def add_entries_to(target = {}, include_undef = false)
71
- @parent.add_entries_to(target, include_undef) unless @parent.nil?
70
+ def add_entries_to(target = {})
71
+ @parent.add_entries_to(target) unless @parent.nil?
72
72
  # do not include match data ($0-$n)
73
73
  target
74
74
  end
@@ -106,10 +106,10 @@ class Puppet::Parser::Scope
106
106
  @symbols.include?(name)
107
107
  end
108
108
 
109
- def add_entries_to(target = {}, include_undef = false)
109
+ def add_entries_to(target = {})
110
110
  super
111
111
  @symbols.each do |k, v|
112
- if (v == :undef || v.nil?) && !include_undef
112
+ if v == :undef || v.nil?
113
113
  target.delete(k)
114
114
  else
115
115
  target[ k ] = v
@@ -161,7 +161,7 @@ class Puppet::Parser::Scope
161
161
  raise Puppet::ParseError, _("Numerical variables cannot be deleted: Attempt to delete: $%{name}") % { name: name }
162
162
  end
163
163
 
164
- def add_entries_to(target = {}, include_undef = false)
164
+ def add_entries_to(target = {})
165
165
  # do not include match data ($0-$n)
166
166
  super
167
167
  end
@@ -661,9 +661,8 @@ class Puppet::Parser::Scope
661
661
  # Returns a Hash containing all variables and their values, optionally (and
662
662
  # by default) including the values defined in parent. Local values
663
663
  # shadow parent values. Ephemeral scopes for match results ($0 - $n) are not included.
664
- # Optionally include the variables that are explicitly set to `undef`.
665
664
  #
666
- def to_hash(recursive = true, include_undef = false)
665
+ def to_hash(recursive = true)
667
666
  if recursive and has_enclosing_scope?
668
667
  target = enclosing_scope.to_hash(recursive)
669
668
  if !(inherited = inherited_scope).nil?
@@ -674,7 +673,7 @@ class Puppet::Parser::Scope
674
673
  end
675
674
 
676
675
  # add all local scopes
677
- @ephemeral.last.add_entries_to(target, include_undef)
676
+ @ephemeral.last.add_entries_to(target)
678
677
  target
679
678
  end
680
679
 
@@ -24,6 +24,6 @@ class Puppet::Pops::Evaluator::Collectors::CatalogCollector < Puppet::Pops::Eval
24
24
  end
25
25
 
26
26
  def to_s
27
- "Catalog-Collector[#{@type}]"
27
+ "Catalog-Collector[#{@type.to_s}]"
28
28
  end
29
29
  end
@@ -64,6 +64,6 @@ class Puppet::Pops::Evaluator::Collectors::ExportedCollector < Puppet::Pops::Eva
64
64
  end
65
65
 
66
66
  def to_s
67
- "Exported-Collector[#{@type}]"
67
+ "Exported-Collector[#{@type.to_s}]"
68
68
  end
69
69
  end
@@ -35,11 +35,10 @@ module Puppet::Pops::Evaluator::ExternalSyntaxSupport
35
35
  def lookup_keys_for_syntax(syntax)
36
36
  segments = syntax.split(/\+/)
37
37
  result = []
38
- loop do
38
+ begin
39
39
  result << segments.join("+")
40
40
  segments.shift
41
- break if segments.empty?
42
- end
41
+ end until segments.empty?
43
42
  result
44
43
  end
45
44