puppet 6.15.0-x64-mingw32 → 6.16.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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/CODEOWNERS +2 -7
  3. data/Gemfile.lock +17 -14
  4. data/lib/puppet.rb +32 -8
  5. data/lib/puppet/agent.rb +18 -4
  6. data/lib/puppet/application/agent.rb +1 -2
  7. data/lib/puppet/application/device.rb +1 -1
  8. data/lib/puppet/application/plugin.rb +1 -0
  9. data/lib/puppet/application/ssl.rb +1 -1
  10. data/lib/puppet/configurer.rb +2 -2
  11. data/lib/puppet/context/trusted_information.rb +14 -8
  12. data/lib/puppet/daemon.rb +13 -27
  13. data/lib/puppet/defaults.rb +19 -0
  14. data/lib/puppet/face/facts.rb +1 -1
  15. data/lib/puppet/face/help.rb +29 -3
  16. data/lib/puppet/face/module/search.rb +5 -0
  17. data/lib/puppet/face/plugin.rb +1 -1
  18. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  19. data/lib/puppet/file_system/uniquefile.rb +4 -0
  20. data/lib/puppet/forge/repository.rb +7 -6
  21. data/lib/puppet/functions/filter.rb +1 -0
  22. data/lib/puppet/http/client.rb +22 -11
  23. data/lib/puppet/http/external_client.rb +0 -6
  24. data/lib/puppet/indirector/file_content/http.rb +5 -0
  25. data/lib/puppet/indirector/file_metadata/http.rb +4 -4
  26. data/lib/puppet/indirector/rest.rb +7 -1
  27. data/lib/puppet/network/http/compression.rb +7 -0
  28. data/lib/puppet/network/http/connection.rb +2 -0
  29. data/lib/puppet/network/http/connection_adapter.rb +182 -0
  30. data/lib/puppet/network/http/nocache_pool.rb +1 -0
  31. data/lib/puppet/network/http_pool.rb +2 -2
  32. data/lib/puppet/pal/catalog_compiler.rb +5 -0
  33. data/lib/puppet/pal/pal_impl.rb +4 -1
  34. data/lib/puppet/parser/compiler.rb +28 -25
  35. data/lib/puppet/parser/functions/filter.rb +1 -0
  36. data/lib/puppet/provider/package/aix.rb +17 -2
  37. data/lib/puppet/provider/package/apt.rb +4 -1
  38. data/lib/puppet/provider/package/dnfmodule.rb +24 -4
  39. data/lib/puppet/provider/package/pip.rb +60 -37
  40. data/lib/puppet/provider/package/portage.rb +2 -2
  41. data/lib/puppet/provider/package/yum.rb +7 -0
  42. data/lib/puppet/provider/package/zypper.rb +59 -1
  43. data/lib/puppet/provider/service/systemd.rb +21 -4
  44. data/lib/puppet/provider/user/useradd.rb +5 -1
  45. data/lib/puppet/reports/http.rb +5 -3
  46. data/lib/puppet/runtime.rb +25 -2
  47. data/lib/puppet/ssl/state_machine.rb +33 -8
  48. data/lib/puppet/ssl/verifier_adapter.rb +9 -1
  49. data/lib/puppet/test/test_helper.rb +1 -1
  50. data/lib/puppet/type/file/source.rb +1 -1
  51. data/lib/puppet/type/package.rb +16 -1
  52. data/lib/puppet/type/service.rb +6 -8
  53. data/lib/puppet/type/user.rb +1 -7
  54. data/lib/puppet/util/autoload.rb +1 -18
  55. data/lib/puppet/util/log/destinations.rb +1 -10
  56. data/lib/puppet/util/package/version/range.rb +4 -1
  57. data/lib/puppet/util/package/version/range/eq.rb +14 -0
  58. data/lib/puppet/version.rb +1 -1
  59. data/locales/puppet.pot +191 -111
  60. data/man/man5/puppet.conf.5 +21 -2
  61. data/man/man8/puppet-agent.8 +1 -1
  62. data/man/man8/puppet-apply.8 +1 -1
  63. data/man/man8/puppet-catalog.8 +1 -1
  64. data/man/man8/puppet-config.8 +1 -1
  65. data/man/man8/puppet-describe.8 +1 -1
  66. data/man/man8/puppet-device.8 +1 -1
  67. data/man/man8/puppet-doc.8 +1 -1
  68. data/man/man8/puppet-epp.8 +1 -1
  69. data/man/man8/puppet-facts.8 +1 -1
  70. data/man/man8/puppet-filebucket.8 +1 -1
  71. data/man/man8/puppet-generate.8 +1 -1
  72. data/man/man8/puppet-help.8 +6 -3
  73. data/man/man8/puppet-key.8 +1 -1
  74. data/man/man8/puppet-lookup.8 +1 -1
  75. data/man/man8/puppet-man.8 +1 -1
  76. data/man/man8/puppet-module.8 +4 -1
  77. data/man/man8/puppet-node.8 +1 -1
  78. data/man/man8/puppet-parser.8 +1 -1
  79. data/man/man8/puppet-plugin.8 +1 -1
  80. data/man/man8/puppet-report.8 +1 -1
  81. data/man/man8/puppet-resource.8 +1 -1
  82. data/man/man8/puppet-script.8 +1 -1
  83. data/man/man8/puppet-ssl.8 +1 -1
  84. data/man/man8/puppet-status.8 +1 -1
  85. data/man/man8/puppet.8 +2 -2
  86. data/spec/fixtures/unit/provider/package/dnfmodule/{dnf-module-list-enabled.txt → dnf-module-list.txt} +6 -0
  87. data/spec/fixtures/unit/provider/package/zypper/zypper-search-uninstalled.out +13 -0
  88. data/spec/integration/application/agent_spec.rb +66 -1
  89. data/spec/integration/application/plugin_spec.rb +23 -0
  90. data/spec/integration/http/client_spec.rb +6 -1
  91. data/spec/integration/network/http_pool_spec.rb +56 -0
  92. data/spec/integration/util/windows/adsi_spec.rb +5 -0
  93. data/spec/lib/puppet_spec/https.rb +6 -0
  94. data/spec/unit/agent_spec.rb +47 -1
  95. data/spec/unit/application/agent_spec.rb +4 -4
  96. data/spec/unit/context/trusted_information_spec.rb +17 -0
  97. data/spec/unit/daemon_spec.rb +5 -64
  98. data/spec/unit/face/module/search_spec.rb +17 -0
  99. data/spec/unit/file_system/uniquefile_spec.rb +11 -0
  100. data/spec/unit/http/client_spec.rb +10 -10
  101. data/spec/unit/http/external_client_spec.rb +9 -9
  102. data/spec/unit/indirector/catalog/compiler_spec.rb +1 -0
  103. data/spec/unit/indirector/file_metadata/http_spec.rb +167 -0
  104. data/spec/unit/indirector/file_metadata/rest_spec.rb +15 -14
  105. data/spec/unit/indirector/rest_spec.rb +13 -0
  106. data/spec/unit/network/http/connection_spec.rb +542 -190
  107. data/spec/unit/network/http/nocache_pool_spec.rb +22 -0
  108. data/spec/unit/network/http_pool_spec.rb +63 -57
  109. data/spec/unit/network/http_spec.rb +1 -1
  110. data/spec/unit/provider/package/aix_spec.rb +29 -0
  111. data/spec/unit/provider/package/dnfmodule_spec.rb +25 -5
  112. data/spec/unit/provider/package/pip_spec.rb +42 -16
  113. data/spec/unit/provider/package/portage_spec.rb +5 -0
  114. data/spec/unit/provider/package/yum_spec.rb +16 -8
  115. data/spec/unit/provider/package/zypper_spec.rb +84 -0
  116. data/spec/unit/provider/service/init_spec.rb +1 -0
  117. data/spec/unit/provider/service/openbsd_spec.rb +9 -0
  118. data/spec/unit/provider/service/openwrt_spec.rb +1 -0
  119. data/spec/unit/provider/service/redhat_spec.rb +9 -0
  120. data/spec/unit/provider/service/systemd_spec.rb +84 -13
  121. data/spec/unit/provider/user/useradd_spec.rb +8 -0
  122. data/spec/unit/puppet_pal_catalog_spec.rb +43 -0
  123. data/spec/unit/puppet_spec.rb +33 -0
  124. data/spec/unit/reports/http_spec.rb +1 -1
  125. data/spec/unit/ssl/state_machine_spec.rb +52 -8
  126. data/spec/unit/type/service_spec.rb +9 -8
  127. data/spec/unit/type/user_spec.rb +1 -1
  128. data/spec/unit/util/autoload_spec.rb +2 -1
  129. data/spec/unit/util/log/destinations_spec.rb +1 -29
  130. data/spec/unit/util/package/version/range_spec.rb +22 -1
  131. data/tasks/manpages.rake +5 -35
  132. metadata +10 -4
