puppet 6.10.1 → 6.11.0

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 (242) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -4
  3. data/Gemfile.lock +20 -12
  4. data/ext/project_data.yaml +3 -2
  5. data/ext/regexp_nodes/regexp_nodes.rb +4 -4
  6. data/ext/windows/service/daemon.rb +33 -8
  7. data/install.rb +6 -6
  8. data/lib/puppet.rb +8 -0
  9. data/lib/puppet/application.rb +1 -1
  10. data/lib/puppet/application/agent.rb +3 -0
  11. data/lib/puppet/application/apply.rb +2 -2
  12. data/lib/puppet/application/describe.rb +3 -9
  13. data/lib/puppet/application/device.rb +3 -0
  14. data/lib/puppet/application/doc.rb +1 -1
  15. data/lib/puppet/application/lookup.rb +1 -1
  16. data/lib/puppet/application/script.rb +2 -2
  17. data/lib/puppet/application/ssl.rb +25 -21
  18. data/lib/puppet/configurer.rb +42 -0
  19. data/lib/puppet/configurer/downloader.rb +2 -6
  20. data/lib/puppet/context/trusted_information.rb +42 -4
  21. data/lib/puppet/defaults.rb +19 -4
  22. data/lib/puppet/face/module/list.rb +5 -5
  23. data/lib/puppet/face/module/search.rb +1 -1
  24. data/lib/puppet/face/module/uninstall.rb +1 -1
  25. data/lib/puppet/face/module/upgrade.rb +1 -1
  26. data/lib/puppet/file_serving/http_metadata.rb +1 -1
  27. data/lib/puppet/file_system.rb +0 -8
  28. data/lib/puppet/file_system/memory_file.rb +1 -1
  29. data/lib/puppet/file_system/posix.rb +3 -2
  30. data/lib/puppet/forge.rb +3 -3
  31. data/lib/puppet/functions.rb +1 -2
  32. data/lib/puppet/gettext/module_translations.rb +1 -1
  33. data/lib/puppet/graph/rb_tree_map.rb +2 -2
  34. data/lib/puppet/graph/simple_graph.rb +4 -3
  35. data/lib/puppet/http.rb +29 -0
  36. data/lib/puppet/http/client.rb +156 -0
  37. data/lib/puppet/http/errors.rb +30 -0
  38. data/lib/puppet/http/redirector.rb +48 -0
  39. data/lib/puppet/http/resolver.rb +5 -0
  40. data/lib/puppet/http/resolver/settings.rb +5 -0
  41. data/lib/puppet/http/resolver/srv.rb +13 -0
  42. data/lib/puppet/http/response.rb +34 -0
  43. data/lib/puppet/http/retry_after_handler.rb +47 -0
  44. data/lib/puppet/http/service.rb +18 -0
  45. data/lib/puppet/http/service/ca.rb +49 -0
  46. data/lib/puppet/http/session.rb +55 -0
  47. data/lib/puppet/indirector/file_bucket_file/file.rb +1 -1
  48. data/lib/puppet/indirector/hiera.rb +2 -0
  49. data/lib/puppet/indirector/request.rb +1 -1
  50. data/lib/puppet/indirector/resource/ral.rb +1 -3
  51. data/lib/puppet/indirector/resource/validator.rb +1 -1
  52. data/lib/puppet/interface.rb +2 -1
  53. data/lib/puppet/interface/documentation.rb +1 -1
  54. data/lib/puppet/loaders.rb +0 -1
  55. data/lib/puppet/metatype/manager.rb +1 -1
  56. data/lib/puppet/module.rb +1 -1
  57. data/lib/puppet/module/task.rb +20 -4
  58. data/lib/puppet/module_tool/applications/installer.rb +1 -1
  59. data/lib/puppet/module_tool/applications/uninstaller.rb +3 -3
  60. data/lib/puppet/module_tool/metadata.rb +1 -1
  61. data/lib/puppet/module_tool/shared_behaviors.rb +4 -4
  62. data/lib/puppet/module_tool/tar/mini.rb +1 -1
  63. data/lib/puppet/network/http.rb +2 -6
  64. data/lib/puppet/network/http/api/indirected_routes.rb +12 -11
  65. data/lib/puppet/network/http/connection.rb +10 -12
  66. data/lib/puppet/network/http/pool.rb +2 -0
  67. data/lib/puppet/network/http/site.rb +5 -1
  68. data/lib/puppet/network/resolver.rb +4 -4
  69. data/lib/puppet/node/environment.rb +4 -2
  70. data/lib/puppet/pal/pal_impl.rb +2 -2
  71. data/lib/puppet/parser/ast.rb +1 -1
  72. data/lib/puppet/parser/ast/resourceparam.rb +1 -1
  73. data/lib/puppet/parser/functions.rb +1 -1
  74. data/lib/puppet/parser/scope.rb +8 -7
  75. data/lib/puppet/pops/evaluator/collectors/catalog_collector.rb +1 -1
  76. data/lib/puppet/pops/evaluator/collectors/exported_collector.rb +1 -1
  77. data/lib/puppet/pops/evaluator/external_syntax_support.rb +3 -2
  78. data/lib/puppet/pops/evaluator/runtime3_support.rb +4 -7
  79. data/lib/puppet/pops/loader/module_loaders.rb +1 -1
  80. data/lib/puppet/pops/loader/task_instantiator.rb +4 -0
  81. data/lib/puppet/pops/loaders.rb +1 -1
  82. data/lib/puppet/pops/lookup/hiera_config.rb +1 -0
  83. data/lib/puppet/pops/lookup/sub_lookup.rb +1 -1
  84. data/lib/puppet/pops/merge_strategy.rb +22 -18
  85. data/lib/puppet/pops/parser/heredoc_support.rb +1 -1
  86. data/lib/puppet/pops/parser/interpolation_support.rb +4 -4
  87. data/lib/puppet/pops/parser/locator.rb +1 -1
  88. data/lib/puppet/pops/parser/pn_parser.rb +17 -16
  89. data/lib/puppet/pops/puppet_stack.rb +52 -48
  90. data/lib/puppet/pops/types/p_sensitive_type.rb +1 -1
  91. data/lib/puppet/pops/types/p_uri_type.rb +1 -1
  92. data/lib/puppet/pops/types/string_converter.rb +10 -10
  93. data/lib/puppet/pops/types/types.rb +3 -3
  94. data/lib/puppet/property.rb +1 -1
  95. data/lib/puppet/property/ensure.rb +1 -1
  96. data/lib/puppet/provider/exec.rb +6 -2
  97. data/lib/puppet/provider/nameservice/directoryservice.rb +1 -1
  98. data/lib/puppet/provider/nameservice/pw.rb +2 -2
  99. data/lib/puppet/provider/package/apt.rb +5 -1
  100. data/lib/puppet/provider/package/dnfmodule.rb +87 -0
  101. data/lib/puppet/provider/package/dpkg.rb +31 -17
  102. data/lib/puppet/provider/package/openbsd.rb +1 -1
  103. data/lib/puppet/provider/package/pip.rb +34 -9
  104. data/lib/puppet/provider/package/portage.rb +1 -1
  105. data/lib/puppet/provider/package/rpm.rb +5 -5
  106. data/lib/puppet/provider/package/windows/package.rb +1 -1
  107. data/lib/puppet/provider/package/yum.rb +1 -1
  108. data/lib/puppet/provider/parsedfile.rb +1 -1
  109. data/lib/puppet/provider/service/daemontools.rb +9 -9
  110. data/lib/puppet/provider/service/openbsd.rb +1 -1
  111. data/lib/puppet/provider/service/rcng.rb +2 -2
  112. data/lib/puppet/provider/service/runit.rb +2 -8
  113. data/lib/puppet/provider/service/systemd.rb +10 -10
  114. data/lib/puppet/provider/user/directoryservice.rb +1 -1
  115. data/lib/puppet/provider/user/user_role_add.rb +1 -1
  116. data/lib/puppet/provider/user/useradd.rb +22 -13
  117. data/lib/puppet/provider/user/windows_adsi.rb +4 -5
  118. data/lib/puppet/reference/indirection.rb +2 -2
  119. data/lib/puppet/reference/metaparameter.rb +1 -3
  120. data/lib/puppet/reference/providers.rb +1 -1
  121. data/lib/puppet/reference/type.rb +3 -9
  122. data/lib/puppet/reports.rb +1 -1
  123. data/lib/puppet/resource.rb +1 -1
  124. data/lib/puppet/resource/catalog.rb +1 -1
  125. data/lib/puppet/rest/errors.rb +1 -0
  126. data/lib/puppet/rest/response.rb +1 -0
  127. data/lib/puppet/rest/route.rb +1 -0
  128. data/lib/puppet/rest/routes.rb +3 -0
  129. data/lib/puppet/runtime.rb +25 -0
  130. data/lib/puppet/settings.rb +3 -3
  131. data/lib/puppet/settings/environment_conf.rb +1 -0
  132. data/lib/puppet/ssl/host.rb +1 -1
  133. data/lib/puppet/ssl/oids.rb +1 -1
  134. data/lib/puppet/ssl/state_machine.rb +23 -15
  135. data/lib/puppet/test/test_helper.rb +1 -1
  136. data/lib/puppet/transaction/report.rb +1 -1
  137. data/lib/puppet/trusted_external.rb +13 -0
  138. data/lib/puppet/type.rb +1 -3
  139. data/lib/puppet/type/exec.rb +7 -3
  140. data/lib/puppet/type/file.rb +1 -2
  141. data/lib/puppet/type/file/source.rb +2 -2
  142. data/lib/puppet/type/package.rb +10 -3
  143. data/lib/puppet/type/schedule.rb +1 -1
  144. data/lib/puppet/type/service.rb +1 -1
  145. data/lib/puppet/util.rb +2 -2
  146. data/lib/puppet/util/command_line/trollop.rb +1 -1
  147. data/lib/puppet/util/http_proxy.rb +2 -10
  148. data/lib/puppet/util/log.rb +2 -2
  149. data/lib/puppet/util/log/destinations.rb +2 -2
  150. data/lib/puppet/util/logging.rb +2 -2
  151. data/lib/puppet/util/metric.rb +2 -2
  152. data/lib/puppet/util/platform.rb +15 -4
  153. data/lib/puppet/util/provider_features.rb +2 -4
  154. data/lib/puppet/util/rdoc.rb +1 -1
  155. data/lib/puppet/util/reference.rb +1 -1
  156. data/lib/puppet/util/resource_template.rb +1 -1
  157. data/lib/puppet/util/selinux.rb +3 -1
  158. data/lib/puppet/util/windows/registry.rb +7 -5
  159. data/lib/puppet/vendor.rb +1 -1
  160. data/lib/puppet/vendor/require_vendored.rb +0 -1
  161. data/lib/puppet/version.rb +1 -1
  162. data/lib/puppet/x509/cert_provider.rb +4 -1
  163. data/locales/puppet.pot +279 -203
  164. data/man/man5/puppet.conf.5 +30 -8
  165. data/man/man8/puppet-agent.8 +4 -1
  166. data/man/man8/puppet-apply.8 +1 -1
  167. data/man/man8/puppet-catalog.8 +1 -1
  168. data/man/man8/puppet-config.8 +1 -1
  169. data/man/man8/puppet-describe.8 +1 -1
  170. data/man/man8/puppet-device.8 +1 -1
  171. data/man/man8/puppet-doc.8 +1 -1
  172. data/man/man8/puppet-epp.8 +1 -1
  173. data/man/man8/puppet-facts.8 +1 -1
  174. data/man/man8/puppet-filebucket.8 +1 -1
  175. data/man/man8/puppet-generate.8 +1 -1
  176. data/man/man8/puppet-help.8 +1 -1
  177. data/man/man8/puppet-key.8 +1 -1
  178. data/man/man8/puppet-lookup.8 +1 -1
  179. data/man/man8/puppet-man.8 +1 -1
  180. data/man/man8/puppet-module.8 +1 -1
  181. data/man/man8/puppet-node.8 +1 -1
  182. data/man/man8/puppet-parser.8 +1 -1
  183. data/man/man8/puppet-plugin.8 +1 -1
  184. data/man/man8/puppet-report.8 +1 -1
  185. data/man/man8/puppet-resource.8 +1 -1
  186. data/man/man8/puppet-script.8 +1 -1
  187. data/man/man8/puppet-ssl.8 +1 -1
  188. data/man/man8/puppet-status.8 +1 -1
  189. data/man/man8/puppet.8 +2 -2
  190. data/spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt +11 -0
  191. data/spec/integration/configurer_spec.rb +52 -0
  192. data/spec/lib/puppet/certificate_factory.rb +2 -2
  193. data/spec/spec_helper.rb +24 -0
  194. data/spec/unit/application/device_spec.rb +6 -0
  195. data/spec/unit/application/ssl_spec.rb +4 -7
  196. data/spec/unit/configurer_spec.rb +1 -0
  197. data/spec/unit/context/trusted_information_spec.rb +41 -2
  198. data/spec/unit/http/client_spec.rb +440 -0
  199. data/spec/unit/http/resolver_spec.rb +45 -0
  200. data/spec/unit/http/service/ca_spec.rb +106 -0
  201. data/spec/unit/http/service_spec.rb +32 -0
  202. data/spec/unit/http/session_spec.rb +102 -0
  203. data/spec/unit/indirector/resource/ral_spec.rb +4 -4
  204. data/spec/unit/network/http/connection_spec.rb +119 -145
  205. data/spec/unit/network/http/site_spec.rb +7 -0
  206. data/spec/unit/parser/scope_spec.rb +10 -0
  207. data/spec/unit/pops/loaders/loaders_spec.rb +13 -2
  208. data/spec/unit/pops/loaders/module_loaders_spec.rb +37 -0
  209. data/spec/unit/provider/exec_spec.rb +209 -0
  210. data/spec/unit/provider/package/dnfmodule_spec.rb +186 -0
  211. data/spec/unit/provider/package/dpkg_spec.rb +238 -78
  212. data/spec/unit/provider/package/pip_spec.rb +51 -6
  213. data/spec/unit/provider/service/daemontools_spec.rb +24 -0
  214. data/spec/unit/provider/service/runit_spec.rb +24 -0
  215. data/spec/unit/provider/service/systemd_spec.rb +25 -25
  216. data/spec/unit/provider/user/useradd_spec.rb +46 -0
  217. data/spec/unit/ssl/host_spec.rb +0 -5
  218. data/spec/unit/ssl/state_machine_spec.rb +16 -10
  219. data/spec/unit/type/exec_spec.rb +6 -12
  220. data/spec/unit/type/file_spec.rb +9 -4
  221. data/spec/unit/type/package_spec.rb +5 -0
  222. data/spec/unit/util/execution_spec.rb +16 -0
  223. data/spec/unit/util/http_proxy_spec.rb +79 -27
  224. data/spec/unit/util/log/destinations_spec.rb +7 -3
  225. metadata +45 -22
  226. data/lib/puppet/pops/loader/null_loader.rb +0 -60
  227. data/lib/puppet/vendor/deep_merge/CHANGELOG +0 -45
  228. data/lib/puppet/vendor/deep_merge/Gemfile +0 -3
  229. data/lib/puppet/vendor/deep_merge/LICENSE +0 -21
  230. data/lib/puppet/vendor/deep_merge/PUPPET_README.md +0 -6
  231. data/lib/puppet/vendor/deep_merge/README.md +0 -113
  232. data/lib/puppet/vendor/deep_merge/Rakefile +0 -19
  233. data/lib/puppet/vendor/deep_merge/deep_merge.gemspec +0 -35
  234. data/lib/puppet/vendor/deep_merge/lib/deep_merge.rb +0 -2
  235. data/lib/puppet/vendor/deep_merge/lib/deep_merge/core.rb +0 -210
  236. data/lib/puppet/vendor/deep_merge/lib/deep_merge/deep_merge_hash.rb +0 -28
  237. data/lib/puppet/vendor/deep_merge/lib/deep_merge/rails_compat.rb +0 -27
  238. data/lib/puppet/vendor/deep_merge/test/test_deep_merge.rb +0 -608
  239. data/lib/puppet/vendor/load_deep_merge.rb +0 -1
  240. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml +0 -24
  241. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml +0 -24
  242. data/spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml +0 -24
