puppet 6.16.0-x86-mingw32 → 6.17.0-x86-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 (138) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -2
  3. data/Gemfile.lock +10 -10
  4. data/README.md +2 -2
  5. data/lib/puppet/agent.rb +2 -2
  6. data/lib/puppet/application/agent.rb +14 -3
  7. data/lib/puppet/configurer.rb +20 -12
  8. data/lib/puppet/confine.rb +1 -1
  9. data/lib/puppet/defaults.rb +25 -8
  10. data/lib/puppet/file_serving/http_metadata.rb +13 -1
  11. data/lib/puppet/file_serving/metadata.rb +4 -1
  12. data/lib/puppet/file_serving/terminus_selector.rb +7 -8
  13. data/lib/puppet/file_system/file_impl.rb +1 -1
  14. data/lib/puppet/file_system/uniquefile.rb +8 -16
  15. data/lib/puppet/forge.rb +1 -1
  16. data/lib/puppet/forge/cache.rb +1 -1
  17. data/lib/puppet/forge/repository.rb +3 -7
  18. data/lib/puppet/http/client.rb +5 -0
  19. data/lib/puppet/http/redirector.rb +9 -7
  20. data/lib/puppet/http/response.rb +19 -0
  21. data/lib/puppet/indirector.rb +1 -1
  22. data/lib/puppet/indirector/file_content/rest.rb +1 -1
  23. data/lib/puppet/indirector/file_metadata/http.rb +24 -5
  24. data/lib/puppet/indirector/file_metadata/rest.rb +2 -2
  25. data/lib/puppet/indirector/request.rb +1 -1
  26. data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
  27. data/lib/puppet/network/http/api/master/v3/environment.rb +3 -0
  28. data/lib/puppet/network/http/connection_adapter.rb +6 -4
  29. data/lib/puppet/parser/ast/leaf.rb +5 -5
  30. data/lib/puppet/parser/ast/pops_bridge.rb +0 -4
  31. data/lib/puppet/parser/compiler.rb +1 -1
  32. data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +2 -0
  33. data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +2 -0
  34. data/lib/puppet/parser/environment_compiler.rb +4 -1
  35. data/lib/puppet/parser/resource.rb +3 -2
  36. data/lib/puppet/parser/resource/param.rb +6 -0
  37. data/lib/puppet/pops/evaluator/evaluator_impl.rb +5 -5
  38. data/lib/puppet/pops/issues.rb +5 -0
  39. data/lib/puppet/pops/resource/resource_type_impl.rb +2 -0
  40. data/lib/puppet/pops/validation/checker4_0.rb +10 -0
  41. data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
  42. data/lib/puppet/provider/package/aptitude.rb +1 -1
  43. data/lib/puppet/provider/package/yum.rb +1 -1
  44. data/lib/puppet/provider/service/windows.rb +23 -7
  45. data/lib/puppet/provider/user/useradd.rb +11 -4
  46. data/lib/puppet/reports/http.rb +2 -0
  47. data/lib/puppet/resource.rb +2 -1
  48. data/lib/puppet/resource/type.rb +8 -0
  49. data/lib/puppet/ssl/ssl_context.rb +2 -2
  50. data/lib/puppet/ssl/ssl_provider.rb +20 -1
  51. data/lib/puppet/test/test_helper.rb +8 -10
  52. data/lib/puppet/trusted_external.rb +29 -1
  53. data/lib/puppet/type.rb +12 -5
  54. data/lib/puppet/type/file.rb +38 -13
  55. data/lib/puppet/type/file/checksum.rb +4 -4
  56. data/lib/puppet/type/file/source.rb +4 -4
  57. data/lib/puppet/type/service.rb +49 -0
  58. data/lib/puppet/util.rb +39 -15
  59. data/lib/puppet/util/checksums.rb +19 -4
  60. data/lib/puppet/util/fileparsing.rb +2 -2
  61. data/lib/puppet/util/provider_features.rb +1 -1
  62. data/lib/puppet/util/reference.rb +1 -1
  63. data/lib/puppet/util/windows/api_types.rb +45 -32
  64. data/lib/puppet/util/windows/eventlog.rb +1 -6
  65. data/lib/puppet/util/windows/principal.rb +8 -6
  66. data/lib/puppet/util/windows/registry.rb +11 -11
  67. data/lib/puppet/util/windows/service.rb +43 -26
  68. data/lib/puppet/util/windows/user.rb +23 -8
  69. data/lib/puppet/version.rb +1 -1
  70. data/locales/puppet.pot +249 -221
  71. data/man/man5/puppet.conf.5 +19 -8
  72. data/man/man8/puppet-agent.8 +2 -2
  73. data/man/man8/puppet-apply.8 +1 -1
  74. data/man/man8/puppet-catalog.8 +1 -1
  75. data/man/man8/puppet-config.8 +1 -1
  76. data/man/man8/puppet-describe.8 +1 -1
  77. data/man/man8/puppet-device.8 +1 -1
  78. data/man/man8/puppet-doc.8 +1 -1
  79. data/man/man8/puppet-epp.8 +1 -1
  80. data/man/man8/puppet-facts.8 +1 -1
  81. data/man/man8/puppet-filebucket.8 +1 -1
  82. data/man/man8/puppet-generate.8 +1 -1
  83. data/man/man8/puppet-help.8 +1 -1
  84. data/man/man8/puppet-key.8 +1 -1
  85. data/man/man8/puppet-lookup.8 +1 -1
  86. data/man/man8/puppet-man.8 +1 -1
  87. data/man/man8/puppet-module.8 +1 -1
  88. data/man/man8/puppet-node.8 +1 -1
  89. data/man/man8/puppet-parser.8 +1 -1
  90. data/man/man8/puppet-plugin.8 +1 -1
  91. data/man/man8/puppet-report.8 +1 -1
  92. data/man/man8/puppet-resource.8 +1 -1
  93. data/man/man8/puppet-script.8 +1 -1
  94. data/man/man8/puppet-ssl.8 +1 -1
  95. data/man/man8/puppet-status.8 +1 -1
  96. data/man/man8/puppet.8 +2 -2
  97. data/spec/integration/application/agent_spec.rb +89 -0
  98. data/spec/integration/defaults_spec.rb +1 -2
  99. data/spec/integration/network/http_pool_spec.rb +26 -9
  100. data/spec/integration/parser/compiler_spec.rb +11 -0
  101. data/spec/integration/type/file_spec.rb +1 -1
  102. data/spec/integration/util/windows/registry_spec.rb +7 -7
  103. data/spec/integration/util/windows/user_spec.rb +40 -5
  104. data/spec/unit/configurer/fact_handler_spec.rb +4 -4
  105. data/spec/unit/context/trusted_information_spec.rb +10 -4
  106. data/spec/unit/file_serving/http_metadata_spec.rb +37 -14
  107. data/spec/unit/file_serving/terminus_selector_spec.rb +45 -26
  108. data/spec/unit/http/client_spec.rb +64 -8
  109. data/spec/unit/http/response_spec.rb +6 -0
  110. data/spec/unit/indirector/file_metadata/http_spec.rb +27 -0
  111. data/spec/unit/indirector/request_spec.rb +1 -1
  112. data/spec/unit/interface_spec.rb +3 -3
  113. data/spec/unit/network/http/api/indirected_routes_spec.rb +2 -1
  114. data/spec/unit/network/http/connection_spec.rb +42 -32
  115. data/spec/unit/parser/ast/block_expression_spec.rb +1 -1
  116. data/spec/unit/parser/environment_compiler_spec.rb +7 -0
  117. data/spec/unit/parser/scope_spec.rb +1 -1
  118. data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +15 -1
  119. data/spec/unit/pops/loaders/loaders_spec.rb +1 -1
  120. data/spec/unit/pops/types/type_calculator_spec.rb +1 -11
  121. data/spec/unit/provider/service/windows_spec.rb +22 -14
  122. data/spec/unit/provider/user/openbsd_spec.rb +1 -0
  123. data/spec/unit/provider/user/useradd_spec.rb +22 -16
  124. data/spec/unit/resource_spec.rb +3 -3
  125. data/spec/unit/ssl/ssl_provider_spec.rb +69 -43
  126. data/spec/unit/test/test_helper_spec.rb +17 -0
  127. data/spec/unit/transaction/report_spec.rb +1 -1
  128. data/spec/unit/type/file/source_spec.rb +3 -3
  129. data/spec/unit/type/file_spec.rb +122 -96
  130. data/spec/unit/type/service_spec.rb +176 -0
  131. data/spec/unit/type_spec.rb +50 -0
  132. data/spec/unit/util/checksums_spec.rb +16 -0
  133. data/spec/unit/util/windows/api_types_spec.rb +104 -40
  134. data/spec/unit/util/windows/service_spec.rb +4 -4
  135. data/spec/unit/util_spec.rb +3 -3
  136. data/spec/unit/x509/cert_provider_spec.rb +1 -1
  137. metadata +5 -5
  138. data/spec/integration/test/test_helper_spec.rb +0 -31