@@ -1882,6 +1882,25 @@ EOT
1882
1882
  certificate request to be signed. A value of `unlimited` will cause puppet agent
1883
1883
  to ask for a signed certificate indefinitely.
1884
1884
  #{AS_DURATION}",
1885
+ },
1886
+ :waitforlock => {
1887
+ :default => "0",
1888
+ :type => :duration,
1889
+ :desc => "How frequently puppet agent should try running when there is an
1890
+ already ongoing puppet agent instance.
1891
+
1892
+ This argument is by default disabled (value set to 0). In this case puppet agent will
1893
+ immediatly exit if it cannot run at that moment. When a value other than 0 is set, this
1894
+ can also be used in combination with the `maxwaitforlock` argument.
1895
+ #{AS_DURATION}",
1896
+ },
1897
+ :maxwaitforlock => {
1898
+ :default => "1m",
1899
+ :type => :ttl,
1900
+ :desc => "The maximum amount of time the puppet agent should wait for an
1901
+ already running puppet agent to finish before starting a new one. This is set by default to 1 minute.
1902
+ A value of `unlimited` will cause puppet agent to wait indefinitely.
1903
+ #{AS_DURATION}",
1885
1904
  }
1886
1905
  )
1887
1906
 
@@ -75,7 +75,7 @@ Puppet::Indirector::Face.define(:facts, '0.0.1') do
75
75
  facts.name = Puppet[:node_name_value]