@@ -375,6 +375,11 @@ describe Puppet::Type.type(:package) do
375
375
  expect(pkg[:allow_virtual]).to eq true
376
376
  end
377
377
 
378
+ it "defaults to false on dpkg provider" do
379
+ pkg = Puppet::Type.type(:package).new(:name => 'yay', :provider => :dpkg)
380
+ expect(pkg[:allow_virtual]).to be_nil
381
+ end
382
+
378
383
  it "defaults to false on platforms that do not support virtual packages" do
379
384
  pkg = Puppet::Type.type(:package).new(:name => 'yay', :provider => :apple)
380
385
  expect(pkg[:allow_virtual]).to be_nil
@@ -128,6 +128,13 @@ describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
128
128
 
129
129
  call_exec_posix('test command', { :cwd => cwd }, @stdin, @stdout, @stderr)
130
130
  end
131
+
132
+ it "should not change the current working directory if cwd is unspecified" do
133
+ expect(Dir).to receive(:chdir).never
134
+ expect(Kernel).to receive(:exec).with('test command')
135
+
136
+ call_exec_posix('test command', {}, @stdin, @stdout, @stderr)
137
+ end
131
138
  end
132
139
 
133
140
  it "should return the pid of the child process" do
@@ -171,6 +178,15 @@ describe Puppet::Util::Execution, if: !Puppet::Util::Platform.jruby? do
171
178
 