@@ -66,4 +66,10 @@ describe Puppet::HTTP::Response do
66
66
 
67
67
  expect(client.get(uri)['Content-Encoding']).to eq('gzip')
68
68
  end
69
+
70
+ it "enumerates headers" do
71
+ stub_request(:get, uri).to_return(status: 200, headers: { 'Content-Encoding' => 'gzip' })
72
+
73
+ expect(client.get(uri).each_header.to_a).to eq([['content-encoding', 'gzip']])
74
+ end
69
75
  end
@@ -155,6 +155,33 @@ describe Puppet::Indirector::FileMetadata::Http do
155
155
 
156
156
  model.indirection.find(key)
157
157
  end
158
+
159
+ it "falls back to partial GET if HEAD is not allowed" do
160
+ stub_request(:head, key)
161
+ .to_return(status: 405)
162
+ stub_request(:get, key)
163
+ .to_return(status: 200, headers: {'Range' => 'bytes=0-0'})
164
+
165
+ model.indirection.find(key)
166
+ end
167
+
168
+ it "falls back to partial GET if HEAD is forbidden" do
169
+ stub_request(:head, key)
170
+ .to_return(status: 403)
171
+ stub_request(:get, key)
172
+ .to_return(status: 200, headers: {'Range' => 'bytes=0-0'})
173
+
174
+ model.indirection.find(key)
175
+ end
176
+
177
+ it "returns nil if the partial GET fails" do
178
+ stub_request(:head, key)
179
+ .to_return(status: 403)
180
+ stub_request(:get, key)
181
+ .to_return(status: 403)
182
+
183
+ expect(model.indirection.find(key)).to be_nil
184
+ end
158
185
  end