76
76
  end
77
77
 
78
- client = Puppet.runtime['http']
78
+ client = Puppet.runtime[:http]
79
79
  session = client.create_session
80
80
  puppet = session.route_to(:puppet)
81
81
 
@@ -24,12 +24,19 @@ Puppet::Face.define(:help, '0.0.1') do
24
24
  summary _("The version of the subcommand for which to show help.")
25
25
  end
26
26
 
27
+ option "--ronn" do
28
+ summary _("Whether to render the help text in ronn format.")
29
+ default_to { false }
30
+ end
31
+
27
32
  default
28
33
  when_invoked do |*args|
29
34
  options = args.pop
30
35
 
31
- if default_case?(args) || help_for_help?(args)
32
- return erb('global.erb').result(binding)
36
+ unless options[:ronn]
37
+ if default_case?(args) || help_for_help?(args)
38
+ return erb('global.erb').result(binding)
39
+ end
33
40
  end
34
41
 
35
42
  if args.length > 2
@@ -54,9 +61,20 @@ Puppet::Face.define(:help, '0.0.1') do
54
61
  if actionname
55
62
  raise ArgumentError, _("The legacy subcommand '%{sub_command}' does not support supplying an action") % { sub_command: facename }
56
63
  end
64
+ # legacy apps already emit ronn output
57
65
  return render_application_help(facename)
58
66
  else
59
- return render_face_help(facename, actionname, version)
67
+ if options[:ronn]
68
+ # Calling `puppet help <app> --ronn` normally calls this action with
69
+ # <app> as the first argument in the `args` array. However, if <app>
70
+ # happens to match the name of an action, like `puppet help help
71
+ # --ronn`, then face_base "eats" the argument and `args` will be
72
+ # empty. Rather than force users to type `puppet help help help
73
+ # --ronn`, default the facename to `:help`
74
+ render_face_man(facename || :help)
75
+ else
76
+ render_face_help(facename, actionname, version)
77
+ end
60
78
  end
61
79
  end
62
80
  end
@@ -69,6 +87,14 @@ Puppet::Face.define(:help, '0.0.1') do
69
87
  args.length == 1 && args.first == 'help'
70
88
  end
71
89
 
90
+ def render_face_man(facename)
91
+ # set 'face' as it's used in the erb processing.
92
+ face = Puppet::Face[facename.to_sym, :current]
93
+ # avoid unused variable warning
94
+ _face = face
95
+ erb('man.erb').result(binding)
96
+ end
97
+
72
98
  def render_application_help(applicationname)
73
99
  return Puppet::Application[applicationname].help