172
179
  call_exec_windows('test command', { :cwd => cwd }, @stdin, @stdout, @stderr)
173
180
  end
181
+
182
+ it "should not change the current working directory if cwd is unspecified" do
183
+ expect(Dir).to receive(:chdir).never
184
+ expect(Process).to receive(:create) do |args|
185
+ expect(args[:cwd]).to be_nil
186
+ end
187
+
188
+ call_exec_windows('test command', {}, @stdin, @stdout, @stderr)
189
+ end
174
190
  end
175
191
 
176
192
  context 'suppress_window option' do
@@ -60,6 +60,64 @@ describe Puppet::Util::HttpProxy do
60
60
  expects_direct_connection_to(http, www)
61
61
  end
62
62
  end
63
+
64
+ context 'when setting no_proxy' do
65
+ before :each do
66
+ Puppet[:http_proxy_host] = host
67
+ Puppet[:http_proxy_port] = port
68
+ end
69
+
70
+ it 'connects directly to the server when HTTP_PROXY environment variable is set, but server matches no_proxy setting' do
71
+ Puppet[:no_proxy] = www.host
72
+
73
+ Puppet::Util.withenv('HTTP_PROXY' => "http://#{host}:#{port}") do
74
+ http = subject.proxy(www)
75
+ expects_direct_connection_to(http, www)
76
+ end
77
+ end
78
+
79
+ it 'connects directly to the server when no_proxy matches wildcard domain' do
80
+ Puppet[:no_proxy] = '*.example.com'
81
+
82
+ http = subject.proxy(www)
83
+ expects_direct_connection_to(http, www)
84
+ end
85
+
86
+ it 'connects directly to the server when no_proxy matches dotted domain' do
87
+ Puppet[:no_proxy] = '.example.com'
88
+
89
+ http = subject.proxy(www)
90
+ expects_direct_connection_to(http, www)
91
+ end
92
+
93
+ it 'connects directly to the server when no_proxy matches a domain suffix like ruby does' do
94
+ Puppet[:no_proxy] = 'example.com'
95
+
96
+ http = subject.proxy(www)
97
+ expects_direct_connection_to(http, www)
98
+ end
99
+
100
+ it 'connects directly to the server when no_proxy matches a partial suffix like ruby does' do
101
+ Puppet[:no_proxy] = 'ample.com'
102
+
103
+ http = subject.proxy(www)
104
+ expects_direct_connection_to(http, www)
105
+ end
106
+
107
+ it 'connects directly to the server when it is a subdomain of no_proxy' do
108
+ Puppet[:no_proxy] = '*.com'
109
+
110
+ http = subject.proxy(www)
111
+ expects_direct_connection_to(http, www)
112
+ end
113
+
114
+ it 'connects directly to the server when no_proxy is *' do
115
+ Puppet[:no_proxy] = '*'
116
+
117
+ http = subject.proxy(www)
118
+ expects_direct_connection_to(http, www)
119
+ end
120
+ end
63
121
  end