159
186
 
160
187
  context "when searching" do
@@ -94,7 +94,7 @@ describe Puppet::Indirector::Request do
94
94
 
95
95
  describe "and the URI is a 'file' URI" do
96
96
  before do
97
- @request = Puppet::Indirector::Request.new(:ind, :method, "#{URI.unescape(Puppet::Util.path_to_uri(file).to_s)}", nil)
97
+ @request = Puppet::Indirector::Request.new(:ind, :method, "#{Puppet::Util.uri_unescape(Puppet::Util.path_to_uri(file).to_s)}", nil)
98
98
  end
99
99
 
100
100
  it "should set the request key to the unescaped full file path" do
@@ -180,7 +180,7 @@ describe Puppet::Interface do
180
180
  display_global_options "modulepath"
181
181
  end
182
182
  end
183
- face.display_global_options =~ ["environment"]
183
+ expect(face.display_global_options).to match(["environment"])
184
184
  end
185
185
 
186
186
  it "should not fail when a face d_g_o duplicates an action d_g_o" do
@@ -200,8 +200,8 @@ describe Puppet::Interface do
200
200
  action :foo do when_invoked {|_| true} ; display_global_options "environment" end
201
201
  action :bar do when_invoked {|_| true} ; display_global_options "environment" end
202
202
  end
203
- face.get_action(:foo).display_global_options =~ ["environment"]
204
- face.get_action(:bar).display_global_options =~ ["environment"]
203
+ expect(face.get_action(:foo).display_global_options).to match(["environment"])
204
+ expect(face.get_action(:bar).display_global_options).to match(["environment"])
205
205
  end
206
206
 
207
207
  end
@@ -344,7 +344,8 @@ describe Puppet::Network::HTTP::API::IndirectedRoutes do
344
344
 
