puppet 6.16.0-x64-mingw32 → 6.17.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.
- checksums.yaml +4 -4
- data/Gemfile +4 -2
- data/Gemfile.lock +10 -10
- data/README.md +2 -2
- data/lib/puppet/agent.rb +2 -2
- data/lib/puppet/application/agent.rb +14 -3
- data/lib/puppet/configurer.rb +20 -12
- data/lib/puppet/confine.rb +1 -1
- data/lib/puppet/defaults.rb +25 -8
- data/lib/puppet/file_serving/http_metadata.rb +13 -1
- data/lib/puppet/file_serving/metadata.rb +4 -1
- data/lib/puppet/file_serving/terminus_selector.rb +7 -8
- data/lib/puppet/file_system/file_impl.rb +1 -1
- data/lib/puppet/file_system/uniquefile.rb +8 -16
- data/lib/puppet/forge.rb +1 -1
- data/lib/puppet/forge/cache.rb +1 -1
- data/lib/puppet/forge/repository.rb +3 -7
- data/lib/puppet/http/client.rb +5 -0
- data/lib/puppet/http/redirector.rb +9 -7
- data/lib/puppet/http/response.rb +19 -0
- data/lib/puppet/indirector.rb +1 -1
- data/lib/puppet/indirector/file_content/rest.rb +1 -1
- data/lib/puppet/indirector/file_metadata/http.rb +24 -5
- data/lib/puppet/indirector/file_metadata/rest.rb +2 -2
- data/lib/puppet/indirector/request.rb +1 -1
- data/lib/puppet/network/http/api/indirected_routes.rb +1 -1
- data/lib/puppet/network/http/api/master/v3/environment.rb +3 -0
- data/lib/puppet/network/http/connection_adapter.rb +6 -4
- data/lib/puppet/parser/ast/leaf.rb +5 -5
- data/lib/puppet/parser/ast/pops_bridge.rb +0 -4
- data/lib/puppet/parser/compiler.rb +1 -1
- data/lib/puppet/parser/compiler/catalog_validator/env_relationship_validator.rb +2 -0
- data/lib/puppet/parser/compiler/catalog_validator/site_validator.rb +2 -0
- data/lib/puppet/parser/environment_compiler.rb +4 -1
- data/lib/puppet/parser/resource.rb +3 -2
- data/lib/puppet/parser/resource/param.rb +6 -0
- data/lib/puppet/pops/evaluator/evaluator_impl.rb +5 -5
- data/lib/puppet/pops/issues.rb +5 -0
- data/lib/puppet/pops/resource/resource_type_impl.rb +2 -0
- data/lib/puppet/pops/validation/checker4_0.rb +10 -0
- data/lib/puppet/pops/validation/validator_factory_4_0.rb +1 -0
- data/lib/puppet/provider/package/aptitude.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +1 -1
- data/lib/puppet/provider/service/windows.rb +23 -7
- data/lib/puppet/provider/user/useradd.rb +11 -4
- data/lib/puppet/reports/http.rb +2 -0
- data/lib/puppet/resource.rb +2 -1
- data/lib/puppet/resource/type.rb +8 -0
- data/lib/puppet/ssl/ssl_context.rb +2 -2
- data/lib/puppet/ssl/ssl_provider.rb +20 -1
- data/lib/puppet/test/test_helper.rb +8 -10
- data/lib/puppet/trusted_external.rb +29 -1
- data/lib/puppet/type.rb +12 -5
- data/lib/puppet/type/file.rb +38 -13
- data/lib/puppet/type/file/checksum.rb +4 -4
- data/lib/puppet/type/file/source.rb +4 -4
- data/lib/puppet/type/service.rb +49 -0
- data/lib/puppet/util.rb +39 -15
- data/lib/puppet/util/checksums.rb +19 -4
- data/lib/puppet/util/fileparsing.rb +2 -2
- data/lib/puppet/util/provider_features.rb +1 -1
- data/lib/puppet/util/reference.rb +1 -1
- data/lib/puppet/util/windows/api_types.rb +45 -32
- data/lib/puppet/util/windows/eventlog.rb +1 -6
- data/lib/puppet/util/windows/principal.rb +8 -6
- data/lib/puppet/util/windows/registry.rb +11 -11
- data/lib/puppet/util/windows/service.rb +43 -26
- data/lib/puppet/util/windows/user.rb +23 -8
- data/lib/puppet/version.rb +1 -1
- data/locales/puppet.pot +249 -221
- data/man/man5/puppet.conf.5 +19 -8
- data/man/man8/puppet-agent.8 +2 -2
- data/man/man8/puppet-apply.8 +1 -1
- data/man/man8/puppet-catalog.8 +1 -1
- data/man/man8/puppet-config.8 +1 -1
- data/man/man8/puppet-describe.8 +1 -1
- data/man/man8/puppet-device.8 +1 -1
- data/man/man8/puppet-doc.8 +1 -1
- data/man/man8/puppet-epp.8 +1 -1
- data/man/man8/puppet-facts.8 +1 -1
- data/man/man8/puppet-filebucket.8 +1 -1
- data/man/man8/puppet-generate.8 +1 -1
- data/man/man8/puppet-help.8 +1 -1
- data/man/man8/puppet-key.8 +1 -1
- data/man/man8/puppet-lookup.8 +1 -1
- data/man/man8/puppet-man.8 +1 -1
- data/man/man8/puppet-module.8 +1 -1
- data/man/man8/puppet-node.8 +1 -1
- data/man/man8/puppet-parser.8 +1 -1
- data/man/man8/puppet-plugin.8 +1 -1
- data/man/man8/puppet-report.8 +1 -1
- data/man/man8/puppet-resource.8 +1 -1
- data/man/man8/puppet-script.8 +1 -1
- data/man/man8/puppet-ssl.8 +1 -1
- data/man/man8/puppet-status.8 +1 -1
- data/man/man8/puppet.8 +2 -2
- data/spec/integration/application/agent_spec.rb +89 -0
- data/spec/integration/defaults_spec.rb +1 -2
- data/spec/integration/network/http_pool_spec.rb +26 -9
- data/spec/integration/parser/compiler_spec.rb +11 -0
- data/spec/integration/type/file_spec.rb +1 -1
- data/spec/integration/util/windows/registry_spec.rb +7 -7
- data/spec/integration/util/windows/user_spec.rb +40 -5
- data/spec/unit/configurer/fact_handler_spec.rb +4 -4
- data/spec/unit/context/trusted_information_spec.rb +10 -4
- data/spec/unit/file_serving/http_metadata_spec.rb +37 -14
- data/spec/unit/file_serving/terminus_selector_spec.rb +45 -26
- data/spec/unit/http/client_spec.rb +64 -8
- data/spec/unit/http/response_spec.rb +6 -0
- data/spec/unit/indirector/file_metadata/http_spec.rb +27 -0
- data/spec/unit/indirector/request_spec.rb +1 -1
- data/spec/unit/interface_spec.rb +3 -3
- data/spec/unit/network/http/api/indirected_routes_spec.rb +2 -1
- data/spec/unit/network/http/connection_spec.rb +42 -32
- data/spec/unit/parser/ast/block_expression_spec.rb +1 -1
- data/spec/unit/parser/environment_compiler_spec.rb +7 -0
- data/spec/unit/parser/scope_spec.rb +1 -1
- data/spec/unit/pops/evaluator/evaluating_parser_spec.rb +15 -1
- data/spec/unit/pops/loaders/loaders_spec.rb +1 -1
- data/spec/unit/pops/types/type_calculator_spec.rb +1 -11
- data/spec/unit/provider/service/windows_spec.rb +22 -14
- data/spec/unit/provider/user/openbsd_spec.rb +1 -0
- data/spec/unit/provider/user/useradd_spec.rb +22 -16
- data/spec/unit/resource_spec.rb +3 -3
- data/spec/unit/ssl/ssl_provider_spec.rb +69 -43
- data/spec/unit/test/test_helper_spec.rb +17 -0
- data/spec/unit/transaction/report_spec.rb +1 -1
- data/spec/unit/type/file/source_spec.rb +3 -3
- data/spec/unit/type/file_spec.rb +122 -96
- data/spec/unit/type/service_spec.rb +176 -0
- data/spec/unit/type_spec.rb +50 -0
- data/spec/unit/util/checksums_spec.rb +16 -0
- data/spec/unit/util/windows/api_types_spec.rb +104 -40
- data/spec/unit/util/windows/service_spec.rb +4 -4
- data/spec/unit/util_spec.rb +3 -3
- data/spec/unit/x509/cert_provider_spec.rb +1 -1
- metadata +5 -5
- 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, "#{
|
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
|
data/spec/unit/interface_spec.rb
CHANGED
@@ -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
|
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
|
204
|
-
face.get_action(:bar).display_global_options
|
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,
|
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,
|
86
|
+
stub_request(:get, encoded_url_with_params)
|
85
87
|
|
86
|
-
subject.request_get("#{path}
|
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
|
-
|
106
|
+
url_with_query = "#{url}?foo=bar"
|
107
|
+
stub_request(:get, url_with_query)
|
105
108
|
|
106
|
-
response = subject.request_get(
|
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,
|
124
|
+
stub_request(:head, encoded_url_with_params)
|
122
125
|
|
123
|
-
subject.request_head("#{path}
|
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
|
-
|
144
|
+
url_with_query = "#{url}?foo=bar"
|
145
|
+
stub_request(:head, url_with_query)
|
142
146
|
|
143
|
-
response = subject.request_head(
|
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,
|
162
|
+
stub_request(:post, encoded_url_with_params)
|
159
163
|
|
160
|
-
subject.request_post("#{path}
|
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
|
-
|
182
|
+
url_with_query = "#{url}?foo=bar"
|
183
|
+
stub_request(:post, url_with_query)
|
179
184
|
|
180
|
-
response = subject.request_post(
|
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,
|
198
|
+
stub_request(:get, encoded_url_with_params)
|
194
199
|
|
195
|
-
subject.get("#{path}
|
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
|
-
|
225
|
+
url_with_query = "#{url}?foo=bar"
|
226
|
+
stub_request(:get, url_with_query)
|
221
227
|
|
222
|
-
response = subject.get(
|
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,
|
241
|
+
stub_request(:head, encoded_url_with_params)
|
236
242
|
|
237
|
-
subject.head("#{path}
|
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
|
-
|
261
|
+
url_with_query = "#{url}?foo=bar"
|
262
|
+
stub_request(:head, url_with_query)
|
256
263
|
|
257
|
-
response = subject.head(
|
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,
|
277
|
+
stub_request(:put, encoded_url_with_params)
|
271
278
|
|
272
|
-
subject.put("#{path}
|
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
|
-
|
317
|
+
url_with_query = "#{url}?foo=bar"
|
318
|
+
stub_request(:put, url_with_query)
|
311
319
|
|
312
|
-
response = subject.put(
|
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,
|
333
|
+
stub_request(:post, encoded_url_with_params)
|
326
334
|
|
327
|
-
subject.post("#{path}
|
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
|
-
|
373
|
+
url_with_query = "#{url}?foo=bar"
|
374
|
+
stub_request(:post, url_with_query)
|
366
375
|
|
367
|
-
response = subject.post(
|
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,
|
395
|
+
stub_request(:delete, encoded_url_with_params)
|
387
396
|
|
388
|
-
subject.delete("#{path}
|
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
|
-
|
415
|
+
url_with_query = "#{url}?foo=bar"
|
416
|
+
stub_request(:delete, url_with_query)
|
407
417
|
|
408
|
-
response = subject.delete(
|
418
|
+
response = subject.delete(url_with_query)
|
409
419
|
expect(response).to be_an_instance_of(Net::HTTPOK)
|
410
420
|
end
|
411
421
|
end
|
@@ -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(
|
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(
|
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,
|
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(:
|
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(:
|
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(:
|
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
|
186
|
-
expect(service_util).to receive(:
|
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(:
|
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
|
201
|
-
expect(service_util).to receive(:
|
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(:
|
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
|
216
|
-
expect(service_util).to receive(:
|
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(:
|
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
|
231
|
-
expect(service_util).to receive(:
|
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
|