74
100
  rescue StandardError, LoadError => detail
@@ -5,6 +5,8 @@ Puppet::Face.define(:module, '1.0.0') do
5
5
  action(:search) do
6
6
  summary _("Search the Puppet Forge for a module.")
7
7
  description <<-EOT
8
+ This action has been deprecated. Please use the Puppet Forge to search for modules.
9
+
8
10
  Searches a repository for modules whose names, descriptions, or keywords
9
11
  match the provided search term.
10
12
  EOT
@@ -22,6 +24,7 @@ Puppet::Face.define(:module, '1.0.0') do
22
24
  arguments _("<search_term>")
23
25
 
24
26
  when_invoked do |term, options|
27
+ Puppet.deprecation_warning(_("This action has been deprecated. Please use the Puppet Forge to search for modules."))
25
28
  Puppet::ModuleTool.set_option_defaults options
26
29
  Puppet::ModuleTool::Applications::Searcher.new(term, Puppet::Forge.new(options[:module_repository] || Puppet[:module_repository]), options).run
27
30
  end
@@ -94,5 +97,7 @@ Puppet::Face.define(:module, '1.0.0') do
94
97
  highlight[format % [ name.sub('/', '-'), desc, "@#{author}", [keywords].flatten.join(' ') ]]
95
98
  end.join
96
99
  end
100
+
101
+ deprecate
97
102
  end
98
103
  end
@@ -41,7 +41,7 @@ Puppet::Face.define(:plugin, '0.0.1') do
41
41
  when_invoked do |options|
42
42
  remote_environment_for_plugins = Puppet::Node::Environment.remote(Puppet[:environment])
43
43
 
44
- pool = Puppet.runtime['http'].pool
44
+ pool = Puppet.runtime[:http].pool
45
45
  Puppet.override(:http_pool => pool) do
46
46
  begin
47
47
  handler = Puppet::Configurer::PluginHandler.new
@@ -18,7 +18,7 @@ class Puppet::FileServing::HttpMetadata < Puppet::FileServing::Metadata
18
18
  checksum = http_response['content-md5']
19
19
  if checksum
20
20
  # convert base64 digest to hex
21
- checksum = checksum.unpack("m0").first.unpack("H*").first
21
+ checksum = checksum.unpack("m").first.unpack("H*").first
22
22
  @checksums[:md5] = "{md5}#{checksum}"
23
23
  end
24
24
 
@@ -176,6 +176,10 @@ class Puppet::FileSystem::Uniquefile < DelegateClass(File)
176
176
  lock = tmpname + '.lock'
177
177
  mkdir(lock)
178
178
  yield
179
+ rescue Errno::ENOENT => e
180
+ ex = Errno::ENOENT.new("A directory component in #{lock} does not exist or is a dangling symbolic link")
181
+ ex.set_backtrace(e.backtrace)
182
+ raise ex
179
183
  ensure
180
184
  rmdir(lock) if Puppet::FileSystem.exist?(lock)
181
185
  end
@@ -37,18 +37,19 @@ class Puppet::Forge
37
37
  uri = URI(str)
38
38
 
39
39
  headers = { "User-Agent" => user_agent }
40
- user = nil
41
- password = nil
40
+ basic_auth = nil
42
41
 
43
42
  if forge_authorization
44
43
  headers["Authorization"] = forge_authorization
45
44
  elsif @uri.user && @uri.password
46
- user = @uri.user
47
- password = @uri.password
45
+ basic_auth = {
46
+ user: @uri.user,
47
+ password: @uri.password
48
+ }
48
49
  end
49
50
 
50
- http = Puppet.runtime['http']
51
- response = http.get(uri, headers: headers, options: {user: user, password: password, ssl_context: @ssl_context})
51
+ http = Puppet.runtime[:http]
52
+ response = http.get(uri, headers: headers, options: {basic_auth: basic_auth, ssl_context: @ssl_context})
52
53
  io.write(response.body) if io.respond_to?(:write)
53
54
  response
54
55
  rescue Puppet::SSL::CertVerifyError => e
@@ -38,6 +38,7 @@
38
38
  # $data = { "orange" => 0, "blueberry" => 1, "raspberry" => 2 }
39
39
  # $filtered_data = $data.filter |$items| { $items[0] =~ /berry$/ }
40
40
  # # $filtered_data = {blueberry => 1, raspberry => 2}