345
345
  expect {
346
346
  handler.call(request, response)
347
- }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotAcceptableError, /No supported formats are acceptable/)
347
+ }.to raise_error(Puppet::Network::HTTP::Error::HTTPNotAcceptableError,
348
+ %r{No supported formats are acceptable \(Accept: application/json, text/pson\)})
348
349
  end
349
350
 
350
351
  it "should return [] when searching returns an empty array" do
@@ -8,6 +8,8 @@ describe Puppet::Network::HTTP::Connection do
8
8
  let(:port) { 8140 }
9
9
  let(:path) { '/foo' }
10
10
  let(:url) { "https://#{host}:#{port}#{path}" }
11
+ let(:params) { { 'key' => 'a value' } }
12
+ let(:encoded_url_with_params) { "#{url}?%7B%22key%22:%22a%20value%22%7D" }
11
13
 
12
14
  shared_examples_for "an HTTP connection" do |klass, legacy_api|
13
15
  subject { klass.new(host, port, :verify => Puppet::SSL::Validator.no_validator) }
@@ -81,9 +83,9 @@ describe Puppet::Network::HTTP::Connection do
81
83
  end
82
84
 
83
85
  it "stringifies keys and encodes values in the query" do
84
- stub_request(:get, url).with(query: "foo=bar%3Dbaz")
86
+ stub_request(:get, encoded_url_with_params)
85
87
 
86
- subject.request_get("#{path}?foo=bar=baz") { |_| }
88
+ subject.request_get("#{path}?#{params.to_json}") { |_| }
87
89
  end
88
90
 
89
91
  it "merges custom headers with default ones" do
@@ -101,9 +103,10 @@ describe Puppet::Network::HTTP::Connection do
101
103
  end
102
104
 
103
105
  it "accepts a URL string as the path" do
104
- stub_request(:get, url)
106
+ url_with_query = "#{url}?foo=bar"
107
+ stub_request(:get, url_with_query)
105
108
 
106
- response = subject.request_get(url) { |_| }
109
+ response = subject.request_get(url_with_query) { |_| }
107
110
  expect(response).to be_an_instance_of(Net::HTTPOK)
108
111
  end
109
112
  end
@@ -118,9 +121,9 @@ describe Puppet::Network::HTTP::Connection do
118
121
  end
119
122
 
120
123
  it "stringifies keys and encodes values in the query" do
121
- stub_request(:head, url).with(query: "foo=bar%3Dbaz")
124
+ stub_request(:head, encoded_url_with_params)
122
125
 
123
- subject.request_head("#{path}?foo=bar=baz") { |_| }
126
+ subject.request_head("#{path}?#{params.to_json}") { |_| }
124
127
  end
125
128
 
126
129
  it "merges custom headers with default ones" do
@@ -138,9 +141,10 @@ describe Puppet::Network::HTTP::Connection do
138
141
  end
139
142
 
140
143
  it "accepts a URL string as the path" do
141
- stub_request(:head, url)
144
+ url_with_query = "#{url}?foo=bar"
145
+ stub_request(:head, url_with_query)
142
146
 
143
- response = subject.request_head(url) { |_| }
147
+ response = subject.request_head(url_with_query) { |_| }
144
148
  expect(response).to be_an_instance_of(Net::HTTPOK)
145
149
  end
146
150
  end
@@ -155,9 +159,9 @@ describe Puppet::Network::HTTP::Connection do
155
159
  end
156
160
 
157
161
  it "stringifies keys and encodes values in the query" do
158
- stub_request(:post, url).with(query: "foo=bar%3Dbaz")
162
+ stub_request(:post, encoded_url_with_params)
159
163
 
160
- subject.request_post("#{path}?foo=bar=baz", "") { |_| }
164
+ subject.request_post("#{path}?#{params.to_json}", "") { |_| }
161
165
  end
162
166
 
163
167
  it "merges custom headers with default ones" do
@@ -175,9 +179,10 @@ describe Puppet::Network::HTTP::Connection do
175
179
  end
176
180
 
177
181
  it "accepts a URL string as the path" do
178
- stub_request(:post, url)
182
+ url_with_query = "#{url}?foo=bar"
183
+ stub_request(:post, url_with_query)
179
184
 