64
122
 
65
123
  describe ".http_proxy_env" do
@@ -291,22 +349,22 @@ describe Puppet::Util::HttpProxy do
291
349
 
292
350
  describe '.request_with_redirects' do
293
351
  let(:dest) { URI.parse('http://mydomain.com/some/path') }
294
- let(:http_ok) { double('http ok', :code => 200, :message => 'HTTP OK') }
295
352
 
296
353
  it 'generates accept and accept-encoding headers' do
297
- allow_any_instance_of(Net::HTTP).to receive(:head).and_return(http_ok)
298
- expect_any_instance_of(Net::HTTP).to receive(:get) do |_, _, headers|
299
- expect(headers)
300
- .to match({'Accept' => '*/*',
301
- 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
302
- 'User-Agent' => /Puppet/})
303
- end.and_return(http_ok)
354
+ stub_request(:head, dest)
355
+
356
+ headers = {
357
+ 'Accept' => '*/*',
358
+ 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
359
+ 'User-Agent' => /Puppet/
360
+ }
361
+ stub_request(:get, dest).with(headers: headers)
304
362
 
305
363
  subject.request_with_redirects(dest, :get, 0)
306
364
  end
307
365
 
308
366
  it 'can return a compressed response body' do
309
- allow_any_instance_of(Net::HTTP).to receive(:head).and_return(http_ok)
367
+ stub_request(:head, dest)
310
368
 