41
+ # ```
41
42
  #
42
43
  # When the first argument is an array and the lambda has two parameters, Puppet passes the
43
44
  # array's indexes (enumerated from 0) in the first parameter and its values in the second
@@ -23,8 +23,8 @@ class Puppet::HTTP::Client
23
23
  # connections
24
24
  # @param [Puppet::SSL::SSLContext] system_ssl_context the system ssl context
25
25
  # used if :include_system_store is set to true
26
- # @param [Integer] redirect_limit number of HTTP redirections to allow in a
27
- # given request
26
+ # @param [Integer] redirect_limit default number of HTTP redirections to allow
27
+ # in a given request. Can also be specified per-request.
28
28
  # @param [Integer] retry_limit number of HTTP reties allowed in a given
29
29
  # request
30
30
  #
@@ -36,7 +36,7 @@ class Puppet::HTTP::Client
36
36
  }.freeze
37
37
  @default_ssl_context = ssl_context
38
38
  @default_system_ssl_context = system_ssl_context
39
- @redirector = Puppet::HTTP::Redirector.new(redirect_limit)
39
+ @default_redirect_limit = redirect_limit
40
40
  @retry_after_handler = Puppet::HTTP::RetryAfterHandler.new(retry_limit, Puppet[:runinterval])
41
41
  end
42
42
 
@@ -114,6 +114,8 @@ class Puppet::HTTP::Client
114
114
  # be used for connections
115
115
  # @option options [Boolean] :include_system_store (false) if we should include
116
116
  # the system store for connection
117
+ # @param options [Integer] :redirect_limit number of HTTP redirections to allow
118
+ # for this request.
117
119
  #
118
120
  # @yield [Puppet::HTTP::Response] if a block is given yields the response
119
121
  #
@@ -146,6 +148,8 @@ class Puppet::HTTP::Client
146
148
  # be used for connections
147
149
  # @option options [Boolean] :include_system_store (false) if we should include
148
150
  # the system store for connection
151
+ # @param options [Integer] :redirect_limit number of HTTP redirections to allow
152
+ # for this request.
149
153
  #
150
154
  # @return [String] the body of the request response
151
155
  #
@@ -174,6 +178,8 @@ class Puppet::HTTP::Client
174
178
  # be used for connections
175
179
  # @option options [Boolean] :include_system_store (false) if we should include
176
180
  # the system store for connection
181
+ # @param options [Integer] :redirect_limit number of HTTP redirections to allow
182
+ # for this request.
177
183
  #
178
184
  # @return [String] the body of the request response
179
185
  #
@@ -207,6 +213,8 @@ class Puppet::HTTP::Client
207
213
  # be used for connections
208
214
  # @option options [Boolean] :include_system_store (false) if we should include
209
215
  # the system store for connection
216
+ # @param options [Integer] :redirect_limit number of HTTP redirections to allow
217
+ # for this request.
210
218
  #
211
219
  # @return [String] the body of the request response
212
220
  #
@@ -242,6 +250,8 @@ class Puppet::HTTP::Client
242
250
  # be used for connections
243
251
  # @option options [Boolean] :include_system_store (false) if we should include
244
252
  # the system store for connection
253
+ # @param options [Integer] :redirect_limit number of HTTP redirections to allow
254
+ # for this request.
245
255
  #
246
256
  # @return [String] the body of the request response
247
257
  #
@@ -277,8 +287,9 @@ class Puppet::HTTP::Client
277
287
  private
278
288
 
279
289
  def execute_streaming(request, options: {}, &block)
280
- user = options.fetch(:user, nil)
281
- password = options.fetch(:password, nil)
290
+ redirector = Puppet::HTTP::Redirector.new(options.fetch(:redirect_limit, @default_redirect_limit))
291
+
292
+ basic_auth = options.fetch(:basic_auth, nil)
282
293
 
283
294
  redirects = 0
284
295
  retries = 0
@@ -287,7 +298,7 @@ class Puppet::HTTP::Client
287
298
 
288
299
  while !done do
289
300
  connect(request.uri, options: options) do |http|
290
- apply_auth(request, user, password)
301
+ apply_auth(request, basic_auth)
291
302
 
292
303
  # don't call return within the `request` block
293
304
  http.request(request) do |nethttp|
@@ -295,8 +306,8 @@ class Puppet::HTTP::Client
295
306
  begin