180
- response = subject.request_post(url, "") { |_| }
185
+ response = subject.request_post(url_with_query, "") { |_| }
181
186
  expect(response).to be_an_instance_of(Net::HTTPOK)
182
187
  end
183
188
  end
@@ -190,9 +195,9 @@ describe Puppet::Network::HTTP::Connection do
190
195
  end
191
196
 
192
197
  it "stringifies keys and encodes values in the query" do
193
- stub_request(:get, url).with(query: "foo=bar%3Dbaz")
198
+ stub_request(:get, encoded_url_with_params)
194
199
 
195
- subject.get("#{path}?foo=bar=baz")
200
+ subject.get("#{path}?#{params.to_json}")
196
201
  end
197
202
 
198
203
  it "merges custom headers with default ones" do
@@ -217,9 +222,10 @@ describe Puppet::Network::HTTP::Connection do
217
222
  end
218
223
 
219
224
  it "accepts a URL string as the path" do
220
- stub_request(:get, url)
225
+ url_with_query = "#{url}?foo=bar"
226
+ stub_request(:get, url_with_query)
221
227
 
222
- response = subject.get(url)
228
+ response = subject.get(url_with_query)
223
229
  expect(response).to be_an_instance_of(Net::HTTPOK)
224
230
  end
225
231
  end
@@ -232,9 +238,9 @@ describe Puppet::Network::HTTP::Connection do
232
238
  end
233
239
 
234
240
  it "stringifies keys and encodes values in the query" do
235
- stub_request(:head, url).with(query: "foo=bar%3Dbaz")
241
+ stub_request(:head, encoded_url_with_params)
236
242
 
237
- subject.head("#{path}?foo=bar=baz")
243
+ subject.head("#{path}?#{params.to_json}")
238
244
  end
239
245
 
240
246
  it "merges custom headers with default ones" do
@@ -252,9 +258,10 @@ describe Puppet::Network::HTTP::Connection do
252
258
  end
253
259
 
254
260
  it "accepts a URL string as the path" do
255
- stub_request(:head, url)
261
+ url_with_query = "#{url}?foo=bar"
262
+ stub_request(:head, url_with_query)
256
263
 
257
- response = subject.head(url)
264
+ response = subject.head(url_with_query)
258
265
  expect(response).to be_an_instance_of(Net::HTTPOK)
259
266
  end
260
267
  end
@@ -267,9 +274,9 @@ describe Puppet::Network::HTTP::Connection do
267
274
  end
268
275
 
269
276
  it "stringifies keys and encodes values in the query" do
270
- stub_request(:put, url).with(query: "foo=bar%3Dbaz")
277
+ stub_request(:put, encoded_url_with_params)
271
278
 
272
- subject.put("#{path}?foo=bar=baz", "")
279
+ subject.put("#{path}?#{params.to_json}", "")
273
280
  end
274
281
 
275
282
  it "includes custom headers" do
@@ -307,9 +314,10 @@ describe Puppet::Network::HTTP::Connection do
307
314
  end
308
315
 
309
316
  it "accepts a URL string as the path" do
310
- stub_request(:put, url)
317
+ url_with_query = "#{url}?foo=bar"
318
+ stub_request(:put, url_with_query)
311
319
 
312
- response = subject.put(url, '')
320
+ response = subject.put(url_with_query, '')
313
321
  expect(response).to be_an_instance_of(Net::HTTPOK)
314
322
  end
315
323
  end
@@ -322,9 +330,9 @@ describe Puppet::Network::HTTP::Connection do
322
330
  end
323
331
 
324
332
  it "stringifies keys and encodes values in the query" do
325
- stub_request(:post, url).with(query: "foo=bar%3Dbaz")
333
+ stub_request(:post, encoded_url_with_params)
326
334
 
327
- subject.post("#{path}?foo=bar=baz", "", {'Content-Type' => 'text/plain'})
335
+ subject.post("#{path}?#{params.to_json}", "", {'Content-Type' => 'text/plain'})
328
336
  end
329
337
 
330
338
  it "includes custom headers" do
@@ -362,9 +370,10 @@ describe Puppet::Network::HTTP::Connection do
362
370
  end