311
369
  compressed_body = [
312
370
  0x1f, 0x8b, 0x08, 0x08, 0xe9, 0x08, 0x7a, 0x5a, 0x00, 0x03,
@@ -314,9 +372,7 @@ describe Puppet::Util::HttpProxy do
314
372
  0x00, 0x7a, 0x7a, 0x6f, 0xed, 0x03, 0x00, 0x00, 0x00
315
373
  ].pack('C*')
316
374
 
317
- response = double('http ok', :code => 200, :message => 'HTTP OK', :body => compressed_body)
318
- allow(response).to receive(:[]).with('content-encoding').and_return('gzip')
319
- expect_any_instance_of(Net::HTTP).to receive(:get).and_return(response)
375
+ stub_request(:get, dest).to_return(status: 200, body: compressed_body, headers: { 'Content-Encoding' => 'gzip' })
320
376
 
321
377
  expect(
322
378
  uncompress_body(subject.request_with_redirects(dest, :get, 0))
@@ -324,13 +380,14 @@ describe Puppet::Util::HttpProxy do
324
380
  end
325
381
 
326
382
  it 'generates accept and accept-encoding headers when a block is provided' do
327
- allow_any_instance_of(Net::HTTP).to receive(:head).and_return(http_ok)
328
- expect_any_instance_of(Net::HTTP).to receive(:request_get) do |_, _, headers, &block|
329
- expect(headers)
330
- .to match({'Accept' => '*/*',
331
- 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
332
- 'User-Agent' => /Puppet/})
333
- end.and_return(http_ok)
383
+ stub_request(:head, dest)
384
+
385
+ headers = {
386
+ 'Accept' => '*/*',
387
+ 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3',
388
+ 'User-Agent' => /Puppet/
389
+ }
390
+ stub_request(:get, dest).with(headers: headers)
334
391
 
335
392
  subject.request_with_redirects(dest, :get, 0) do
336
393
  # unused
@@ -338,7 +395,7 @@ describe Puppet::Util::HttpProxy do
338
395
  end
339
396
 
340
397
  it 'only makes a single HEAD request' do
341
- expect_any_instance_of(Net::HTTP).to receive(:head).with(anything, anything).and_return(http_ok)
398
+ stub_request(:head, dest)
342
399
 
343
400
  subject.request_with_redirects(dest, :head, 0)
344
401
  end
@@ -346,13 +403,8 @@ describe Puppet::Util::HttpProxy do
346
403
  it 'preserves query parameters' do
347
404
  url = URI.parse('http://mydomain.com/some/path?foo=bar')
348
405
 
349
- expect_any_instance_of(Net::HTTP).to receive(:head) do |_method, path, _headers|
350
- expect(path).to eq(url)
351
- end.and_return(http_ok)
352
-
353
- expect_any_instance_of(Net::HTTP).to receive(:request_get) do |_http, path, _headers, &block|
354
- expect(path).to eq(url)
355
- end.and_return(http_ok)
406
+ stub_request(:head, url)
407
+ stub_request(:get, url)
356
408
 
357
409
  subject.request_with_redirects(url, :get, 0) do
358
410
  # unused
@@ -46,13 +46,15 @@ describe Puppet::Util::Log.desttypes[:file] do
46
46
 
47
47
  describe "on POSIX systems", :if => Puppet.features.posix? do
48
48
  describe "with a normal file" do
49
+ let (:parent) { Pathname.new('/tmp') }
49
50
  let (:abspath) { '/tmp/log' }
50
51
  let (:relpath) { 'log' }
51
52
 
52
53
  it_behaves_like "file destination"
53
54
 
54
55
  it "logs an error if it can't chown the file owner & group" do
55
- expect(File).to receive(:exists?).with(abspath).and_return(false)
56
+ allow(File).to receive(:exist?).with(parent).and_return(true)
57
+ expect(File).to receive(:exist?).with(Pathname.new(abspath)).and_return(false)
56
58
  expect(FileUtils).to receive(:chown).with(Puppet[:user], Puppet[:group], abspath).and_raise(Errno::EPERM)
57
59
  expect(Puppet.features).to receive(:root?).and_return(true)
58
60
  expect(Puppet).to receive(:err).with("Unable to set ownership to #{Puppet[:user]}:#{Puppet[:group]} for log file: #{abspath}")
@@ -61,7 +63,8 @@ describe Puppet::Util::Log.desttypes[:file] do
61
63
  end
62
64
 
63
65
  it "doesn't attempt to chown when running as non-root" do
64
- expect(File).to receive(:exists?).with(abspath).and_return(false)
66
+ allow(File).to receive(:exist?).with(parent).and_return(true)
67
+ expect(File).to receive(:exist?).with(Pathname.new(abspath)).and_return(false)
65
68
  expect(FileUtils).not_to receive(:chown).with(Puppet[:user], Puppet[:group], abspath)
66
69
  expect(Puppet.features).to receive(:root?).and_return(false)
67
70
 
@@ -69,7 +72,8 @@ describe Puppet::Util::Log.desttypes[:file] do
69
72
  end
70
73
 
71
74
  it "doesn't attempt to chown when file already exists" do
72
- expect(File).to receive(:exists?).with(abspath).and_return(true)
75
+ allow(File).to receive(:exist?).with(parent).and_return(true)
76
+ expect(File).to receive(:exist?).with(Pathname.new(abspath)).and_return(true)
73
77
  expect(FileUtils).not_to receive(:chown).with(Puppet[:user], Puppet[:group], abspath)
74
78
  expect(Puppet.features).to receive(:root?).and_return(true)
75
79
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.10.1
4
+ version: 6.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-14 00:00:00.000000000 Z
11
+ date: 2019-11-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter
@@ -148,6 +148,20 @@ dependencies:
148
148
  - - "~>"
149
149
  - !ruby/object:Gem::Version
150
150
  version: '1.0'
151
+ - !ruby/object:Gem::Dependency
152
+ name: deep_merge
153
+ requirement: !ruby/object:Gem::Requirement
154
+ requirements:
155
+ - - "~>"
156
+ - !ruby/object:Gem::Version
157
+ version: '1.0'
158
+ type: :runtime
159
+ prerelease: false
160
+ version_requirements: !ruby/object:Gem::Requirement
161
+ requirements:
162
+ - - "~>"
163
+ - !ruby/object:Gem::Version
164
+ version: '1.0'
151
165
  description: Puppet, an automated configuration management tool
152
166
  email: info@puppetlabs.com
153
167
  executables:
@@ -540,6 +554,18 @@ files:
540
554
  - lib/puppet/graph/relationship_graph.rb
541
555
  - lib/puppet/graph/sequential_prioritizer.rb
542
556
  - lib/puppet/graph/simple_graph.rb
557
+ - lib/puppet/http.rb
558
+ - lib/puppet/http/client.rb
559
+ - lib/puppet/http/errors.rb
560
+ - lib/puppet/http/redirector.rb
561
+ - lib/puppet/http/resolver.rb
562
+ - lib/puppet/http/resolver/settings.rb
563
+ - lib/puppet/http/resolver/srv.rb
564
+ - lib/puppet/http/response.rb
565
+ - lib/puppet/http/retry_after_handler.rb
566
+ - lib/puppet/http/service.rb
567
+ - lib/puppet/http/service/ca.rb
568
+ - lib/puppet/http/session.rb
543
569
  - lib/puppet/indirector.rb
544
570
  - lib/puppet/indirector/catalog/compiler.rb
545
571
  - lib/puppet/indirector/catalog/json.rb
@@ -838,7 +864,6 @@ files:
838
864
  - lib/puppet/pops/loader/loader.rb
839
865
  - lib/puppet/pops/loader/loader_paths.rb
840
866
  - lib/puppet/pops/loader/module_loaders.rb
841
- - lib/puppet/pops/loader/null_loader.rb
842
867
  - lib/puppet/pops/loader/predefined_loader.rb
843
868
  - lib/puppet/pops/loader/puppet_function_instantiator.rb
844
869
  - lib/puppet/pops/loader/puppet_plan_instantiator.rb
@@ -1006,6 +1031,7 @@ files:
1006
1031
  - lib/puppet/provider/package/aptrpm.rb
1007
1032
  - lib/puppet/provider/package/blastwave.rb
1008
1033
  - lib/puppet/provider/package/dnf.rb
1034
+ - lib/puppet/provider/package/dnfmodule.rb
1009
1035
  - lib/puppet/provider/package/dpkg.rb
1010
1036
  - lib/puppet/provider/package/fink.rb
1011
1037
  - lib/puppet/provider/package/freebsd.rb
@@ -1093,6 +1119,7 @@ files:
1093
1119
  - lib/puppet/rest/response.rb
1094
1120
  - lib/puppet/rest/route.rb
1095
1121
  - lib/puppet/rest/routes.rb
1122
+ - lib/puppet/runtime.rb
1096
1123
  - lib/puppet/scheduler.rb
1097
1124
  - lib/puppet/scheduler/job.rb
1098
1125
  - lib/puppet/scheduler/scheduler.rb
@@ -1156,6 +1183,7 @@ files:
1156
1183
  - lib/puppet/transaction/persistence.rb
1157
1184
  - lib/puppet/transaction/report.rb
1158
1185
  - lib/puppet/transaction/resource_harness.rb
1186
+ - lib/puppet/trusted_external.rb
1159
1187
  - lib/puppet/type.rb
1160
1188
  - lib/puppet/type/component.rb
1161
1189
  - lib/puppet/type/exec.rb
@@ -1298,19 +1326,6 @@ files:
1298
1326
  - lib/puppet/util/windows/user.rb
1299
1327
  - lib/puppet/util/yaml.rb
1300
1328
  - lib/puppet/vendor.rb
1301
- - lib/puppet/vendor/deep_merge/CHANGELOG
1302
- - lib/puppet/vendor/deep_merge/Gemfile
1303
- - lib/puppet/vendor/deep_merge/LICENSE
1304
- - lib/puppet/vendor/deep_merge/PUPPET_README.md
1305
- - lib/puppet/vendor/deep_merge/README.md
1306
- - lib/puppet/vendor/deep_merge/Rakefile
1307
- - lib/puppet/vendor/deep_merge/deep_merge.gemspec
1308
- - lib/puppet/vendor/deep_merge/lib/deep_merge.rb
1309
- - lib/puppet/vendor/deep_merge/lib/deep_merge/core.rb
1310
- - lib/puppet/vendor/deep_merge/lib/deep_merge/deep_merge_hash.rb
1311
- - lib/puppet/vendor/deep_merge/lib/deep_merge/rails_compat.rb
1312
- - lib/puppet/vendor/deep_merge/test/test_deep_merge.rb
1313
- - lib/puppet/vendor/load_deep_merge.rb
1314
1329
  - lib/puppet/vendor/load_pathspec.rb
1315
1330
  - lib/puppet/vendor/pathspec/CHANGELOG.md
1316
1331
  - lib/puppet/vendor/pathspec/LICENSE
@@ -1681,6 +1696,7 @@ files:
1681
1696
  - spec/fixtures/unit/provider/cron/crontab/vixie_header.txt
1682
1697
  - spec/fixtures/unit/provider/cron/parsed/managed
1683
1698
  - spec/fixtures/unit/provider/cron/parsed/simple
1699
+ - spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt
1684
1700
  - spec/fixtures/unit/provider/package/gem/gem-list-single-package
1685
1701
  - spec/fixtures/unit/provider/package/gem/line-with-1.8.5-warning
1686
1702
  - spec/fixtures/unit/provider/package/openbsd/pkginfo.detail
@@ -1732,9 +1748,6 @@ files:
1732
1748
  - spec/fixtures/unit/util/filetype/suntab_output
1733
1749
  - spec/fixtures/unit/util/monkey_patches/x509.pem
1734
1750
  - spec/fixtures/unit/util/rdoc/basic.pp
1735
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml
1736
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml
1737
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml
1738
1751
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml
1739
1752
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml
1740
1753
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml
@@ -2051,6 +2064,11 @@ files:
2051
2064
  - spec/unit/graph/simple_graph_spec.rb
2052
2065
  - spec/unit/hiera/scope_spec.rb
2053
2066
  - spec/unit/hiera_puppet_spec.rb
2067
+ - spec/unit/http/client_spec.rb
2068
+ - spec/unit/http/resolver_spec.rb
2069
+ - spec/unit/http/service/ca_spec.rb
2070
+ - spec/unit/http/service_spec.rb
2071
+ - spec/unit/http/session_spec.rb
2054
2072
  - spec/unit/indirector/catalog/compiler_spec.rb
2055
2073
  - spec/unit/indirector/catalog/json_spec.rb
2056
2074
  - spec/unit/indirector/catalog/msgpack_spec.rb
@@ -2340,6 +2358,7 @@ files:
2340
2358
  - spec/unit/provider/package/aptrpm_spec.rb
2341
2359
  - spec/unit/provider/package/base_spec.rb
2342
2360
  - spec/unit/provider/package/dnf_spec.rb
2361
+ - spec/unit/provider/package/dnfmodule_spec.rb
2343
2362
  - spec/unit/provider/package/dpkg_spec.rb
2344
2363
  - spec/unit/provider/package/freebsd_spec.rb
2345
2364
  - spec/unit/provider/package/gem_spec.rb
@@ -2926,6 +2945,7 @@ test_files:
2926
2945
  - spec/fixtures/unit/provider/cron/crontab/vixie_header.txt
2927
2946
  - spec/fixtures/unit/provider/cron/parsed/managed
2928
2947
  - spec/fixtures/unit/provider/cron/parsed/simple
2948
+ - spec/fixtures/unit/provider/package/dnfmodule/dnf-module-list-installed.txt
2929
2949
  - spec/fixtures/unit/provider/package/gem/gem-list-single-package
2930
2950
  - spec/fixtures/unit/provider/package/gem/line-with-1.8.5-warning
2931
2951
  - spec/fixtures/unit/provider/package/openbsd/pkginfo.detail
@@ -2977,9 +2997,6 @@ test_files:
2977
2997
  - spec/fixtures/unit/util/filetype/suntab_output
2978
2998
  - spec/fixtures/unit/util/monkey_patches/x509.pem
2979
2999
  - spec/fixtures/unit/util/rdoc/basic.pp
2980
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_get/should_yield_to_the_block.yml
2981
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_head/should_yield_to_the_block.yml
2982
- - spec/fixtures/vcr/cassettes/Puppet_Network_HTTP_Connection/when_handling_requests/_request_post/should_yield_to_the_block.yml
2983
3000
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_fetch_if_not_on_the_local_disk.yml
2984
3001
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_not_update_if_content_on_disk_is_up-to-date.yml
2985
3002
  - spec/fixtures/vcr/cassettes/Puppet_Type_File/when_sourcing/from_http/using_md5/should_update_if_content_differs_on_disk.yml
@@ -3296,6 +3313,11 @@ test_files:
3296
3313
  - spec/unit/graph/simple_graph_spec.rb
3297
3314
  - spec/unit/hiera/scope_spec.rb
3298
3315
  - spec/unit/hiera_puppet_spec.rb
3316
+ - spec/unit/http/client_spec.rb
3317
+ - spec/unit/http/resolver_spec.rb
3318
+ - spec/unit/http/service/ca_spec.rb
3319
+ - spec/unit/http/service_spec.rb
3320
+ - spec/unit/http/session_spec.rb
3299
3321
  - spec/unit/indirector/catalog/compiler_spec.rb
3300
3322
  - spec/unit/indirector/catalog/json_spec.rb
3301
3323
  - spec/unit/indirector/catalog/msgpack_spec.rb
@@ -3585,6 +3607,7 @@ test_files:
3585
3607
  - spec/unit/provider/package/aptrpm_spec.rb
3586
3608
  - spec/unit/provider/package/base_spec.rb
3587
3609
  - spec/unit/provider/package/dnf_spec.rb
3610
+ - spec/unit/provider/package/dnfmodule_spec.rb
3588
3611
  - spec/unit/provider/package/dpkg_spec.rb
3589
3612
  - spec/unit/provider/package/freebsd_spec.rb
3590
3613
  - spec/unit/provider/package/gem_spec.rb
@@ -1,60 +0,0 @@
1
- # The null loader is empty and delegates everything to its parent if it has one.
2
- #
3
- class Puppet::Pops::Loader::NullLoader < Puppet::Pops::Loader::Loader
4
- attr_reader :loader_name
5
-
6
- # Construct a NullLoader, optionally with a parent loader
7
- #
8
- def initialize(parent_loader=nil, loader_name = "null-loader")
9
- super(loader_name)
10
- @parent = parent_loader
11
- end
12
-
13
- # Has parent if one was set when constructed
14
- def parent
15
- @parent
16
- end
17
-
18
- def find(typed_name)
19
- if @parent.nil?
20
- nil
21
- else
22
- @parent.find(typed_name)
23
- end
24
- end
25
-
26
- def load_typed(typed_name)
27
- if @parent.nil?
28
- nil
29
- else
30
- @parent.load_typed(typed_name)
31
- end
32
- end
33
-
34
- def loaded_entry(typed_name, check_dependencies = false)
35
- if @parent.nil?
36
- nil
37
- else
38
- @parent.loaded_entry(typed_name, check_dependencies)
39
- end
40
- end
41
-
42
- # Has no entries on its own - always nil
43
- def get_entry(typed_name)
44
- nil
45
- end
46
-
47
- # Finds nothing, there are no entries
48
- def find(name)
49
- nil
50
- end
51
-
52
- # Cannot store anything
53
- def set_entry(typed_name, value, origin = nil)
54
- nil
55
- end
56
-
57
- def to_s()
58
- "(NullLoader '#{loader_name}')"
59
- end
60
- end