296
307
  Puppet.debug("HTTP #{request.method.upcase} #{request.uri} returned #{response.code} #{response.reason}")
297
308
 
298
- if @redirector.redirect?(request, response)
299
- request = @redirector.redirect_to(request, response, redirects)
309
+ if redirector.redirect?(request, response)
310
+ request = redirector.redirect_to(request, response, redirects)
300
311
  redirects += 1
301
312
  next
302
313
  elsif @retry_after_handler.retry_after?(request, response)
@@ -395,9 +406,9 @@ class Puppet::HTTP::Client
395
406
  @default_system_ssl_context = ssl.create_system_context(cacerts: cacerts)
396
407
  end
397
408
 
398
- def apply_auth(request, user, password)
399
- if user && password
400
- request.basic_auth(user, password)
409
+ def apply_auth(request, basic_auth)
410
+ if basic_auth
411
+ request.basic_auth(basic_auth[:user], basic_auth[:password])
401
412
  end
402
413
  end
403
414
 
@@ -21,9 +21,6 @@ class Puppet::HTTP::ExternalClient < Puppet::HTTP::Client
21
21
  url = encode_query(url, params)
22
22
 
23
23
  options[:use_ssl] = url.scheme == 'https'
24
- if options[:user] && options[:password]
25
- options[:basic_auth] = { user: options[:user], password: options[:password] }
26
- end
27
24
 
28
25
  client = @http_client_class.new(url.host, url.port, options)
29
26
  response = Puppet::HTTP::Response.new(client.get(url.request_uri, headers, options), url)
@@ -46,9 +43,6 @@ class Puppet::HTTP::ExternalClient < Puppet::HTTP::Client
46
43
  url = encode_query(url, params)
47
44
 
48
45
  options[:use_ssl] = url.scheme == 'https'
49
- if options[:user] && options[:password]
50
- options[:basic_auth] = { user: options[:user], password: options[:password] }
51
- end
52
46
 
53
47
  client = @http_client_class.new(url.host, url.port, options)
54
48
  response = Puppet::HTTP::Response.new(client.post(url.request_uri, body, headers, options), url)
@@ -10,6 +10,11 @@ class Puppet::Indirector::FileContent::Http < Puppet::Indirector::GenericHttp
10
10
 
11
11
  @http_method = :get
12
12
 
13
+ def initialize
14
+ Puppet.deprecation_warning(_("Puppet::Indirector::FileContent::Http is deprecated. Use Puppet::HTTP::Client instead."))
15
+ super
16
+ end
17
+
13
18
  def find(request)
14
19
  response = super
15
20
  model.from_binary(uncompress_body(response))
@@ -8,12 +8,12 @@ class Puppet::Indirector::FileMetadata::Http < Puppet::Indirector::GenericHttp
8
8
 
9
9
  include Puppet::FileServing::TerminusHelper
10
10
 
11
- @http_method = :head
12
-
13
11
  def find(request)
14
- head = super
12
+ uri = URI(request.uri)
13
+ client = Puppet.runtime[:http]
14
+ head = client.head(uri, options: {include_system_store: true})
15
15
 
16
- if head.is_a?(Net::HTTPSuccess)
16
+ if head.success?
17
17
  metadata = Puppet::FileServing::HttpMetadata.new(head)
18
18
  metadata.checksum_type = request.options[:checksum_type] if request.options[:checksum_type]
19
19
  metadata.collect
@@ -55,7 +55,8 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
55
55
  # Should we use puppet's http client to make requests. Will return
56
56
  # false when running in puppetserver
57
57
  def use_http_client?
58
- Puppet::Network::HttpPool.http_client_class == Puppet::Network::HTTP::Connection
58
+ Puppet::Network::HttpPool.http_client_class == Puppet::Network::HTTP::Connection ||
59
+ Puppet::Network::HttpPool.http_client_class == Puppet::Network::HTTP::ConnectionAdapter
59
60
  end
60
61
 
61
62
  # Provide appropriate headers.
@@ -111,6 +112,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
111
112
  end
112
113
 
113
114
  def find(request)
115
+ Puppet.deprecation_warning(_("Puppet::Indirector::Rest#find is deprecated. Use Puppet::HTTP::Client instead."))
114
116
  uri, body = IndirectedRoutes.request_to_uri_and_body(request)
115
117
  uri_with_query_string = "#{uri}?#{body}"