363
371
 
364
372
  it "accepts a URL string as the path" do
365
- stub_request(:post, url)
373
+ url_with_query = "#{url}?foo=bar"
374
+ stub_request(:post, url_with_query)
366
375
 
367
- response = subject.post(url, '')
376
+ response = subject.post(url_with_query, '')
368
377
  expect(response).to be_an_instance_of(Net::HTTPOK)
369
378
  end
370
379
  end
@@ -383,9 +392,9 @@ describe Puppet::Network::HTTP::Connection do
383
392
  end
384
393
 
385
394
  it "stringifies keys and encodes values in the query" do
386
- stub_request(:delete, url).with(query: "foo=bar%3Dbaz")
395
+ stub_request(:delete, encoded_url_with_params)
387
396
 
388
- subject.delete("#{path}?foo=bar=baz")
397
+ subject.delete("#{path}?#{params.to_json}")
389
398
  end
390
399
 
391
400
  it "returns the response" do
@@ -403,9 +412,10 @@ describe Puppet::Network::HTTP::Connection do
403
412
  end
404
413
 
405
414
  it "accepts a URL string as the path" do
406
- stub_request(:delete, url)
415
+ url_with_query = "#{url}?foo=bar"
416
+ stub_request(:delete, url_with_query)
407
417
 
408
- response = subject.delete(url)
418
+ response = subject.delete(url_with_query)
409
419
  expect(response).to be_an_instance_of(Net::HTTPOK)
410
420
  end
411
421
  end
@@ -12,7 +12,7 @@ describe 'Puppet::Parser::AST::BlockExpression' do
12
12
  NO_SCOPE = nil
13
13
 
14
14
  def depth_probe
15
- StackDepthAST.new({})
15
+ StackDepthAST.new
16
16
  end
17
17
 
18
18
  def sequence_probe(name)
@@ -366,6 +366,13 @@ EOS
366
366
  }.to raise_error(/'Cap\[cap\]' is exported by both 'Prod\[one\]' and 'Prod\[two\]'/)
367
367
  end
368
368
 
369
+ it "issues deprecation warnings" do
370
+ expect {compile_collect_log(MANIFEST_WO_NODE)}.not_to raise_error
371
+ expect(warnings).to include(/Capability Mapping is deprecated/) # there are two of these
372
+ expect(warnings).to include(/Application is deprecated/)
373
+ expect(warnings).to include(/Site Definition is deprecated/)
374
+ end
375
+
369
376
  context "for producing node" do
370
377
  let(:compiled_node) { Puppet::Node.new('first', :environment => env) }
371
378
  let(:compiled_catalog) { compile_to_catalog(MANIFEST, compiled_node)}
@@ -105,7 +105,7 @@ describe Puppet::Parser::Scope do
105
105
 
106
106
  it "should fail if something that isn't a compiler is supplied" do
107
107
  expect {
108
- Puppet::Parser::Scope.new(:compiler => true)
108
+ Puppet::Parser::Scope.new(nil)
109
109
  }.to raise_error(Puppet::DevError, /you must pass a compiler instance/)
110
110
  end
111
111
 
@@ -1578,7 +1578,10 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
1578
1578
  let(:applicator) { double('apply_executor') }
1579
1579
 
1580
1580
  it 'invokes an apply_executor' do
1581
- expect(applicator).to receive(:apply).with(['arg1', 'arg2'], nil, scope).and_return(:result)
1581
+ expect(applicator).to receive(:apply).with(
1582
+ ['arg1', 'arg2'],
1583
+ instance_of(Puppet::Pops::Model::BlockExpression),
1584
+ scope).and_return(:result)
1582
1585
  src = "apply('arg1', 'arg2') { }"
1583
1586
  Puppet.override(apply_executor: applicator) do
1584
1587
  expect(parser.evaluate_string(scope, src)).to eq(:result)
@@ -1595,6 +1598,17 @@ describe 'Puppet::Pops::Evaluator::EvaluatorImpl' do
1595
1598
  expect(parser.evaluate_string(scope, src)).to eq(:result)
1596
1599
  end
1597
1600
  end
1601
+
1602
+ it 'returns a BlockExpression with an empty apply block' do
1603
+ expect(applicator).to receive(:apply).with(
1604
+ [['arg1']],
1605
+ instance_of(Puppet::Pops::Model::BlockExpression),
1606
+ scope).and_return(:result)
1607
+ src = "apply(['arg1']) { }"
1608
+ Puppet.override(apply_executor: applicator) do
1609
+ expect(parser.evaluate_string(scope, src)).to eq(:result)
1610
+ end
1611
+ end
1598
1612
  end
1599
1613
  end
1600
1614
 
@@ -461,7 +461,7 @@ describe 'loaders' do
461
461
  it "a function with syntax error has helpful error message" do
462
462
  expect {
463
463
  loader.load_typed(typed_name(:function, 'func_with_syntax_error'))
464
- }.to raise_error(/syntax error, unexpected (keyword_)?end/)
464
+ }.to raise_error(/syntax error, unexpected (keyword_|`)?end/)
465
465
  end
466
466
  end
467
467
 
@@ -1334,8 +1334,6 @@ describe 'The type calculator' do
1334
1334
 
1335
1335
  it 'should recognize mapped ruby types' do
1336
1336
  { Integer => PIntegerType::DEFAULT,
1337
- Fixnum => PIntegerType::DEFAULT,
1338
- Bignum => PIntegerType::DEFAULT,
1339
1337
  Float => PFloatType::DEFAULT,
1340
1338
  Numeric => PNumericType::DEFAULT,
1341
1339
  NilClass => PUndefType::DEFAULT,
@@ -2147,14 +2145,6 @@ describe 'The type calculator' do
2147
2145
  end
2148
2146
 
2149
2147
  context 'when converting a ruby class' do
2150
- it 'should yield \'PIntegerType\' for Fixnum' do
2151
- expect(calculator.type(Fixnum).class).to eq(PIntegerType)
2152
- end
2153
-
2154
- it 'should yield \'PIntegerType\' for Bignum' do
2155
- expect(calculator.type(Bignum).class).to eq(PIntegerType)
2156
- end
2157
-
2158
2148
  it 'should yield \'PIntegerType\' for Integer' do
2159
2149
  expect(calculator.type(Integer).class).to eq(PIntegerType)
2160
2150
  end
@@ -2275,7 +2265,7 @@ describe 'The type calculator' do
2275
2265
  it 'should infer PTypeType as the type of ruby classes' do
2276
2266
  class Foo
2277
2267
  end
2278
- [Object, Numeric, Integer, Fixnum, Bignum, Float, String, Regexp, Array, Hash, Foo].each do |c|
2268
+ [Object, Numeric, Integer, Float, String, Regexp, Array, Hash, Foo].each do |c|
2279
2269
  expect(calculator.infer(c).is_a?(PTypeType)).to eq(true)
2280
2270
  end
2281
2271
  end
@@ -58,7 +58,7 @@ describe 'Puppet::Type::Service::Provider::Windows',
58
58
  it "should enable if managing enable and enable is true" do
59
59
  resource[:enable] = :true
60
60
  expect(service_util).to receive(:start)
61
- expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_AUTO_START)
61
+ expect(service_util).to receive(:set_startup_configuration).with(name, options: {startup_type: :SERVICE_AUTO_START})
62
62
 
63
63
  provider.start
64
64
  end
@@ -66,7 +66,7 @@ describe 'Puppet::Type::Service::Provider::Windows',
66
66
  it "should manual start if managing enable and enable is false" do
67
67
  resource[:enable] = :false
68
68
  expect(service_util).to receive(:start)
69
- expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_DEMAND_START)
69
+ expect(service_util).to receive(:set_startup_configuration).with(name, options: {startup_type: :SERVICE_DEMAND_START})
70
70
 
71
71
  provider.start
72
72
  end
@@ -88,6 +88,14 @@ describe 'Puppet::Type::Service::Provider::Windows',
88
88
  expect(provider.status).to eql(:stopped)
89
89
  end
90
90
 
91
+ it "should report service as stopped when status cannot be retrieved" do
92
+ allow(service_util).to receive(:exists?).with(resource[:name]).and_return(true)
93
+ allow(service_util).to receive(:service_state).with(name).and_raise(Puppet::Error.new('Service query failed: The specified path is invalid.'))
94
+
95
+ expect(Puppet).to receive(:warning).with("Status for service #{resource[:name]} could not be retrieved: Service query failed: The specified path is invalid.")
96
+ expect(provider.status).to eql(:stopped)
97
+ end
98
+
91
99
  [
92
100
  :SERVICE_PAUSED,
93
101
  :SERVICE_PAUSE_PENDING
@@ -178,12 +186,12 @@ describe 'Puppet::Type::Service::Provider::Windows',
178
186
 
179
187
  describe "#enable" do
180
188
  it "should set service start type to Service_Auto_Start when enabled" do
181
- expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_AUTO_START)
189
+ expect(service_util).to receive(:set_startup_configuration).with(name, options: {startup_type: :SERVICE_AUTO_START})
182
190
  provider.enable
183
191
  end
184
192
 
185
- it "raises an error if set_startup_mode fails" do
186
- expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_AUTO_START).and_raise(Puppet::Error.new('foobar'))
193
+ it "raises an error if set_startup_configuration fails" do
194
+ expect(service_util).to receive(:set_startup_configuration).with(name, options: {startup_type: :SERVICE_AUTO_START}).and_raise(Puppet::Error.new('foobar'))
187
195
 
188
196
  expect {
189
197
  provider.enable
@@ -193,12 +201,12 @@ describe 'Puppet::Type::Service::Provider::Windows',
193
201
 
194
202
  describe "#disable" do
195
203
  it "should set service start type to Service_Disabled when disabled" do
196
- expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_DISABLED)
204
+ expect(service_util).to receive(:set_startup_configuration).with(name, options: {startup_type: :SERVICE_DISABLED})
197
205
  provider.disable
198
206
  end
199
207
 
200
- it "raises an error if set_startup_mode fails" do
201
- expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_DISABLED).and_raise(Puppet::Error.new('foobar'))
208
+ it "raises an error if set_startup_configuration fails" do
209
+ expect(service_util).to receive(:set_startup_configuration).with(name, options: {startup_type: :SERVICE_DISABLED}).and_raise(Puppet::Error.new('foobar'))
202
210
 
203
211
  expect {
204
212
  provider.disable
@@ -208,12 +216,12 @@ describe 'Puppet::Type::Service::Provider::Windows',
208
216
 
209
217
  describe "#manual_start" do
210
218
  it "should set service start type to Service_Demand_Start (manual) when manual" do
211
- expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_DEMAND_START)
219
+ expect(service_util).to receive(:set_startup_configuration).with(name, options: {startup_type: :SERVICE_DEMAND_START})
212
220
  provider.manual_start
213
221
  end
214
222
 
215
- it "raises an error if set_startup_mode fails" do
216
- expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_DEMAND_START).and_raise(Puppet::Error.new('foobar'))
223
+ it "raises an error if set_startup_configuration fails" do
224
+ expect(service_util).to receive(:set_startup_configuration).with(name, options: {startup_type: :SERVICE_DEMAND_START}).and_raise(Puppet::Error.new('foobar'))
217
225
 
218
226
  expect {
219
227
  provider.manual_start
@@ -223,12 +231,12 @@ describe 'Puppet::Type::Service::Provider::Windows',
223
231
 
224
232
  describe "#delayed_start" do
225
233
  it "should set service start type to Service_Config_Delayed_Auto_Start (delayed) when delayed" do
226
- expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_AUTO_START, true)
234
+ expect(service_util).to receive(:set_startup_configuration).with(name, options: {startup_type: :SERVICE_AUTO_START, delayed: true})
227
235
  provider.delayed_start
228
236
  end
229
237
 
230
- it "raises an error if set_startup_mode fails" do
231
- expect(service_util).to receive(:set_startup_mode).with(name, :SERVICE_AUTO_START, true).and_raise(Puppet::Error.new('foobar'))
238
+ it "raises an error if set_startup_configuration fails" do
239
+ expect(service_util).to receive(:set_startup_configuration).with(name, options: {startup_type: :SERVICE_AUTO_START, delayed: true}).and_raise(Puppet::Error.new('foobar'))
232
240
 
233
241
  expect {
234
242
  provider.delayed_start