116
118
 
@@ -149,6 +151,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
149
151
  end
150
152
 
151
153
  def head(request)
154
+ Puppet.deprecation_warning(_("Puppet::Indirector::Rest#head is deprecated. Use Puppet::HTTP::Client instead."))
152
155
  response = do_request(request) do |req|
153
156
  http_head(req, IndirectedRoutes.request_to_uri(req), headers)
154
157
  end
@@ -161,6 +164,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
161
164
  end
162
165
 
163
166
  def search(request)
167
+ Puppet.deprecation_warning(_("Puppet::Indirector::Rest#search is deprecated. Use Puppet::HTTP::Client instead."))
164
168
  response = do_request(request) do |req|
165
169
  http_get(req, IndirectedRoutes.request_to_uri(req), headers)
166
170
  end
@@ -174,6 +178,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
174
178
  end
175
179
 
176
180
  def destroy(request)
181
+ Puppet.deprecation_warning(_("Puppet::Indirector::Rest#destroy is deprecated. Use Puppet::HTTP::Client instead."))
177
182
  raise ArgumentError, _("DELETE does not accept options") unless request.options.empty?
178
183
 
179
184
  response = do_request(request) do |req|
@@ -189,6 +194,7 @@ class Puppet::Indirector::REST < Puppet::Indirector::Terminus
189
194
  end
190
195
 
191
196
  def save(request)
197
+ Puppet.deprecation_warning(_("Puppet::Indirector::Rest#save is deprecated. Use Puppet::HTTP::Client instead."))
192
198
  raise ArgumentError, _("PUT does not accept options") unless request.options.empty?
193
199
 
194
200
  response = do_request(request) do |req|
@@ -20,9 +20,11 @@ module Puppet::Network::HTTP::Compression
20
20
  def uncompress_body(response)
21
21
  case response['content-encoding']
22
22
  when 'gzip'
23
+ Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::Active#uncompress_body is deprecated.'))
23
24
  # ZLib::GzipReader has an associated encoding, by default Encoding.default_external
24
25
  return Zlib::GzipReader.new(StringIO.new(response.body), :encoding => Encoding::BINARY).read
25
26
  when 'deflate'
27
+ Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::Active#uncompress_body is deprecated.'))
26
28
  return Zlib::Inflate.new.inflate(response.body)
27
29
  when nil, 'identity'
28
30
  return response.body
@@ -32,6 +34,7 @@ module Puppet::Network::HTTP::Compression
32
34
  end
33
35
 
34
36
  def uncompress(response)
37
+ Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::Active#uncompress is deprecated.'))
35
38
  raise Net::HTTPError.new("No block passed", response) unless block_given?
36
39
 
37
40
  case response['content-encoding']
@@ -71,6 +74,7 @@ module Puppet::Network::HTTP::Compression
71
74
  end
72
75
 
73
76
  def uncompress(chunk)
77
+ Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::ZlibAdapter#uncompress is deprecated.'))
74
78
  out = @uncompressor.inflate(chunk)
75
79
  @first = false
76
80
  return out
@@ -97,6 +101,7 @@ module Puppet::Network::HTTP::Compression
97
101
 
98
102
  module None
99
103
  def uncompress_body(response)
104
+ Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::None#uncompress_body is deprecated.'))
100
105
  response.body
101
106
  end
102
107
 
@@ -105,12 +110,14 @@ module Puppet::Network::HTTP::Compression
105
110
  end
106
111
 
107
112
  def uncompress(response)
113
+ Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::None#uncompress is deprecated.'))
108
114
  yield IdentityAdapter.new
109
115
  end
110
116
  end
111
117
 
112
118
  class IdentityAdapter
113
119
  def uncompress(chunk)
120
+ Puppet.deprecation_warning(_('Puppet::Network::HTTP::Compression::IdentityAdapter#uncompress is deprecated.'))
114
121
  chunk
115
122
  end
116
123
 
@@ -343,6 +343,8 @@ module Puppet::Network::HTTP
343
343
  end
344
344
 
345
345
  def with_connection(site, &block)
346
+ Puppet.deprecation_warning(_('Puppet::Network::HTTP::Connection is deprecated. Please use Puppet::Network::HTTP::ConnectionAdapter instead.'))
347
+
346
348
  response = nil
347
349
  @pool.with_connection(site, @verifier) do |conn|
348
350
  response = yield conn